Title: [243919] trunk/Source
Revision
243919
Author
[email protected]
Date
2019-04-04 17:11:08 -0700 (Thu, 04 Apr 2019)

Log Message

Have ScrollableArea store a ScrollType for the current scroll
https://bugs.webkit.org/show_bug.cgi?id=196627

Reviewed by Zalan Bujtas.

Source/WebCore:

RenderLayer had isInUserScroll() which is the opposite of ScrollableArea::inProgrammaticScroll(),
so just have ScrollableArea store a ScrollType.

RenderLayer's scrolling bottleneck, scrollToOffset(), now takes a ScrollType, and pushes
it onto the base class.

AsyncScrollingCoordinator::requestScrollPositionUpdate() can use the incoming scrollType (currently
incorrect for iOS WK2 overflow) rather than deducing a user scroll from ScrollingLayerPositionAction.

No behavior change.

* page/FrameView.cpp:
(WebCore::FrameView::setFrameRect):
(WebCore::FrameView::topContentInsetDidChange):
(WebCore::FrameView::updateLayoutViewport):
(WebCore::FrameView::setScrollPosition):
(WebCore::FrameView::shouldUpdateCompositingLayersAfterScrolling const):
(WebCore::FrameView::setWasScrolledByUser):
* page/FrameViewLayoutContext.cpp:
(WebCore::LayoutScope::LayoutScope):
(WebCore::LayoutScope::~LayoutScope):
* page/ios/FrameIOS.mm:
(WebCore::Frame::overflowScrollPositionChangedForNode):
* page/scrolling/AsyncScrollingCoordinator.cpp:
(WebCore::AsyncScrollingCoordinator::requestScrollPositionUpdate):
(WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll):
(WebCore::AsyncScrollingCoordinator::reconcileScrollingState):
* platform/ScrollView.cpp:
(WebCore::ScrollView::setScrollPosition):
* platform/ScrollableArea.cpp:
(WebCore::ScrollableArea::ScrollableArea):
* platform/ScrollableArea.h:
(WebCore::ScrollableArea::currentScrollType const):
(WebCore::ScrollableArea::setCurrentScrollType):
(WebCore::ScrollableArea::setIsUserScroll): Deleted.
(WebCore::ScrollableArea::inProgrammaticScroll const): Deleted.
(WebCore::ScrollableArea::setInProgrammaticScroll): Deleted.
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::RenderLayer):
(WebCore::RenderLayer::scrollToXPosition):
(WebCore::RenderLayer::scrollToYPosition):
(WebCore::RenderLayer::scrollToOffset):
(WebCore::RenderLayer::scrollTo):
* rendering/RenderLayer.h:
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateScrollOffset):
* rendering/RenderMarquee.cpp:
(WebCore::RenderMarquee::start):

Source/WebKitLegacy/mac:

Send the programmatic scroll type.

* DOM/DOMHTML.mm:
(-[DOMHTMLElement setScrollXOffset:scrollYOffset:adjustForIOSCaret:]):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (243918 => 243919)


--- trunk/Source/WebCore/ChangeLog	2019-04-05 00:08:31 UTC (rev 243918)
+++ trunk/Source/WebCore/ChangeLog	2019-04-05 00:11:08 UTC (rev 243919)
@@ -1,3 +1,59 @@
+2019-04-04  Simon Fraser  <[email protected]>
+
+        Have ScrollableArea store a ScrollType for the current scroll
+        https://bugs.webkit.org/show_bug.cgi?id=196627
+
+        Reviewed by Zalan Bujtas.
+
+        RenderLayer had isInUserScroll() which is the opposite of ScrollableArea::inProgrammaticScroll(),
+        so just have ScrollableArea store a ScrollType.
+
+        RenderLayer's scrolling bottleneck, scrollToOffset(), now takes a ScrollType, and pushes
+        it onto the base class.
+
+        AsyncScrollingCoordinator::requestScrollPositionUpdate() can use the incoming scrollType (currently
+        incorrect for iOS WK2 overflow) rather than deducing a user scroll from ScrollingLayerPositionAction.
+
+        No behavior change.
+
+        * page/FrameView.cpp:
+        (WebCore::FrameView::setFrameRect):
+        (WebCore::FrameView::topContentInsetDidChange):
+        (WebCore::FrameView::updateLayoutViewport):
+        (WebCore::FrameView::setScrollPosition):
+        (WebCore::FrameView::shouldUpdateCompositingLayersAfterScrolling const):
+        (WebCore::FrameView::setWasScrolledByUser):
+        * page/FrameViewLayoutContext.cpp:
+        (WebCore::LayoutScope::LayoutScope):
+        (WebCore::LayoutScope::~LayoutScope):
+        * page/ios/FrameIOS.mm:
+        (WebCore::Frame::overflowScrollPositionChangedForNode):
+        * page/scrolling/AsyncScrollingCoordinator.cpp:
+        (WebCore::AsyncScrollingCoordinator::requestScrollPositionUpdate):
+        (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll):
+        (WebCore::AsyncScrollingCoordinator::reconcileScrollingState):
+        * platform/ScrollView.cpp:
+        (WebCore::ScrollView::setScrollPosition):
+        * platform/ScrollableArea.cpp:
+        (WebCore::ScrollableArea::ScrollableArea):
+        * platform/ScrollableArea.h:
+        (WebCore::ScrollableArea::currentScrollType const):
+        (WebCore::ScrollableArea::setCurrentScrollType):
+        (WebCore::ScrollableArea::setIsUserScroll): Deleted.
+        (WebCore::ScrollableArea::inProgrammaticScroll const): Deleted.
+        (WebCore::ScrollableArea::setInProgrammaticScroll): Deleted.
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::RenderLayer):
+        (WebCore::RenderLayer::scrollToXPosition):
+        (WebCore::RenderLayer::scrollToYPosition):
+        (WebCore::RenderLayer::scrollToOffset):
+        (WebCore::RenderLayer::scrollTo):
+        * rendering/RenderLayer.h:
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::updateScrollOffset):
+        * rendering/RenderMarquee.cpp:
+        (WebCore::RenderMarquee::start):
+
 2019-04-04  Shawn Roberts  <[email protected]>
 
         Unreviewed, rolling out r243868.

Modified: trunk/Source/WebCore/page/FrameView.cpp (243918 => 243919)


--- trunk/Source/WebCore/page/FrameView.cpp	2019-04-05 00:08:31 UTC (rev 243918)
+++ trunk/Source/WebCore/page/FrameView.cpp	2019-04-05 00:11:08 UTC (rev 243919)
@@ -459,9 +459,11 @@
     IntRect oldRect = frameRect();
     if (newRect == oldRect)
         return;
+
     // Every scroll that happens as the result of frame size change is programmatic.
-    bool wasInProgrammaticScroll = inProgrammaticScroll();
-    setInProgrammaticScroll(true);
+    auto oldScrollType = currentScrollType();
+    setCurrentScrollType(ScrollType::Programmatic);
+
     ScrollView::setFrameRect(newRect);
 
     updateScrollableAreaSet();
@@ -475,7 +477,7 @@
         frame().page()->pageOverlayController().didChangeViewSize();
 
     viewportContentsChanged();
-    setInProgrammaticScroll(wasInProgrammaticScroll);
+    setCurrentScrollType(oldScrollType);
 }
 
 bool FrameView::scheduleAnimation()
@@ -1092,8 +1094,9 @@
     
     layoutContext().layout();
     // Every scroll that happens as the result of content inset change is programmatic.
-    bool wasInProgrammaticScroll = inProgrammaticScroll();
-    setInProgrammaticScroll(true);
+    auto oldScrollType = currentScrollType();
+    setCurrentScrollType(ScrollType::Programmatic);
+
     updateScrollbars(scrollPosition());
     if (renderView->usesCompositing())
         renderView->compositor().frameViewDidChangeSize();
@@ -1101,7 +1104,7 @@
     if (TiledBacking* tiledBacking = this->tiledBacking())
         tiledBacking->setTopContentInset(newTopContentInset);
 
-    setInProgrammaticScroll(wasInProgrammaticScroll);
+    setCurrentScrollType(oldScrollType);
 }
 
 void FrameView::topContentDirectionDidChange()
@@ -1675,7 +1678,7 @@
     LOG_WITH_STREAM(Scrolling, stream << "stable origins: min: " << minStableLayoutViewportOrigin() << " max: "<< maxStableLayoutViewportOrigin());
     
     if (m_layoutViewportOverrideRect) {
-        if (inProgrammaticScroll()) {
+        if (currentScrollType() == ScrollType::Programmatic) {
             LOG_WITH_STREAM(Scrolling, stream << "computing new override layout viewport because of programmatic scrolling");
             LayoutPoint newOrigin = computeLayoutViewportOrigin(visualViewportRect(), minStableLayoutViewportOrigin(), maxStableLayoutViewportOrigin(), layoutViewport, StickToDocumentBounds);
             setLayoutViewportOverrideRect(LayoutRect(newOrigin, m_layoutViewportOverrideRect.value().size()));
@@ -2279,8 +2282,8 @@
 {
     LOG_WITH_STREAM(Scrolling, stream << "FrameView::setScrollPosition " << scrollPosition << " , clearing anchor");
 
-    bool wasInProgrammaticScroll = inProgrammaticScroll();
-    setInProgrammaticScroll(true);
+    auto oldScrollType = currentScrollType();
+    setCurrentScrollType(ScrollType::Programmatic);
 
     m_maintainScrollPositionAnchor = nullptr;
     m_shouldScrollToFocusedElement = false;
@@ -2290,7 +2293,7 @@
         scrollAnimator().setWheelEventTestTrigger(page->testTrigger());
     ScrollView::setScrollPosition(scrollPosition);
 
-    setInProgrammaticScroll(wasInProgrammaticScroll);
+    setCurrentScrollType(oldScrollType);
 }
 
 void FrameView::resetScrollAnchor()
@@ -2564,7 +2567,7 @@
     if (scrollingCoordinator->shouldUpdateScrollLayerPositionSynchronously(*this))
         return true;
 
-    if (inProgrammaticScroll())
+    if (currentScrollType() == ScrollType::Programmatic)
         return true;
 
     return false;
@@ -4109,7 +4112,7 @@
 
     m_shouldScrollToFocusedElement = false;
     m_delayedScrollToFocusedElementTimer.stop();
-    if (inProgrammaticScroll())
+    if (currentScrollType() == ScrollType::Programmatic)
         return;
     m_maintainScrollPositionAnchor = nullptr;
     if (m_wasScrolledByUser == wasScrolledByUser)

Modified: trunk/Source/WebCore/page/FrameViewLayoutContext.cpp (243918 => 243919)


--- trunk/Source/WebCore/page/FrameViewLayoutContext.cpp	2019-04-05 00:08:31 UTC (rev 243918)
+++ trunk/Source/WebCore/page/FrameViewLayoutContext.cpp	2019-04-05 00:11:08 UTC (rev 243919)
@@ -116,14 +116,14 @@
         : m_view(layoutContext.view())
         , m_nestedState(layoutContext.m_layoutNestedState, layoutContext.m_layoutNestedState == FrameViewLayoutContext::LayoutNestedState::NotInLayout ? FrameViewLayoutContext::LayoutNestedState::NotNested : FrameViewLayoutContext::LayoutNestedState::Nested)
         , m_schedulingIsEnabled(layoutContext.m_layoutSchedulingIsEnabled, false)
-        , m_inProgrammaticScroll(layoutContext.view().inProgrammaticScroll())
+        , m_previousScrollType(layoutContext.view().currentScrollType())
     {
-        m_view.setInProgrammaticScroll(true);
+        m_view.setCurrentScrollType(ScrollType::Programmatic);
     }
         
     ~LayoutScope()
     {
-        m_view.setInProgrammaticScroll(m_inProgrammaticScroll);
+        m_view.setCurrentScrollType(m_previousScrollType);
     }
         
 private:
@@ -130,7 +130,7 @@
     FrameView& m_view;
     SetForScope<FrameViewLayoutContext::LayoutNestedState> m_nestedState;
     SetForScope<bool> m_schedulingIsEnabled;
-    bool m_inProgrammaticScroll { false };
+    ScrollType m_previousScrollType;
 };
 
 FrameViewLayoutContext::FrameViewLayoutContext(FrameView& frameView)

Modified: trunk/Source/WebCore/page/ios/FrameIOS.mm (243918 => 243919)


--- trunk/Source/WebCore/page/ios/FrameIOS.mm	2019-04-05 00:08:31 UTC (rev 243918)
+++ trunk/Source/WebCore/page/ios/FrameIOS.mm	2019-04-05 00:11:08 UTC (rev 243919)
@@ -705,9 +705,11 @@
 
     RenderLayer& layer = *downcast<RenderBoxModelObject>(*renderer).layer();
 
-    layer.setIsUserScroll(isUserScroll);
+    auto oldScrollType = layer.currentScrollType();
+    layer.setCurrentScrollType(isUserScroll ? ScrollType::User : ScrollType::Programmatic);
     layer.scrollToOffsetWithoutAnimation(position);
-    layer.setIsUserScroll(false);
+    layer.setCurrentScrollType(oldScrollType);
+
     layer.didEndScroll(); // FIXME: Should we always call this?
 }
 

Modified: trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp (243918 => 243919)


--- trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp	2019-04-05 00:08:31 UTC (rev 243918)
+++ trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp	2019-04-05 00:11:08 UTC (rev 243919)
@@ -213,7 +213,7 @@
         return false;
 
     bool inPageCache = frameView.frame().document()->pageCacheState() != Document::NotInPageCache;
-    bool inProgrammaticScroll = frameView.inProgrammaticScroll();
+    bool inProgrammaticScroll = frameView.currentScrollType() == ScrollType::Programmatic;
     if (inProgrammaticScroll || inPageCache)
         updateScrollPositionAfterAsyncScroll(frameView.scrollingNodeID(), scrollPosition, { }, ScrollType::Programmatic, ScrollingLayerPositionAction::Set);
 
@@ -325,9 +325,11 @@
 
     // Overflow-scroll area.
     if (auto* scrollableArea = frameView.scrollableAreaForScrollLayerID(scrollingNodeID)) {
-        scrollableArea->setIsUserScroll(scrollingLayerPositionAction == ScrollingLayerPositionAction::Sync);
+        auto previousScrollType = scrollableArea->currentScrollType();
+        scrollableArea->setCurrentScrollType(scrollType);
         scrollableArea->scrollToOffsetWithoutAnimation(scrollPosition);
-        scrollableArea->setIsUserScroll(false);
+        scrollableArea->setCurrentScrollType(previousScrollType);
+
         if (scrollingLayerPositionAction == ScrollingLayerPositionAction::Set)
             m_page->editorClient().overflowScrollPositionChanged();
 
@@ -343,8 +345,8 @@
 
 void AsyncScrollingCoordinator::reconcileScrollingState(FrameView& frameView, const FloatPoint& scrollPosition, const LayoutViewportOriginOrOverrideRect& layoutViewportOriginOrOverrideRect, ScrollType scrollType, ViewportRectStability viewportRectStability, ScrollingLayerPositionAction scrollingLayerPositionAction)
 {
-    bool oldProgrammaticScroll = frameView.inProgrammaticScroll();
-    frameView.setInProgrammaticScroll(scrollType == ScrollType::Programmatic);
+    auto previousScrollType = frameView.currentScrollType();
+    frameView.setCurrentScrollType(scrollType);
 
     LOG_WITH_STREAM(Scrolling, stream << getCurrentProcessID() << " AsyncScrollingCoordinator " << this << " reconcileScrollingState scrollPosition " << scrollPosition << " type " << scrollType << " stability " << viewportRectStability << " " << scrollingLayerPositionAction);
 
@@ -367,8 +369,9 @@
     frameView.setConstrainsScrollingToContentEdge(false);
     frameView.notifyScrollPositionChanged(roundedIntPoint(scrollPosition));
     frameView.setConstrainsScrollingToContentEdge(true);
-    frameView.setInProgrammaticScroll(oldProgrammaticScroll);
 
+    frameView.setCurrentScrollType(previousScrollType);
+
     if (scrollType == ScrollType::User && scrollingLayerPositionAction != ScrollingLayerPositionAction::Set) {
         auto scrollingNodeID = frameView.scrollingNodeID();
         if (viewportRectStability == ViewportRectStability::Stable)

Modified: trunk/Source/WebCore/platform/ScrollView.cpp (243918 => 243919)


--- trunk/Source/WebCore/platform/ScrollView.cpp	2019-04-05 00:08:31 UTC (rev 243918)
+++ trunk/Source/WebCore/platform/ScrollView.cpp	2019-04-05 00:11:08 UTC (rev 243919)
@@ -501,7 +501,7 @@
 
     ScrollPosition newScrollPosition = !delegatesScrolling() ? adjustScrollPositionWithinRange(scrollPosition) : scrollPosition;
 
-    if ((!delegatesScrolling() || !inProgrammaticScroll()) && newScrollPosition == this->scrollPosition())
+    if ((!delegatesScrolling() || currentScrollType() == ScrollType::User) && newScrollPosition == this->scrollPosition())
         return;
 
     if (requestScrollPositionUpdate(newScrollPosition))

Modified: trunk/Source/WebCore/platform/ScrollableArea.cpp (243918 => 243919)


--- trunk/Source/WebCore/platform/ScrollableArea.cpp	2019-04-05 00:08:31 UTC (rev 243918)
+++ trunk/Source/WebCore/platform/ScrollableArea.cpp	2019-04-05 00:11:08 UTC (rev 243919)
@@ -66,7 +66,7 @@
     , m_horizontalScrollElasticity(ScrollElasticityNone)
     , m_scrollbarOverlayStyle(ScrollbarOverlayStyleDefault)
     , m_scrollOriginChanged(false)
-    , m_inProgrammaticScroll(false)
+    , m_currentScrollType(static_cast<unsigned>(ScrollType::User))
     , m_scrollShouldClearLatchedState(false)
 {
 }

Modified: trunk/Source/WebCore/platform/ScrollableArea.h (243918 => 243919)


--- trunk/Source/WebCore/platform/ScrollableArea.h	2019-04-05 00:08:31 UTC (rev 243918)
+++ trunk/Source/WebCore/platform/ScrollableArea.h	2019-04-05 00:11:08 UTC (rev 243919)
@@ -95,7 +95,6 @@
     virtual void didEndScroll() { }
     virtual void didUpdateScroll() { }
 #endif
-    virtual void setIsUserScroll(bool) { }
 
     // Functions for controlling if you can scroll past the end of the document.
     bool constrainsScrollingToContentEdge() const { return m_constrainsScrollingToContentEdge; }
@@ -228,8 +227,8 @@
     WEBCORE_EXPORT virtual bool scrolledToLeft() const;
     WEBCORE_EXPORT virtual bool scrolledToRight() const;
 
-    bool inProgrammaticScroll() const { return m_inProgrammaticScroll; }
-    void setInProgrammaticScroll(bool inProgrammaticScroll) { m_inProgrammaticScroll = inProgrammaticScroll; }
+    ScrollType currentScrollType() const { return static_cast<ScrollType>(m_currentScrollType); }
+    void setCurrentScrollType(ScrollType scrollType) { m_currentScrollType = static_cast<unsigned>(scrollType); }
 
     bool scrollShouldClearLatchedState() const { return m_scrollShouldClearLatchedState; }
     void setScrollShouldClearLatchedState(bool shouldClear) { m_scrollShouldClearLatchedState = shouldClear; }
@@ -394,7 +393,7 @@
     unsigned m_scrollbarOverlayStyle : 2; // ScrollbarOverlayStyle
 
     unsigned m_scrollOriginChanged : 1;
-    unsigned m_inProgrammaticScroll : 1;
+    unsigned m_currentScrollType : 1; // ScrollType
     unsigned m_scrollShouldClearLatchedState : 1;
 };
 

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (243918 => 243919)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2019-04-05 00:08:31 UTC (rev 243918)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2019-04-05 00:11:08 UTC (rev 243919)
@@ -301,7 +301,6 @@
 #endif
     , m_adjustForIOSCaretWhenScrolling(false)
 #endif
-    , m_inUserScroll(false)
     , m_requiresScrollPositionReconciliation(false)
     , m_containsDirtyOverlayScrollbars(false)
     , m_updatingMarqueePosition(false)
@@ -2321,16 +2320,16 @@
     m_postLayoutScrollPosition = WTF::nullopt;
 }
 
-void RenderLayer::scrollToXPosition(int x, ScrollType, ScrollClamping clamping)
+void RenderLayer::scrollToXPosition(int x, ScrollType scrollType, ScrollClamping clamping)
 {
     ScrollPosition position(x, m_scrollPosition.y());
-    scrollToOffset(scrollOffsetFromPosition(position), clamping);
+    scrollToOffset(scrollOffsetFromPosition(position), scrollType, clamping);
 }
 
-void RenderLayer::scrollToYPosition(int y, ScrollType, ScrollClamping clamping)
+void RenderLayer::scrollToYPosition(int y, ScrollType scrollType, ScrollClamping clamping)
 {
     ScrollPosition position(m_scrollPosition.x(), y);
-    scrollToOffset(scrollOffsetFromPosition(position), clamping);
+    scrollToOffset(scrollOffsetFromPosition(position), scrollType, clamping);
 }
 
 ScrollOffset RenderLayer::clampScrollOffset(const ScrollOffset& scrollOffset) const
@@ -2338,11 +2337,18 @@
     return scrollOffset.constrainedBetween(IntPoint(), maximumScrollOffset());
 }
 
-void RenderLayer::scrollToOffset(const ScrollOffset& scrollOffset, ScrollClamping clamping)
+void RenderLayer::scrollToOffset(const ScrollOffset& scrollOffset, ScrollType scrollType, ScrollClamping clamping)
 {
     ScrollOffset newScrollOffset = clamping == ScrollClamping::Clamped ? clampScrollOffset(scrollOffset) : scrollOffset;
-    if (newScrollOffset != this->scrollOffset())
-        scrollToOffsetWithoutAnimation(newScrollOffset, clamping);
+    if (newScrollOffset == this->scrollOffset())
+        return;
+
+    auto previousScrollType = currentScrollType();
+    setCurrentScrollType(scrollType);
+
+    scrollToOffsetWithoutAnimation(newScrollOffset, clamping);
+
+    setCurrentScrollType(previousScrollType);
 }
 
 void RenderLayer::scrollTo(const ScrollPosition& position)
@@ -2351,7 +2357,7 @@
     if (!box)
         return;
 
-    LOG_WITH_STREAM(Scrolling, stream << "RenderLayer::scrollTo " << position << " from " << m_scrollPosition << " (in user scroll " << isInUserScroll() << ")");
+    LOG_WITH_STREAM(Scrolling, stream << "RenderLayer::scrollTo " << position << " from " << m_scrollPosition << " (is user scroll " << (currentScrollType() == ScrollType::User) << ")");
 
     ScrollPosition newPosition = position;
     if (!box->isHTMLMarquee()) {

Modified: trunk/Source/WebCore/rendering/RenderLayer.h (243918 => 243919)


--- trunk/Source/WebCore/rendering/RenderLayer.h	2019-04-05 00:08:31 UTC (rev 243918)
+++ trunk/Source/WebCore/rendering/RenderLayer.h	2019-04-05 00:11:08 UTC (rev 243919)
@@ -414,13 +414,15 @@
     // Scrolling methods for layers that can scroll their overflow.
     void scrollByRecursively(const IntSize& delta, ScrollableArea** scrolledArea = nullptr);
 
-    WEBCORE_EXPORT void scrollToOffset(const ScrollOffset&, ScrollClamping = ScrollClamping::Clamped);
-    void scrollToXOffset(int x, ScrollClamping clamping = ScrollClamping::Clamped) { scrollToOffset(ScrollOffset(x, scrollOffset().y()), clamping); }
-    void scrollToYOffset(int y, ScrollClamping clamping = ScrollClamping::Clamped) { scrollToOffset(ScrollOffset(scrollOffset().x(), y), clamping); }
+    WEBCORE_EXPORT void scrollToOffset(const ScrollOffset&, ScrollType = ScrollType::Programmatic, ScrollClamping = ScrollClamping::Clamped);
 
     void scrollToXPosition(int x, ScrollType, ScrollClamping = ScrollClamping::Clamped);
     void scrollToYPosition(int y, ScrollType, ScrollClamping = ScrollClamping::Clamped);
 
+    // These are only used by marquee.
+    void scrollToXOffset(int x, ScrollClamping clamping = ScrollClamping::Clamped) { scrollToOffset(ScrollOffset(x, scrollOffset().y()), ScrollType::Programmatic, clamping); }
+    void scrollToYOffset(int y, ScrollClamping clamping = ScrollClamping::Clamped) { scrollToOffset(ScrollOffset(scrollOffset().x(), y), ScrollType::Programmatic, clamping); }
+
     void setPostLayoutScrollPosition(Optional<ScrollPosition>);
     void applyPostLayoutScrollPositionIfNeeded();
 
@@ -459,9 +461,6 @@
     void updateSnapOffsets() override;
 #endif
 
-    void setIsUserScroll(bool isUserScroll) override { m_inUserScroll = isUserScroll; }
-    bool isInUserScroll() const { return m_inUserScroll; }
-
     bool requiresScrollPositionReconciliation() const { return m_requiresScrollPositionReconciliation; }
     void setRequiresScrollPositionReconciliation(bool requiresReconciliation = true) { m_requiresScrollPositionReconciliation = requiresReconciliation; }
 
@@ -1220,7 +1219,6 @@
     bool m_adjustForIOSCaretWhenScrolling : 1;
 #endif
 
-    bool m_inUserScroll : 1;
     bool m_requiresScrollPositionReconciliation : 1;
     bool m_containsDirtyOverlayScrollbars : 1;
     bool m_updatingMarqueePosition : 1;

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (243918 => 243919)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2019-04-05 00:08:31 UTC (rev 243918)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2019-04-05 00:11:08 UTC (rev 243919)
@@ -1262,7 +1262,7 @@
 
 void RenderLayerBacking::updateScrollOffset(ScrollOffset scrollOffset)
 {
-    if (m_owningLayer.isInUserScroll()) {
+    if (m_owningLayer.currentScrollType() == ScrollType::User) {
         // If scrolling is happening externally, we don't want to touch the layer bounds origin here because that will cause jitter.
         setLocationOfScrolledContents(scrollOffset, ScrollingLayerPositionAction::Sync);
         m_owningLayer.setRequiresScrollPositionReconciliation(true);

Modified: trunk/Source/WebCore/rendering/RenderMarquee.cpp (243918 => 243919)


--- trunk/Source/WebCore/rendering/RenderMarquee.cpp	2019-04-05 00:08:31 UTC (rev 243918)
+++ trunk/Source/WebCore/rendering/RenderMarquee.cpp	2019-04-05 00:11:08 UTC (rev 243919)
@@ -173,9 +173,9 @@
 
     if (!m_suspended && !m_stopped) {
         if (isHorizontal())
-            m_layer->scrollToOffset(ScrollOffset(m_start, 0), ScrollClamping::Unclamped);
+            m_layer->scrollToOffset(ScrollOffset(m_start, 0), ScrollType::Programmatic, ScrollClamping::Unclamped);
         else
-            m_layer->scrollToOffset(ScrollOffset(0, m_start), ScrollClamping::Unclamped);
+            m_layer->scrollToOffset(ScrollOffset(0, m_start), ScrollType::Programmatic, ScrollClamping::Unclamped);
     } else {
         m_suspended = false;
         m_stopped = false;

Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (243918 => 243919)


--- trunk/Source/WebKitLegacy/mac/ChangeLog	2019-04-05 00:08:31 UTC (rev 243918)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog	2019-04-05 00:11:08 UTC (rev 243919)
@@ -1,3 +1,15 @@
+2019-04-04  Simon Fraser  <[email protected]>
+
+        Have ScrollableArea store a ScrollType for the current scroll
+        https://bugs.webkit.org/show_bug.cgi?id=196627
+
+        Reviewed by Zalan Bujtas.
+
+        Send the programmatic scroll type.
+
+        * DOM/DOMHTML.mm:
+        (-[DOMHTMLElement setScrollXOffset:scrollYOffset:adjustForIOSCaret:]):
+
 2019-04-03  Myles C. Maxfield  <[email protected]>
 
         -apple-trailing-word is needed for browser detection

Modified: trunk/Source/WebKitLegacy/mac/DOM/DOMHTML.mm (243918 => 243919)


--- trunk/Source/WebKitLegacy/mac/DOM/DOMHTML.mm	2019-04-05 00:08:31 UTC (rev 243918)
+++ trunk/Source/WebKitLegacy/mac/DOM/DOMHTML.mm	2019-04-05 00:11:08 UTC (rev 243919)
@@ -115,7 +115,7 @@
     RenderLayer* layer = downcast<RenderBox>(*renderer).layer();
     if (adjustForIOSCaret)
         layer->setAdjustForIOSCaretWhenScrolling(true);
-    layer->scrollToOffset(ScrollOffset(x, y), ScrollClamping::Unclamped);
+    layer->scrollToOffset(ScrollOffset(x, y), ScrollType::Programmatic, ScrollClamping::Unclamped);
     if (adjustForIOSCaret)
         layer->setAdjustForIOSCaretWhenScrolling(false);
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to