Title: [257014] branches/safari-609.1.20.0-branch
Revision
257014
Author
alanc...@apple.com
Date
2020-02-19 17:51:51 -0800 (Wed, 19 Feb 2020)

Log Message

Cherry-pick r255037. rdar://problem/59446986

    Fixed elements no longer stay fixed with elastic overscroll
    https://bugs.webkit.org/show_bug.cgi?id=206227
    rdar://problem/58707084

    Reviewed by Antti Koivisto.
    Source/WebCore:

    Intended behavior on iOS and macOS is for position:fixed and sticky elements to maintain
    their position relative to the view bounds when rubber-banding ("overscrolling"). This broke
    some time back. This change restores the correct behavior with the call to layoutViewportRespectingRubberBanding()
    in ScrollingTreeFixedNode::applyLayerPositions() and ScrollingTreeStickyNode::computeLayerPosition().
    layoutViewportRespectingRubberBanding() computes a layout viewport without clamping.

    The rest of the changes are to support testing. internals.unconstrainedScrollTo()
    didn't work for main frame scrolling because of scroll position clamping in various places,
    so propagate ScrollClamping in more places (and replace the redundant ScrollPositionClamp with ScrollClamping).

    "requested scroll position" updates now carry along both clamping and "is programmatic" data, wrapped in a struct
    which is passed around the scrolling tree. This allows us to not clamp the scroll position (for testing) in more places.

    Internals::unconstrainedScrollTo() needs one weird hack to trigger a layout (and thus a scrolling tree commit),
    because the layout is normally triggered by a layout viewport change, but when rubber-banding we clamp the layoutViewport
    used for layout, so those layouts are never triggered.

    Tests: tiled-drawing/scrolling/fixed/fixed-during-rubberband.html
           tiled-drawing/scrolling/sticky/sticky-during-rubberband.html

    * Sources.txt:
    * WebCore.xcodeproj/project.pbxproj:
    * dom/Element.cpp:
    (WebCore::Element::scrollTo):
    * page/DOMWindow.cpp:
    (WebCore::DOMWindow::scrollTo const):
    * page/FrameView.cpp:
    (WebCore::FrameView::setScrollPosition):
    (WebCore::FrameView::requestScrollPositionUpdate):
    * page/FrameView.h:
    * page/scrolling/AsyncScrollingCoordinator.cpp:
    (WebCore::AsyncScrollingCoordinator::requestScrollPositionUpdate):
    * page/scrolling/AsyncScrollingCoordinator.h:
    * page/scrolling/ScrollingCoordinator.cpp:
    * page/scrolling/ScrollingCoordinator.h:
    (WebCore::ScrollingCoordinator::requestScrollPositionUpdate):
    * page/scrolling/ScrollingStateScrollingNode.cpp:
    (WebCore::ScrollingStateScrollingNode::ScrollingStateScrollingNode):
    (WebCore::ScrollingStateScrollingNode::setRequestedScrollData):
    (WebCore::ScrollingStateScrollingNode::dumpProperties const):
    (WebCore::ScrollingStateScrollingNode::setRequestedScrollPosition): Deleted.
    * page/scrolling/ScrollingStateScrollingNode.h:
    (WebCore::RequestedScrollData::operator== const):
    (WebCore::ScrollingStateScrollingNode::requestedScrollData const):
    (WebCore::ScrollingStateScrollingNode::requestedScrollPosition const): Deleted.
    (WebCore::ScrollingStateScrollingNode::requestedScrollPositionRepresentsProgrammaticScroll const): Deleted.
    * page/scrolling/ScrollingTree.h:
    (WebCore::ScrollingTree::scrollingTreeNodeRequestsScroll):
    * page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
    (WebCore::ScrollingTreeFrameScrollingNode::layoutViewportForScrollPosition const):
    (WebCore::ScrollingTreeFrameScrollingNode::layoutViewportRespectingRubberBanding const):
    * page/scrolling/ScrollingTreeFrameScrollingNode.h:
    * page/scrolling/ScrollingTreeScrollingNode.cpp:
    (WebCore::ScrollingTreeScrollingNode::commitStateAfterChildren):
    (WebCore::ScrollingTreeScrollingNode::adjustedScrollPosition const):
    (WebCore::ScrollingTreeScrollingNode::scrollBy):
    (WebCore::ScrollingTreeScrollingNode::scrollTo):
    (WebCore::ScrollingTreeScrollingNode::wasScrolledByDelegatedScrolling):
    * page/scrolling/ScrollingTreeScrollingNode.h:
    * page/scrolling/cocoa/ScrollingTreeFixedNode.mm:
    (WebCore::ScrollingTreeFixedNode::applyLayerPositions):
    * page/scrolling/cocoa/ScrollingTreeStickyNode.mm:
    (WebCore::ScrollingTreeStickyNode::computeLayerPosition const):
    * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
    * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
    (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateAfterChildren):
    (WebCore::ScrollingTreeFrameScrollingNodeMac::adjustedScrollPosition const):
    * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h:
    * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
    (WebCore::ScrollingTreeOverflowScrollingNodeMac::commitStateAfterChildren):
    (WebCore::ScrollingTreeOverflowScrollingNodeMac::adjustedScrollPosition const):
    * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm:
    (WebCore::ScrollingTreeScrollingNodeDelegateMac::immediateScrollByWithoutContentEdgeConstraints):
    * platform/ScrollTypes.cpp: Added.
    (WebCore::operator<<):
    * platform/ScrollTypes.h:
    * platform/ScrollView.cpp:
    (WebCore::ScrollView::setContentsScrollPosition):
    (WebCore::ScrollView::setScrollPosition):
    * platform/ScrollView.h:
    * platform/ScrollableArea.cpp:
    (WebCore::ScrollableArea::setScrollOffsetFromAnimation):
    * platform/ScrollableArea.h:
    (WebCore::ScrollableArea::requestScrollPositionUpdate):
    * rendering/RenderLayer.cpp:
    (WebCore::RenderLayer::scrollToOffset):
    * testing/Internals.cpp:
    (WebCore::Internals::unconstrainedScrollTo):

    Source/WebKit:

    Intended behavior on iOS and macOS is for position:fixed and sticky elements to maintain
    their position relative to the view bounds when rubber-banding ("overscrolling"). This broke
    some time back. This change restores the correct behavior with the call to layoutViewportRespectingRubberBanding()
    in ScrollingTreeFixedNode::applyLayerPositions() and ScrollingTreeStickyNode::computeLayerPosition().
    layoutViewportRespectingRubberBanding() computes a layout viewport without clamping.

    The rest of the changes are to support testing. internals.unconstrainedScrollTo()
    didn't work for main frame scrolling because of scroll position clamping in various places,
    so propagate ScrollClamping in more places (and replace the redundant ScrollPositionClamp with ScrollClamping).

    "requested scroll position" updates now carry along both clamping and "is programmatic" data, wrapped in a struct
    which is passed around the scrolling tree. This allows us to not clamp the scroll position (for testing) in more places.

    * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
    (ArgumentCoder<ScrollingStateScrollingNode>::encode):
    (ArgumentCoder<ScrollingStateScrollingNode>::decode):
    (ArgumentCoder<RequestedScrollData>::encode):
    (ArgumentCoder<RequestedScrollData>::decode):
    (WebKit::dump):
    * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
    (WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeNodeRequestsScroll):
    * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
    * UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp:
    (WebKit::RemoteScrollingTree::scrollingTreeNodeRequestsScroll):
    * UIProcess/RemoteLayerTree/RemoteScrollingTree.h:
    * UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm:
    (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::commitStateAfterChildren):
    * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
    (WebKit::ScrollingTreeScrollingNodeDelegateIOS::commitStateAfterChildren):

    LayoutTests:

    * tiled-drawing/scrolling/fixed/fixed-during-rubberband-expected.html: Added.
    * tiled-drawing/scrolling/fixed/fixed-during-rubberband.html: Added.
    * tiled-drawing/scrolling/sticky/sticky-during-rubberband-expected.html: Added.
    * tiled-drawing/scrolling/sticky/sticky-during-rubberband.html: Added.

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255037 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Added Paths

Diff

Added: branches/safari-609.1.20.0-branch/LayoutTests/tiled-drawing/scrolling/fixed/fixed-during-rubberband-expected.html (0 => 257014)


--- branches/safari-609.1.20.0-branch/LayoutTests/tiled-drawing/scrolling/fixed/fixed-during-rubberband-expected.html	                        (rev 0)
+++ branches/safari-609.1.20.0-branch/LayoutTests/tiled-drawing/scrolling/fixed/fixed-during-rubberband-expected.html	2020-02-20 01:51:51 UTC (rev 257014)
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <style>
+        body {
+            height: 2000px;
+            margin: 0;
+        }
+        .fixed {
+            position: absolute;
+            top: 100px;
+            height: 200px;
+            width: 100%;
+            background-color: green;
+        }
+    </style>
+    <script>
+        window.addEventListener('load', () => {
+            internals.unconstrainedScrollTo(document.scrollingElement, 0, -100);
+        }, false);
+    </script>
+</head>
+<body>
+
+<div class="fixed"></div>
+
+</body>
+</html>

Added: branches/safari-609.1.20.0-branch/LayoutTests/tiled-drawing/scrolling/fixed/fixed-during-rubberband.html (0 => 257014)


--- branches/safari-609.1.20.0-branch/LayoutTests/tiled-drawing/scrolling/fixed/fixed-during-rubberband.html	                        (rev 0)
+++ branches/safari-609.1.20.0-branch/LayoutTests/tiled-drawing/scrolling/fixed/fixed-during-rubberband.html	2020-02-20 01:51:51 UTC (rev 257014)
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <style>
+        body {
+            height: 2000px;
+            margin: 0;
+        }
+        .fixed {
+            position: fixed;
+            top: 200px;
+            height: 200px;
+            width: 100%;
+            background-color: green;
+        }
+    </style>
+    <script>
+        window.addEventListener('load', () => {
+            internals.unconstrainedScrollTo(document.scrollingElement, 0, -100);
+        }, false);
+    </script>
+</head>
+<body>
+
+<div class="fixed"></div>
+
+</body>
+</html>

Added: branches/safari-609.1.20.0-branch/LayoutTests/tiled-drawing/scrolling/sticky/sticky-during-rubberband-expected.html (0 => 257014)


--- branches/safari-609.1.20.0-branch/LayoutTests/tiled-drawing/scrolling/sticky/sticky-during-rubberband-expected.html	                        (rev 0)
+++ branches/safari-609.1.20.0-branch/LayoutTests/tiled-drawing/scrolling/sticky/sticky-during-rubberband-expected.html	2020-02-20 01:51:51 UTC (rev 257014)
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <style>
+        body {
+            height: 2000px;
+            margin: 0;
+        }
+        
+        .sticky-container {
+            border: 1px solid black;
+            height: 400px;
+            width: 80%;
+            margin-top: -10px;
+        }
+
+        .sticky {
+            position: relative;
+            top: 0px;
+            height: 200px;
+            width: 100%;
+            background-color: green;
+        }
+    </style>
+    <script>
+        window.addEventListener('load', () => {
+            internals.unconstrainedScrollTo(document.scrollingElement, 0, -10);
+        }, false);
+    </script>
+</head>
+<body>
+
+<div class="sticky-container">
+    <div class="sticky"></div>    
+</div>
+
+</body>
+</html>

Added: branches/safari-609.1.20.0-branch/LayoutTests/tiled-drawing/scrolling/sticky/sticky-during-rubberband.html (0 => 257014)


--- branches/safari-609.1.20.0-branch/LayoutTests/tiled-drawing/scrolling/sticky/sticky-during-rubberband.html	                        (rev 0)
+++ branches/safari-609.1.20.0-branch/LayoutTests/tiled-drawing/scrolling/sticky/sticky-during-rubberband.html	2020-02-20 01:51:51 UTC (rev 257014)
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <style>
+        body {
+            height: 2000px;
+            margin: 0;
+        }
+        
+        .sticky-container {
+            border: 1px solid black;
+            height: 400px;
+            width: 80%;
+            margin-top: -10px;
+        }
+
+        .sticky {
+            position: sticky;
+            top: 0px;
+            height: 200px;
+            width: 100%;
+            background-color: green;
+        }
+    </style>
+    <script>
+        window.addEventListener('load', () => {
+            internals.unconstrainedScrollTo(document.scrollingElement, 0, -10);
+        }, false);
+    </script>
+</head>
+<body>
+
+<div class="sticky-container">
+    <div class="sticky"></div>    
+</div>
+
+</body>
+</html>

Modified: branches/safari-609.1.20.0-branch/Source/WebCore/Sources.txt (257013 => 257014)


--- branches/safari-609.1.20.0-branch/Source/WebCore/Sources.txt	2020-02-20 01:50:59 UTC (rev 257013)
+++ branches/safari-609.1.20.0-branch/Source/WebCore/Sources.txt	2020-02-20 01:51:51 UTC (rev 257014)
@@ -1757,6 +1757,7 @@
 platform/RuntimeApplicationChecks.cpp
 platform/SSLKeyGenerator.cpp
 platform/ScrollAnimator.cpp
+platform/ScrollTypes.cpp
 platform/ScrollView.cpp
 platform/ScrollableArea.cpp
 platform/Scrollbar.cpp

Modified: branches/safari-609.1.20.0-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj (257013 => 257014)


--- branches/safari-609.1.20.0-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2020-02-20 01:50:59 UTC (rev 257013)
+++ branches/safari-609.1.20.0-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2020-02-20 01:51:51 UTC (rev 257014)
@@ -5736,6 +5736,7 @@
 		0F4966A71DB40C4300A274BB /* JSDOMPointInit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDOMPointInit.h; sourceTree = "<group>"; };
 		0F4966A81DB40C4300A274BB /* JSDOMPointReadOnly.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMPointReadOnly.cpp; sourceTree = "<group>"; };
 		0F4966A91DB40C4300A274BB /* JSDOMPointReadOnly.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDOMPointReadOnly.h; sourceTree = "<group>"; };
+		0F4CDEAA23D91A8A00251B02 /* ScrollTypes.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ScrollTypes.cpp; sourceTree = "<group>"; };
 		0F53FB81213B1BB800C40D34 /* CSSFilter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSFilter.cpp; sourceTree = "<group>"; };
 		0F53FB83213B1BB800C40D34 /* CSSFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSFilter.h; sourceTree = "<group>"; };
 		0F53FB89213B768400C40D34 /* RenderLayerFilters.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RenderLayerFilters.h; sourceTree = "<group>"; };
@@ -26017,6 +26018,7 @@
 				BC8B854A0E7C7F5600AB6984 /* ScrollbarTheme.h */,
 				BC1402880E83680800319717 /* ScrollbarThemeComposite.cpp */,
 				BC1402890E83680800319717 /* ScrollbarThemeComposite.h */,
+				0F4CDEAA23D91A8A00251B02 /* ScrollTypes.cpp */,
 				93C09C850B0657AA005ABD4D /* ScrollTypes.h */,
 				BC2441C30E8B65D00055320F /* ScrollView.cpp */,
 				BC6D6E2509AF943500F59759 /* ScrollView.h */,

Modified: branches/safari-609.1.20.0-branch/Source/WebCore/dom/Element.cpp (257013 => 257014)


--- branches/safari-609.1.20.0-branch/Source/WebCore/dom/Element.cpp	2020-02-20 01:50:59 UTC (rev 257013)
+++ branches/safari-609.1.20.0-branch/Source/WebCore/dom/Element.cpp	2020-02-20 01:51:51 UTC (rev 257014)
@@ -943,7 +943,7 @@
         if (!window)
             return;
 
-        window->scrollTo(options);
+        window->scrollTo(options, clamping);
         return;
     }
 

Modified: branches/safari-609.1.20.0-branch/Source/WebCore/page/DOMWindow.cpp (257013 => 257014)


--- branches/safari-609.1.20.0-branch/Source/WebCore/page/DOMWindow.cpp	2020-02-20 01:50:59 UTC (rev 257013)
+++ branches/safari-609.1.20.0-branch/Source/WebCore/page/DOMWindow.cpp	2020-02-20 01:51:51 UTC (rev 257014)
@@ -1617,7 +1617,7 @@
     scrollTo({ x, y }, clamping);
 }
 
-void DOMWindow::scrollTo(const ScrollToOptions& options, ScrollClamping) const
+void DOMWindow::scrollTo(const ScrollToOptions& options, ScrollClamping clamping) const
 {
     if (!isCurrentlyDisplayedInFrame())
         return;
@@ -1636,7 +1636,7 @@
     document()->updateLayoutIgnorePendingStylesheets();
 
     IntPoint layoutPos(view->mapFromCSSToLayoutUnits(scrollToOptions.left.value()), view->mapFromCSSToLayoutUnits(scrollToOptions.top.value()));
-    view->setContentsScrollPosition(layoutPos);
+    view->setContentsScrollPosition(layoutPos, clamping);
 }
 
 bool DOMWindow::allowedToChangeWindowGeometry() const

Modified: branches/safari-609.1.20.0-branch/Source/WebCore/page/FrameView.cpp (257013 => 257014)


--- branches/safari-609.1.20.0-branch/Source/WebCore/page/FrameView.cpp	2020-02-20 01:50:59 UTC (rev 257013)
+++ branches/safari-609.1.20.0-branch/Source/WebCore/page/FrameView.cpp	2020-02-20 01:51:51 UTC (rev 257014)
@@ -2279,7 +2279,7 @@
     setScrollPosition(IntPoint(bounds.x() - centeringOffsetX - rect.x(), bounds.y() - centeringOffsetY - rect.y()));
 }
 
-void FrameView::setScrollPosition(const ScrollPosition& scrollPosition)
+void FrameView::setScrollPosition(const ScrollPosition& scrollPosition, ScrollClamping clamping)
 {
     LOG_WITH_STREAM(Scrolling, stream << "FrameView::setScrollPosition " << scrollPosition << " , clearing anchor");
 
@@ -2292,7 +2292,7 @@
     Page* page = frame().page();
     if (page && page->isMonitoringWheelEvents())
         scrollAnimator().setWheelEventTestMonitor(page->wheelEventTestMonitor());
-    ScrollView::setScrollPosition(scrollPosition);
+    ScrollView::setScrollPosition(scrollPosition, clamping);
 
     setCurrentScrollType(oldScrollType);
 }
@@ -2616,7 +2616,7 @@
     return false;
 }
 
-bool FrameView::requestScrollPositionUpdate(const ScrollPosition& position)
+bool FrameView::requestScrollPositionUpdate(const ScrollPosition& position, ScrollType scrollType, ScrollClamping clamping)
 {
     LOG_WITH_STREAM(Scrolling, stream << "FrameView::requestScrollPositionUpdate " << position);
 
@@ -2628,7 +2628,7 @@
 #if ENABLE(ASYNC_SCROLLING) || USE(COORDINATED_GRAPHICS)
     if (Page* page = frame().page()) {
         if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator())
-            return scrollingCoordinator->requestScrollPositionUpdate(*this, position);
+            return scrollingCoordinator->requestScrollPositionUpdate(*this, position, scrollType, clamping);
     }
 #else
     UNUSED_PARAM(position);

Modified: branches/safari-609.1.20.0-branch/Source/WebCore/page/FrameView.h (257013 => 257014)


--- branches/safari-609.1.20.0-branch/Source/WebCore/page/FrameView.h	2020-02-20 01:50:59 UTC (rev 257013)
+++ branches/safari-609.1.20.0-branch/Source/WebCore/page/FrameView.h	2020-02-20 01:51:51 UTC (rev 257014)
@@ -117,7 +117,7 @@
     void setNeedsCompositingConfigurationUpdate();
     void setNeedsCompositingGeometryUpdate();
 
-    void setViewportConstrainedObjectsNeedLayout();
+    WEBCORE_EXPORT void setViewportConstrainedObjectsNeedLayout();
 
     WEBCORE_EXPORT bool renderedCharactersExceed(unsigned threshold);
 
@@ -223,13 +223,13 @@
 #if USE(COORDINATED_GRAPHICS)
     WEBCORE_EXPORT void setFixedVisibleContentRect(const IntRect&) final;
 #endif
-    WEBCORE_EXPORT void setScrollPosition(const ScrollPosition&) final;
+    WEBCORE_EXPORT void setScrollPosition(const ScrollPosition&, ScrollClamping = ScrollClamping::Clamped) final;
     void restoreScrollbar();
     void scheduleScrollToFocusedElement(SelectionRevealMode);
     void scrollToFocusedElementImmediatelyIfNeeded();
     void updateLayerPositionsAfterScrolling() final;
     void updateCompositingLayersAfterScrolling() final;
-    bool requestScrollPositionUpdate(const ScrollPosition&) final;
+    bool requestScrollPositionUpdate(const ScrollPosition&, ScrollType = ScrollType::User, ScrollClamping = ScrollClamping::Clamped) final;
     bool isRubberBandInProgress() const final;
     WEBCORE_EXPORT ScrollPosition minimumScrollPosition() const final;
     WEBCORE_EXPORT ScrollPosition maximumScrollPosition() const final;

Modified: branches/safari-609.1.20.0-branch/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp (257013 => 257014)


--- branches/safari-609.1.20.0-branch/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp	2020-02-20 01:50:59 UTC (rev 257013)
+++ branches/safari-609.1.20.0-branch/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp	2020-02-20 01:51:51 UTC (rev 257014)
@@ -230,7 +230,7 @@
     node->setHorizontalScrollbarLayer(frameView.layerForHorizontalScrollbar());
 }
 
-bool AsyncScrollingCoordinator::requestScrollPositionUpdate(ScrollableArea& scrollableArea, const IntPoint& scrollPosition)
+bool AsyncScrollingCoordinator::requestScrollPositionUpdate(ScrollableArea& scrollableArea, const IntPoint& scrollPosition, ScrollType scrollType, ScrollClamping clamping)
 {
     ASSERT(isMainThread());
     ASSERT(m_page);
@@ -251,6 +251,8 @@
     if (inProgrammaticScroll || inBackForwardCache)
         updateScrollPositionAfterAsyncScroll(scrollingNodeID, scrollPosition, { }, ScrollType::Programmatic, ScrollingLayerPositionAction::Set);
 
+    ASSERT(inProgrammaticScroll == (scrollType == ScrollType::Programmatic));
+
     // If this frame view's document is being put into the back/forward cache, we don't want to update our
     // main frame scroll position. Just let the FrameView think that we did.
     if (inBackForwardCache)
@@ -260,7 +262,7 @@
     if (!stateNode)
         return false;
 
-    stateNode->setRequestedScrollPosition(scrollPosition, inProgrammaticScroll);
+    stateNode->setRequestedScrollData({ scrollPosition, scrollType, clamping });
     return true;
 }
 

Modified: branches/safari-609.1.20.0-branch/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h (257013 => 257014)


--- branches/safari-609.1.20.0-branch/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h	2020-02-20 01:50:59 UTC (rev 257013)
+++ branches/safari-609.1.20.0-branch/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h	2020-02-20 01:51:51 UTC (rev 257014)
@@ -98,7 +98,7 @@
     WEBCORE_EXPORT void frameViewVisualViewportChanged(FrameView&) override;
     WEBCORE_EXPORT void frameViewEventTrackingRegionsChanged(FrameView&) override;
 
-    WEBCORE_EXPORT bool requestScrollPositionUpdate(ScrollableArea&, const IntPoint&) override;
+    WEBCORE_EXPORT bool requestScrollPositionUpdate(ScrollableArea&, const IntPoint&, ScrollType, ScrollClamping) override;
 
     WEBCORE_EXPORT void applyScrollingTreeLayerPositions() override;
 

Modified: branches/safari-609.1.20.0-branch/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp (257013 => 257014)


--- branches/safari-609.1.20.0-branch/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp	2020-02-20 01:50:59 UTC (rev 257013)
+++ branches/safari-609.1.20.0-branch/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp	2020-02-20 01:51:51 UTC (rev 257014)
@@ -498,13 +498,4 @@
     return ts;
 }
 
-TextStream& operator<<(TextStream& ts, ScrollType scrollType)
-{
-    switch (scrollType) {
-    case ScrollType::User: ts << "user"; break;
-    case ScrollType::Programmatic: ts << "programmatic"; break;
-    }
-    return ts;
-}
-
 } // namespace WebCore

Modified: branches/safari-609.1.20.0-branch/Source/WebCore/page/scrolling/ScrollingCoordinator.h (257013 => 257014)


--- branches/safari-609.1.20.0-branch/Source/WebCore/page/scrolling/ScrollingCoordinator.h	2020-02-20 01:50:59 UTC (rev 257013)
+++ branches/safari-609.1.20.0-branch/Source/WebCore/page/scrolling/ScrollingCoordinator.h	2020-02-20 01:51:51 UTC (rev 257014)
@@ -121,7 +121,7 @@
 
     // These virtual functions are currently unique to the threaded scrolling architecture. 
     virtual void commitTreeStateIfNeeded() { }
-    virtual bool requestScrollPositionUpdate(ScrollableArea&, const IntPoint&) { return false; }
+    virtual bool requestScrollPositionUpdate(ScrollableArea&, const IntPoint&, ScrollType = ScrollType::Programmatic, ScrollClamping = ScrollClamping::Clamped) { return false; }
     virtual ScrollingEventResult handleWheelEvent(FrameView&, const PlatformWheelEvent&) { return ScrollingEventResult::DidNotHandleEvent; }
 
     // Create an unparented node.
@@ -221,7 +221,6 @@
 WEBCORE_EXPORT WTF::TextStream& operator<<(WTF::TextStream&, ScrollingNodeType);
 WEBCORE_EXPORT WTF::TextStream& operator<<(WTF::TextStream&, ScrollingLayerPositionAction);
 WEBCORE_EXPORT WTF::TextStream& operator<<(WTF::TextStream&, ViewportRectStability);
-WEBCORE_EXPORT WTF::TextStream& operator<<(WTF::TextStream&, ScrollType);
 
 } // namespace WebCore
 

Modified: branches/safari-609.1.20.0-branch/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.cpp (257013 => 257014)


--- branches/safari-609.1.20.0-branch/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.cpp	2020-02-20 01:50:59 UTC (rev 257013)
+++ branches/safari-609.1.20.0-branch/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.cpp	2020-02-20 01:51:51 UTC (rev 257014)
@@ -45,7 +45,6 @@
     , m_reachableContentsSize(stateNode.reachableContentsSize())
     , m_parentRelativeScrollableRect(stateNode.parentRelativeScrollableRect())
     , m_scrollPosition(stateNode.scrollPosition())
-    , m_requestedScrollPosition(stateNode.requestedScrollPosition())
     , m_scrollOrigin(stateNode.scrollOrigin())
 #if ENABLE(CSS_SCROLL_SNAP)
     , m_snapOffsetsInfo(stateNode.m_snapOffsetsInfo)
@@ -55,7 +54,7 @@
     , m_horizontalScrollerImp(stateNode.horizontalScrollerImp())
 #endif
     , m_scrollableAreaParameters(stateNode.scrollableAreaParameters())
-    , m_requestedScrollPositionRepresentsProgrammaticScroll(stateNode.requestedScrollPositionRepresentsProgrammaticScroll())
+    , m_requestedScrollData(stateNode.requestedScrollData())
     , m_isMonitoringWheelEvents(stateNode.isMonitoringWheelEvents())
 {
     if (hasChangedProperty(ScrollContainerLayer))
@@ -219,10 +218,12 @@
     setPropertyChanged(ScrollableAreaParams);
 }
 
-void ScrollingStateScrollingNode::setRequestedScrollPosition(const FloatPoint& requestedScrollPosition, bool representsProgrammaticScroll)
+void ScrollingStateScrollingNode::setRequestedScrollData(const RequestedScrollData& scrollData)
 {
-    m_requestedScrollPosition = requestedScrollPosition;
-    m_requestedScrollPositionRepresentsProgrammaticScroll = representsProgrammaticScroll;
+    if (scrollData == m_requestedScrollData)
+        return;
+
+    m_requestedScrollData = scrollData;
     setPropertyChanged(RequestedScrollPosition);
 }
 
@@ -305,15 +306,18 @@
     if (m_reachableContentsSize != m_totalContentsSize)
         ts.dumpProperty("reachable contents size", m_reachableContentsSize);
 
-    if (m_requestedScrollPosition != IntPoint()) {
+    if (!m_requestedScrollData.scrollPosition.isZero()) {
         TextStream::GroupScope scope(ts);
         ts << "requested scroll position "
-            << TextStream::FormatNumberRespectingIntegers(m_requestedScrollPosition.x()) << " "
-            << TextStream::FormatNumberRespectingIntegers(m_requestedScrollPosition.y());
+            << TextStream::FormatNumberRespectingIntegers(m_requestedScrollData.scrollPosition.x()) << " "
+            << TextStream::FormatNumberRespectingIntegers(m_requestedScrollData.scrollPosition.y());
     }
-    if (m_requestedScrollPositionRepresentsProgrammaticScroll)
-        ts.dumpProperty("requested scroll position represents programmatic scroll", m_requestedScrollPositionRepresentsProgrammaticScroll);
+    if (m_requestedScrollData.scrollType == ScrollType::Programmatic)
+        ts.dumpProperty("requested scroll position represents programmatic scroll", true);
 
+    if (m_requestedScrollData.clamping == ScrollClamping::Unclamped)
+        ts.dumpProperty("requested scroll position clamping", m_requestedScrollData.clamping);
+
     if (!m_parentRelativeScrollableRect.isEmpty())
         ts.dumpProperty("parent relative scrollable rect", m_parentRelativeScrollableRect);
 

Modified: branches/safari-609.1.20.0-branch/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.h (257013 => 257014)


--- branches/safari-609.1.20.0-branch/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.h	2020-02-20 01:50:59 UTC (rev 257013)
+++ branches/safari-609.1.20.0-branch/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.h	2020-02-20 01:51:51 UTC (rev 257014)
@@ -38,6 +38,19 @@
 
 namespace WebCore {
 
+struct RequestedScrollData {
+    FloatPoint scrollPosition;
+    ScrollType scrollType { ScrollType::User };
+    ScrollClamping clamping { ScrollClamping::Clamped };
+    
+    bool operator==(const RequestedScrollData& other) const
+    {
+        return scrollPosition == other.scrollPosition
+            && scrollType == other.scrollType
+            && clamping == other.clamping;
+    }
+};
+
 class ScrollingStateScrollingNode : public ScrollingStateNode {
 public:
     virtual ~ScrollingStateScrollingNode();
@@ -109,9 +122,8 @@
     const ScrollableAreaParameters& scrollableAreaParameters() const { return m_scrollableAreaParameters; }
     WEBCORE_EXPORT void setScrollableAreaParameters(const ScrollableAreaParameters& params);
 
-    const FloatPoint& requestedScrollPosition() const { return m_requestedScrollPosition; }
-    bool requestedScrollPositionRepresentsProgrammaticScroll() const { return m_requestedScrollPositionRepresentsProgrammaticScroll; }
-    WEBCORE_EXPORT void setRequestedScrollPosition(const FloatPoint&, bool representsProgrammaticScroll);
+    const RequestedScrollData& requestedScrollData() const { return m_requestedScrollData; }
+    WEBCORE_EXPORT void setRequestedScrollData(const RequestedScrollData&);
 
     bool isMonitoringWheelEvents() const { return m_isMonitoringWheelEvents; }
     WEBCORE_EXPORT void setIsMonitoringWheelEvents(bool);
@@ -149,7 +161,6 @@
     FloatSize m_reachableContentsSize;
     LayoutRect m_parentRelativeScrollableRect;
     FloatPoint m_scrollPosition;
-    FloatPoint m_requestedScrollPosition;
     IntPoint m_scrollOrigin;
 
 #if ENABLE(CSS_SCROLL_SNAP)
@@ -169,8 +180,8 @@
 #endif
 
     ScrollableAreaParameters m_scrollableAreaParameters;
+    RequestedScrollData m_requestedScrollData;
 
-    bool m_requestedScrollPositionRepresentsProgrammaticScroll { false };
     bool m_isMonitoringWheelEvents { false };
 };
 

Modified: branches/safari-609.1.20.0-branch/Source/WebCore/page/scrolling/ScrollingTree.h (257013 => 257014)


--- branches/safari-609.1.20.0-branch/Source/WebCore/page/scrolling/ScrollingTree.h	2020-02-20 01:50:59 UTC (rev 257013)
+++ branches/safari-609.1.20.0-branch/Source/WebCore/page/scrolling/ScrollingTree.h	2020-02-20 01:51:51 UTC (rev 257014)
@@ -83,7 +83,7 @@
     virtual void scrollingTreeNodeDidScroll(ScrollingTreeScrollingNode&, ScrollingLayerPositionAction = ScrollingLayerPositionAction::Sync) = 0;
 
     // Called for requested scroll position updates.
-    virtual void scrollingTreeNodeRequestsScroll(ScrollingNodeID, const FloatPoint& /*scrollPosition*/, bool /*representsProgrammaticScroll*/) { }
+    virtual void scrollingTreeNodeRequestsScroll(ScrollingNodeID, const FloatPoint& /*scrollPosition*/, ScrollType, ScrollClamping) { }
 
     // Delegated scrolling/zooming has caused the viewport to change, so update viewport-constrained layers
     WEBCORE_EXPORT void mainFrameViewportChangedViaDelegatedScrolling(const FloatPoint& scrollPosition, const WebCore::FloatRect& layoutViewport, double scale);

Modified: branches/safari-609.1.20.0-branch/Source/WebCore/page/scrolling/ScrollingTreeFrameScrollingNode.cpp (257013 => 257014)


--- branches/safari-609.1.20.0-branch/Source/WebCore/page/scrolling/ScrollingTreeFrameScrollingNode.cpp	2020-02-20 01:50:59 UTC (rev 257013)
+++ branches/safari-609.1.20.0-branch/Source/WebCore/page/scrolling/ScrollingTreeFrameScrollingNode.cpp	2020-02-20 01:51:51 UTC (rev 257014)
@@ -95,7 +95,7 @@
     return position == currentScrollPosition() && (!overrideLayoutViewport || overrideLayoutViewport.value() == m_layoutViewport);
 }
 
-FloatRect ScrollingTreeFrameScrollingNode::layoutViewportForScrollPosition(const FloatPoint& visibleContentOrigin, float scale) const
+FloatRect ScrollingTreeFrameScrollingNode::layoutViewportForScrollPosition(const FloatPoint& visibleContentOrigin, float scale, ScrollBehaviorForFixedElements fixedBehavior) const
 {
     FloatSize visualViewportSize = m_overrideVisualViewportSize.valueOr(scrollableAreaSize());
     FloatRect visibleContentRect(visibleContentOrigin, visualViewportSize);
@@ -107,7 +107,7 @@
     LOG_WITH_STREAM(Scrolling, stream << "  visualViewport: " << visualViewport);
     LOG_WITH_STREAM(Scrolling, stream << "  scroll positions: min: " << minLayoutViewportOrigin() << " max: "<< maxLayoutViewportOrigin());
 
-    LayoutPoint newLocation = FrameView::computeLayoutViewportOrigin(LayoutRect(visualViewport), LayoutPoint(minLayoutViewportOrigin()), LayoutPoint(maxLayoutViewportOrigin()), layoutViewport, StickToDocumentBounds);
+    LayoutPoint newLocation = FrameView::computeLayoutViewportOrigin(LayoutRect(visualViewport), LayoutPoint(minLayoutViewportOrigin()), LayoutPoint(maxLayoutViewportOrigin()), layoutViewport, fixedBehavior);
 
     if (layoutViewport.location() != newLocation) {
         layoutViewport.setLocation(newLocation);
@@ -125,6 +125,11 @@
         setLayoutViewport(layoutViewportForScrollPosition(currentScrollPosition(), frameScaleFactor()));
 }
 
+FloatRect ScrollingTreeFrameScrollingNode::layoutViewportRespectingRubberBanding() const
+{
+    return layoutViewportForScrollPosition(currentScrollPosition(), frameScaleFactor(), StickToViewportBounds);
+}
+
 FloatSize ScrollingTreeFrameScrollingNode::viewToContentsOffset(const FloatPoint& scrollPosition) const
 {
     return toFloatSize(scrollPosition) - FloatSize(0, headerHeight() + topContentInset());

Modified: branches/safari-609.1.20.0-branch/Source/WebCore/page/scrolling/ScrollingTreeFrameScrollingNode.h (257013 => 257014)


--- branches/safari-609.1.20.0-branch/Source/WebCore/page/scrolling/ScrollingTreeFrameScrollingNode.h	2020-02-20 01:50:59 UTC (rev 257013)
+++ branches/safari-609.1.20.0-branch/Source/WebCore/page/scrolling/ScrollingTreeFrameScrollingNode.h	2020-02-20 01:51:51 UTC (rev 257014)
@@ -47,11 +47,12 @@
     bool visualViewportIsSmallerThanLayoutViewport() const { return m_visualViewportIsSmallerThanLayoutViewport; }
 
     FloatSize viewToContentsOffset(const FloatPoint& scrollPosition) const;
-    FloatRect layoutViewportForScrollPosition(const FloatPoint& visibleContentOrigin, float scale) const;
 
     FloatRect layoutViewport() const { return m_layoutViewport; };
     void setLayoutViewport(const FloatRect& r) { m_layoutViewport = r; };
 
+    FloatRect layoutViewportRespectingRubberBanding() const;
+
     float frameScaleFactor() const { return m_frameScaleFactor; }
 
 protected:
@@ -72,6 +73,7 @@
 
     void updateViewportForCurrentScrollPosition(Optional<FloatRect>) override;
     bool scrollPositionAndLayoutViewportMatch(const FloatPoint& position, Optional<FloatRect> overrideLayoutViewport) override;
+    FloatRect layoutViewportForScrollPosition(const FloatPoint&, float scale, ScrollBehaviorForFixedElements = StickToDocumentBounds) const;
 
     void dumpProperties(WTF::TextStream&, ScrollingStateTreeAsTextBehavior) const override;
 

Modified: branches/safari-609.1.20.0-branch/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp (257013 => 257014)


--- branches/safari-609.1.20.0-branch/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp	2020-02-20 01:50:59 UTC (rev 257013)
+++ branches/safari-609.1.20.0-branch/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp	2020-02-20 01:51:51 UTC (rev 257014)
@@ -107,8 +107,10 @@
 void ScrollingTreeScrollingNode::commitStateAfterChildren(const ScrollingStateNode& stateNode)
 {
     const ScrollingStateScrollingNode& scrollingStateNode = downcast<ScrollingStateScrollingNode>(stateNode);
-    if (scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::RequestedScrollPosition))
-        scrollingTree().scrollingTreeNodeRequestsScroll(scrollingNodeID(), scrollingStateNode.requestedScrollPosition(), scrollingStateNode.requestedScrollPositionRepresentsProgrammaticScroll());
+    if (scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::RequestedScrollPosition)) {
+        const auto& requestedScrollData = scrollingStateNode.requestedScrollData();
+        scrollingTree().scrollingTreeNodeRequestsScroll(scrollingNodeID(), requestedScrollData.scrollPosition, requestedScrollData.scrollType, requestedScrollData.clamping);
+    }
 
     m_isFirstCommit = false;
 }
@@ -144,20 +146,20 @@
     return newScrollPosition == oldScrollPosition;
 }
 
-FloatPoint ScrollingTreeScrollingNode::adjustedScrollPosition(const FloatPoint& scrollPosition, ScrollPositionClamp clamp) const
+FloatPoint ScrollingTreeScrollingNode::adjustedScrollPosition(const FloatPoint& scrollPosition, ScrollClamping clamping) const
 {
-    if (clamp == ScrollPositionClamp::ToContentEdges)
+    if (clamping == ScrollClamping::Clamped)
         return clampScrollPosition(scrollPosition);
 
     return scrollPosition;
 }
 
-void ScrollingTreeScrollingNode::scrollBy(const FloatSize& delta, ScrollPositionClamp clamp)
+void ScrollingTreeScrollingNode::scrollBy(const FloatSize& delta, ScrollClamping clamp)
 {
     scrollTo(currentScrollPosition() + delta, ScrollType::User, clamp);
 }
 
-void ScrollingTreeScrollingNode::scrollTo(const FloatPoint& position, ScrollType scrollType, ScrollPositionClamp clamp)
+void ScrollingTreeScrollingNode::scrollTo(const FloatPoint& position, ScrollType scrollType, ScrollClamping clamp)
 {
     if (position == m_currentScrollPosition)
         return;
@@ -200,7 +202,7 @@
     if (!scrollPositionChanged && scrollingLayerPositionAction != ScrollingLayerPositionAction::Set)
         return;
 
-    m_currentScrollPosition = adjustedScrollPosition(position, ScrollPositionClamp::None);
+    m_currentScrollPosition = adjustedScrollPosition(position, ScrollClamping::Unclamped);
     updateViewportForCurrentScrollPosition(overrideLayoutViewport);
 
     repositionRelatedLayers();

Modified: branches/safari-609.1.20.0-branch/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h (257013 => 257014)


--- branches/safari-609.1.20.0-branch/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h	2020-02-20 01:50:59 UTC (rev 257013)
+++ branches/safari-609.1.20.0-branch/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h	2020-02-20 01:51:51 UTC (rev 257014)
@@ -60,8 +60,8 @@
     FloatSize scrollDeltaSinceLastCommit() const { return m_currentScrollPosition - m_lastCommittedScrollPosition; }
 
     // These are imperative; they adjust the scrolling layers.
-    void scrollTo(const FloatPoint&, ScrollType = ScrollType::User, ScrollPositionClamp = ScrollPositionClamp::ToContentEdges);
-    void scrollBy(const FloatSize&, ScrollPositionClamp = ScrollPositionClamp::ToContentEdges);
+    void scrollTo(const FloatPoint&, ScrollType = ScrollType::User, ScrollClamping = ScrollClamping::Clamped);
+    void scrollBy(const FloatSize&, ScrollClamping = ScrollClamping::Clamped);
 
     void wasScrolledByDelegatedScrolling(const FloatPoint& position, Optional<FloatRect> overrideLayoutViewport = { }, ScrollingLayerPositionAction = ScrollingLayerPositionAction::Sync);
     
@@ -99,7 +99,7 @@
 
     FloatPoint clampScrollPosition(const FloatPoint&) const;
     
-    virtual FloatPoint adjustedScrollPosition(const FloatPoint&, ScrollPositionClamp = ScrollPositionClamp::ToContentEdges) const;
+    virtual FloatPoint adjustedScrollPosition(const FloatPoint&, ScrollClamping = ScrollClamping::Clamped) const;
 
     virtual void currentScrollPositionChanged();
     virtual void updateViewportForCurrentScrollPosition(Optional<FloatRect> = { }) { }

Modified: branches/safari-609.1.20.0-branch/Source/WebCore/page/scrolling/cocoa/ScrollingTreeFixedNode.mm (257013 => 257014)


--- branches/safari-609.1.20.0-branch/Source/WebCore/page/scrolling/cocoa/ScrollingTreeFixedNode.mm	2020-02-20 01:50:59 UTC (rev 257013)
+++ branches/safari-609.1.20.0-branch/Source/WebCore/page/scrolling/cocoa/ScrollingTreeFixedNode.mm	2020-02-20 01:51:51 UTC (rev 257014)
@@ -77,7 +77,7 @@
             if (is<ScrollingTreeFrameScrollingNode>(*ancestor)) {
                 // Fixed nodes are positioned relative to the containing frame scrolling node.
                 // We bail out after finding one.
-                auto layoutViewport = downcast<ScrollingTreeFrameScrollingNode>(*ancestor).layoutViewport();
+                auto layoutViewport = downcast<ScrollingTreeFrameScrollingNode>(*ancestor).layoutViewportRespectingRubberBanding();
                 return m_constraints.layerPositionForViewportRect(layoutViewport) - overflowScrollDelta;
             }
 

Modified: branches/safari-609.1.20.0-branch/Source/WebCore/page/scrolling/cocoa/ScrollingTreeStickyNode.mm (257013 => 257014)


--- branches/safari-609.1.20.0-branch/Source/WebCore/page/scrolling/cocoa/ScrollingTreeStickyNode.mm	2020-02-20 01:50:59 UTC (rev 257013)
+++ branches/safari-609.1.20.0-branch/Source/WebCore/page/scrolling/cocoa/ScrollingTreeStickyNode.mm	2020-02-20 01:51:51 UTC (rev 257014)
@@ -73,7 +73,7 @@
         FloatRect constrainingRect;
         if (is<ScrollingTreeFrameScrollingNode>(scrollingNode)) {
             auto& frameScrollingNode = downcast<ScrollingTreeFrameScrollingNode>(scrollingNode);
-            constrainingRect = frameScrollingNode.layoutViewport();
+            constrainingRect = frameScrollingNode.layoutViewportRespectingRubberBanding();
         } else {
             auto& overflowScrollingNode = downcast<ScrollingTreeOverflowScrollingNode>(scrollingNode);
             constrainingRect = FloatRect(overflowScrollingNode.currentScrollPosition(), m_constraints.constrainingRectAtLastLayout().size());

Modified: branches/safari-609.1.20.0-branch/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h (257013 => 257014)


--- branches/safari-609.1.20.0-branch/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h	2020-02-20 01:50:59 UTC (rev 257013)
+++ branches/safari-609.1.20.0-branch/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h	2020-02-20 01:51:51 UTC (rev 257014)
@@ -61,7 +61,7 @@
     unsigned exposedUnfilledArea() const;
 
 private:
-    FloatPoint adjustedScrollPosition(const FloatPoint&, ScrollPositionClamp) const override;
+    FloatPoint adjustedScrollPosition(const FloatPoint&, ScrollClamping) const override;
 
     void currentScrollPositionChanged() override;
     void repositionScrollingLayers() override;

Modified: branches/safari-609.1.20.0-branch/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm (257013 => 257014)


--- branches/safari-609.1.20.0-branch/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm	2020-02-20 01:50:59 UTC (rev 257013)
+++ branches/safari-609.1.20.0-branch/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm	2020-02-20 01:51:51 UTC (rev 257014)
@@ -137,8 +137,8 @@
 
     // Update the scroll position after child nodes have been updated, because they need to have updated their constraints before any scrolling happens.
     if (scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::RequestedScrollPosition)) {
-        auto scrollType = scrollingStateNode.requestedScrollPositionRepresentsProgrammaticScroll() ? ScrollType::Programmatic : ScrollType::User;
-        scrollTo(scrollingStateNode.requestedScrollPosition(), scrollType);
+        const auto& requestedScrollData = scrollingStateNode.requestedScrollData();
+        scrollTo(requestedScrollData.scrollPosition, requestedScrollData.scrollType, requestedScrollData.clamping);
     }
 
     if (isRootNode()
@@ -169,7 +169,7 @@
     return ScrollingEventResult::DidHandleEvent;
 }
 
-FloatPoint ScrollingTreeFrameScrollingNodeMac::adjustedScrollPosition(const FloatPoint& position, ScrollPositionClamp clamp) const
+FloatPoint ScrollingTreeFrameScrollingNodeMac::adjustedScrollPosition(const FloatPoint& position, ScrollClamping clamp) const
 {
     FloatPoint scrollPosition(roundf(position.x()), roundf(position.y()));
     return ScrollingTreeFrameScrollingNode::adjustedScrollPosition(scrollPosition, clamp);

Modified: branches/safari-609.1.20.0-branch/Source/WebCore/page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h (257013 => 257014)


--- branches/safari-609.1.20.0-branch/Source/WebCore/page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h	2020-02-20 01:50:59 UTC (rev 257013)
+++ branches/safari-609.1.20.0-branch/Source/WebCore/page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h	2020-02-20 01:51:51 UTC (rev 257014)
@@ -45,7 +45,7 @@
     void commitStateBeforeChildren(const ScrollingStateNode&) override;
     void commitStateAfterChildren(const ScrollingStateNode&) override;
     
-    FloatPoint adjustedScrollPosition(const FloatPoint&, ScrollPositionClamp) const override;
+    FloatPoint adjustedScrollPosition(const FloatPoint&, ScrollClamping) const override;
 
     void repositionScrollingLayers() override;
     void repositionRelatedLayers() override;

Modified: branches/safari-609.1.20.0-branch/Source/WebCore/page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm (257013 => 257014)


--- branches/safari-609.1.20.0-branch/Source/WebCore/page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm	2020-02-20 01:50:59 UTC (rev 257013)
+++ branches/safari-609.1.20.0-branch/Source/WebCore/page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm	2020-02-20 01:51:51 UTC (rev 257014)
@@ -62,8 +62,8 @@
     const auto& overflowStateNode = downcast<ScrollingStateOverflowScrollingNode>(stateNode);
 
     if (overflowStateNode.hasChangedProperty(ScrollingStateScrollingNode::RequestedScrollPosition)) {
-        auto scrollType = overflowStateNode.requestedScrollPositionRepresentsProgrammaticScroll() ? ScrollType::Programmatic : ScrollType::User;
-        scrollTo(overflowStateNode.requestedScrollPosition(), scrollType);
+        const auto& requestedScrollData = overflowStateNode.requestedScrollData();
+        scrollTo(requestedScrollData.scrollPosition, requestedScrollData.scrollType, requestedScrollData.clamping);
     }
 }
 
@@ -83,7 +83,7 @@
     return ScrollingEventResult::DidHandleEvent;
 }
 
-FloatPoint ScrollingTreeOverflowScrollingNodeMac::adjustedScrollPosition(const FloatPoint& position, ScrollPositionClamp clamp) const
+FloatPoint ScrollingTreeOverflowScrollingNodeMac::adjustedScrollPosition(const FloatPoint& position, ScrollClamping clamp) const
 {
     FloatPoint scrollPosition(roundf(position.x()), roundf(position.y()));
     return ScrollingTreeOverflowScrollingNode::adjustedScrollPosition(scrollPosition, clamp);

Modified: branches/safari-609.1.20.0-branch/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm (257013 => 257014)


--- branches/safari-609.1.20.0-branch/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm	2020-02-20 01:50:59 UTC (rev 257013)
+++ branches/safari-609.1.20.0-branch/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm	2020-02-20 01:51:51 UTC (rev 257014)
@@ -235,7 +235,7 @@
 
 void ScrollingTreeScrollingNodeDelegateMac::immediateScrollByWithoutContentEdgeConstraints(const FloatSize& offset)
 {
-    scrollingNode().scrollBy(offset, ScrollPositionClamp::None);
+    scrollingNode().scrollBy(offset, ScrollClamping::Unclamped);
 }
 
 void ScrollingTreeScrollingNodeDelegateMac::stopSnapRubberbandTimer()

Modified: branches/safari-609.1.20.0-branch/Source/WebCore/page/scrolling/nicosia/ScrollingTreeFrameScrollingNodeNicosia.cpp (257013 => 257014)


--- branches/safari-609.1.20.0-branch/Source/WebCore/page/scrolling/nicosia/ScrollingTreeFrameScrollingNodeNicosia.cpp	2020-02-20 01:50:59 UTC (rev 257013)
+++ branches/safari-609.1.20.0-branch/Source/WebCore/page/scrolling/nicosia/ScrollingTreeFrameScrollingNodeNicosia.cpp	2020-02-20 01:51:51 UTC (rev 257014)
@@ -91,8 +91,8 @@
 
     // Update the scroll position after child nodes have been updated, because they need to have updated their constraints before any scrolling happens.
     if (scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::RequestedScrollPosition)) {
-        auto scrollType = scrollingStateNode.requestedScrollPositionRepresentsProgrammaticScroll() ? ScrollType::Programmatic : ScrollType::User;
-        scrollTo(scrollingStateNode.requestedScrollPosition(), scrollType);
+        const auto& requestedScrollData = scrollingStateNode.requestedScrollData();
+        scrollTo(requestedScrollData.scrollPosition, requestedScrollData.scrollType, requestedScrollData.clamping);
     }
 }
 
@@ -116,10 +116,10 @@
     return ScrollingEventResult::DidHandleEvent;
 }
 
-FloatPoint ScrollingTreeFrameScrollingNodeNicosia::adjustedScrollPosition(const FloatPoint& position, ScrollPositionClamp clamp) const
+FloatPoint ScrollingTreeFrameScrollingNodeNicosia::adjustedScrollPosition(const FloatPoint& position, ScrollClamping clamping) const
 {
     FloatPoint scrollPosition(roundf(position.x()), roundf(position.y()));
-    return ScrollingTreeFrameScrollingNode::adjustedScrollPosition(scrollPosition, clamp);
+    return ScrollingTreeFrameScrollingNode::adjustedScrollPosition(scrollPosition, clamping);
 }
 
 void ScrollingTreeFrameScrollingNodeNicosia::currentScrollPositionChanged()

Modified: branches/safari-609.1.20.0-branch/Source/WebCore/page/scrolling/nicosia/ScrollingTreeFrameScrollingNodeNicosia.h (257013 => 257014)


--- branches/safari-609.1.20.0-branch/Source/WebCore/page/scrolling/nicosia/ScrollingTreeFrameScrollingNodeNicosia.h	2020-02-20 01:50:59 UTC (rev 257013)
+++ branches/safari-609.1.20.0-branch/Source/WebCore/page/scrolling/nicosia/ScrollingTreeFrameScrollingNodeNicosia.h	2020-02-20 01:51:51 UTC (rev 257014)
@@ -53,7 +53,7 @@
 
     ScrollingEventResult handleWheelEvent(const PlatformWheelEvent&) override;
 
-    FloatPoint adjustedScrollPosition(const FloatPoint&, ScrollPositionClamp) const override;
+    FloatPoint adjustedScrollPosition(const FloatPoint&, ScrollClamping) const override;
 
     void currentScrollPositionChanged() override;
 

Modified: branches/safari-609.1.20.0-branch/Source/WebCore/page/scrolling/nicosia/ScrollingTreeOverflowScrollingNodeNicosia.cpp (257013 => 257014)


--- branches/safari-609.1.20.0-branch/Source/WebCore/page/scrolling/nicosia/ScrollingTreeOverflowScrollingNodeNicosia.cpp	2020-02-20 01:50:59 UTC (rev 257013)
+++ branches/safari-609.1.20.0-branch/Source/WebCore/page/scrolling/nicosia/ScrollingTreeOverflowScrollingNodeNicosia.cpp	2020-02-20 01:51:51 UTC (rev 257014)
@@ -55,15 +55,15 @@
 
     const auto& overflowStateNode = downcast<ScrollingStateOverflowScrollingNode>(stateNode);
     if (overflowStateNode.hasChangedProperty(ScrollingStateScrollingNode::RequestedScrollPosition)) {
-        auto scrollType = overflowStateNode.requestedScrollPositionRepresentsProgrammaticScroll() ? ScrollType::Programmatic : ScrollType::User;
-        scrollTo(overflowStateNode.requestedScrollPosition(), scrollType);
+        const auto& requestedScrollData = overflowStateNode.requestedScrollData();
+        scrollTo(requestedScrollData.scrollPosition, requestedScrollData.scrollType, requestedScrollData.clamping);
     }
 }
 
-FloatPoint ScrollingTreeOverflowScrollingNodeNicosia::adjustedScrollPosition(const FloatPoint& position, ScrollPositionClamp clamp) const
+FloatPoint ScrollingTreeOverflowScrollingNodeNicosia::adjustedScrollPosition(const FloatPoint& position, ScrollClamping clamping) const
 {
     FloatPoint scrollPosition(roundf(position.x()), roundf(position.y()));
-    return ScrollingTreeOverflowScrollingNode::adjustedScrollPosition(scrollPosition, clamp);
+    return ScrollingTreeOverflowScrollingNode::adjustedScrollPosition(scrollPosition, clamping);
 }
 
 void ScrollingTreeOverflowScrollingNodeNicosia::repositionScrollingLayers()

Modified: branches/safari-609.1.20.0-branch/Source/WebCore/page/scrolling/nicosia/ScrollingTreeOverflowScrollingNodeNicosia.h (257013 => 257014)


--- branches/safari-609.1.20.0-branch/Source/WebCore/page/scrolling/nicosia/ScrollingTreeOverflowScrollingNodeNicosia.h	2020-02-20 01:50:59 UTC (rev 257013)
+++ branches/safari-609.1.20.0-branch/Source/WebCore/page/scrolling/nicosia/ScrollingTreeOverflowScrollingNodeNicosia.h	2020-02-20 01:51:51 UTC (rev 257014)
@@ -44,7 +44,7 @@
 
     void commitStateAfterChildren(const ScrollingStateNode&) override;
 
-    FloatPoint adjustedScrollPosition(const FloatPoint&, ScrollPositionClamp) const override;
+    FloatPoint adjustedScrollPosition(const FloatPoint&, ScrollClamping) const override;
 
     void repositionScrollingLayers() override;
 

Added: branches/safari-609.1.20.0-branch/Source/WebCore/platform/ScrollTypes.cpp (0 => 257014)


--- branches/safari-609.1.20.0-branch/Source/WebCore/platform/ScrollTypes.cpp	                        (rev 0)
+++ branches/safari-609.1.20.0-branch/Source/WebCore/platform/ScrollTypes.cpp	2020-02-20 01:51:51 UTC (rev 257014)
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2006 Apple Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+
+#include "config.h"
+#include "ScrollTypes.h"
+
+#include <wtf/text/TextStream.h>
+
+namespace WebCore {
+
+TextStream& operator<<(TextStream& ts, ScrollType scrollType)
+{
+    switch (scrollType) {
+    case ScrollType::User: ts << "user"; break;
+    case ScrollType::Programmatic: ts << "programmatic"; break;
+    }
+    return ts;
+}
+
+TextStream& operator<<(TextStream& ts, ScrollClamping clamping)
+{
+    switch (clamping) {
+    case ScrollClamping::Unclamped: ts << "unclamped"; break;
+    case ScrollClamping::Clamped: ts << "clamped"; break;
+    }
+    return ts;
+}
+
+} // namespace WebCore

Modified: branches/safari-609.1.20.0-branch/Source/WebCore/platform/ScrollTypes.h (257013 => 257014)


--- branches/safari-609.1.20.0-branch/Source/WebCore/platform/ScrollTypes.h	2020-02-20 01:50:59 UTC (rev 257013)
+++ branches/safari-609.1.20.0-branch/Source/WebCore/platform/ScrollTypes.h	2020-02-20 01:51:51 UTC (rev 257014)
@@ -28,6 +28,10 @@
 #include <cstdint>
 #include <wtf/Assertions.h>
 
+namespace WTF {
+class TextStream;
+}
+
 namespace WebCore {
 
 enum class ScrollType : uint8_t {
@@ -49,11 +53,6 @@
     ScrollInlineDirectionForward
 };
 
-enum class ScrollPositionClamp : uint8_t {
-    None,
-    ToContentEdges,
-};
-
 inline ScrollDirection logicalToPhysical(ScrollLogicalDirection direction, bool isVertical, bool isFlipped)
 {
     switch (direction) {
@@ -229,4 +228,7 @@
 using ScrollbarControlPartMask = unsigned;
 using ScrollingNodeID = uint64_t;
 
+WEBCORE_EXPORT WTF::TextStream& operator<<(WTF::TextStream&, ScrollType);
+WEBCORE_EXPORT WTF::TextStream& operator<<(WTF::TextStream&, ScrollClamping);
+
 } // namespace WebCore

Modified: branches/safari-609.1.20.0-branch/Source/WebCore/platform/ScrollView.cpp (257013 => 257014)


--- branches/safari-609.1.20.0-branch/Source/WebCore/platform/ScrollView.cpp	2020-02-20 01:50:59 UTC (rev 257013)
+++ branches/safari-609.1.20.0-branch/Source/WebCore/platform/ScrollView.cpp	2020-02-20 01:51:51 UTC (rev 257014)
@@ -211,13 +211,13 @@
     return scrollPosition();
 }
 
-void ScrollView::setContentsScrollPosition(const IntPoint& position)
+void ScrollView::setContentsScrollPosition(const IntPoint& position, ScrollClamping clamping)
 {
 #if PLATFORM(IOS_FAMILY)
     if (platformWidget())
         setActualScrollPosition(position);
 #endif
-    setScrollPosition(position);
+    setScrollPosition(position, clamping);
 }
 
 FloatRect ScrollView::exposedContentRect() const
@@ -518,7 +518,7 @@
     updateCompositingLayersAfterScrolling();
 }
 
-void ScrollView::setScrollPosition(const ScrollPosition& scrollPosition)
+void ScrollView::setScrollPosition(const ScrollPosition& scrollPosition, ScrollClamping clamping)
 {
     LOG_WITH_STREAM(Scrolling, stream << "ScrollView::setScrollPosition " << scrollPosition);
 
@@ -530,12 +530,12 @@
         return;
     }
 
-    ScrollPosition newScrollPosition = !delegatesScrolling() ? adjustScrollPositionWithinRange(scrollPosition) : scrollPosition;
+    ScrollPosition newScrollPosition = (!delegatesScrolling() && clamping == ScrollClamping::Clamped) ? adjustScrollPositionWithinRange(scrollPosition) : scrollPosition;
 
     if ((!delegatesScrolling() || currentScrollType() == ScrollType::User) && newScrollPosition == this->scrollPosition())
         return;
 
-    if (requestScrollPositionUpdate(newScrollPosition))
+    if (requestScrollPositionUpdate(newScrollPosition, currentScrollType(), clamping))
         return;
 
     updateScrollbars(newScrollPosition);

Modified: branches/safari-609.1.20.0-branch/Source/WebCore/platform/ScrollView.h (257013 => 257014)


--- branches/safari-609.1.20.0-branch/Source/WebCore/platform/ScrollView.h	2020-02-20 01:50:59 UTC (rev 257013)
+++ branches/safari-609.1.20.0-branch/Source/WebCore/platform/ScrollView.h	2020-02-20 01:51:51 UTC (rev 257014)
@@ -234,7 +234,7 @@
 
     // Scroll position used by web-exposed features (has legacy iOS behavior).
     WEBCORE_EXPORT IntPoint contentsScrollPosition() const;
-    void setContentsScrollPosition(const IntPoint&);
+    void setContentsScrollPosition(const IntPoint&, ScrollClamping = ScrollClamping::Clamped);
 
 #if PLATFORM(IOS_FAMILY)
     int actualScrollX() const { return unobscuredContentRect().x(); }
@@ -264,7 +264,7 @@
     ScrollPosition cachedScrollPosition() const { return m_cachedScrollPosition; }
 
     // Functions for scrolling the view.
-    virtual void setScrollPosition(const ScrollPosition&);
+    virtual void setScrollPosition(const ScrollPosition&, ScrollClamping = ScrollClamping::Clamped);
     void scrollBy(const IntSize& s) { return setScrollPosition(scrollPosition() + s); }
 
     // This function scrolls by lines, pages or pixels.

Modified: branches/safari-609.1.20.0-branch/Source/WebCore/platform/ScrollableArea.cpp (257013 => 257014)


--- branches/safari-609.1.20.0-branch/Source/WebCore/platform/ScrollableArea.cpp	2020-02-20 01:50:59 UTC (rev 257013)
+++ branches/safari-609.1.20.0-branch/Source/WebCore/platform/ScrollableArea.cpp	2020-02-20 01:51:51 UTC (rev 257014)
@@ -227,7 +227,7 @@
 void ScrollableArea::setScrollOffsetFromAnimation(const ScrollOffset& offset)
 {
     ScrollPosition position = scrollPositionFromOffset(offset);
-    if (requestScrollPositionUpdate(position))
+    if (requestScrollPositionUpdate(position, currentScrollType()))
         return;
 
     scrollPositionChanged(position);

Modified: branches/safari-609.1.20.0-branch/Source/WebCore/platform/ScrollableArea.h (257013 => 257014)


--- branches/safari-609.1.20.0-branch/Source/WebCore/platform/ScrollableArea.h	2020-02-20 01:50:59 UTC (rev 257013)
+++ branches/safari-609.1.20.0-branch/Source/WebCore/platform/ScrollableArea.h	2020-02-20 01:51:51 UTC (rev 257014)
@@ -73,7 +73,7 @@
     // Allows subclasses to handle scroll position updates themselves. If this member function
     // returns true, the scrollable area won't actually update the scroll position and instead
     // expect it to happen sometime in the future.
-    virtual bool requestScrollPositionUpdate(const ScrollPosition&) { return false; }
+    virtual bool requestScrollPositionUpdate(const ScrollPosition&, ScrollType = ScrollType::User, ScrollClamping = ScrollClamping::Clamped) { return false; }
 
     WEBCORE_EXPORT bool handleWheelEvent(const PlatformWheelEvent&);
 

Modified: branches/safari-609.1.20.0-branch/Source/WebCore/rendering/RenderLayer.cpp (257013 => 257014)


--- branches/safari-609.1.20.0-branch/Source/WebCore/rendering/RenderLayer.cpp	2020-02-20 01:50:59 UTC (rev 257013)
+++ branches/safari-609.1.20.0-branch/Source/WebCore/rendering/RenderLayer.cpp	2020-02-20 01:51:51 UTC (rev 257014)
@@ -2608,7 +2608,7 @@
     bool handled = false;
 #if ENABLE(ASYNC_SCROLLING)
     if (ScrollingCoordinator* scrollingCoordinator = page().scrollingCoordinator())
-        handled = scrollingCoordinator->requestScrollPositionUpdate(*this, scrollPositionFromOffset(clampedScrollOffset));
+        handled = scrollingCoordinator->requestScrollPositionUpdate(*this, scrollPositionFromOffset(clampedScrollOffset), scrollType, clamping);
 #endif
 
     if (!handled)

Modified: branches/safari-609.1.20.0-branch/Source/WebCore/testing/Internals.cpp (257013 => 257014)


--- branches/safari-609.1.20.0-branch/Source/WebCore/testing/Internals.cpp	2020-02-20 01:50:59 UTC (rev 257013)
+++ branches/safari-609.1.20.0-branch/Source/WebCore/testing/Internals.cpp	2020-02-20 01:51:51 UTC (rev 257014)
@@ -1765,6 +1765,10 @@
         return Exception { InvalidAccessError };
 
     element.scrollTo({ x, y }, ScrollClamping::Unclamped);
+
+    auto& frameView = *document->view();
+    frameView.setViewportConstrainedObjectsNeedLayout();
+
     return { };
 }
 

Modified: branches/safari-609.1.20.0-branch/Source/WebKit/ChangeLog (257013 => 257014)


--- branches/safari-609.1.20.0-branch/Source/WebKit/ChangeLog	2020-02-20 01:50:59 UTC (rev 257013)
+++ branches/safari-609.1.20.0-branch/Source/WebKit/ChangeLog	2020-02-20 01:51:51 UTC (rev 257014)
@@ -1,40 +1,181 @@
-2020-02-19  Russell Epstein  <repst...@apple.com>
+2020-02-19  Alan Coon  <alanc...@apple.com>
 
-        Cherry-pick r256432. rdar://problem/59446974
+        Cherry-pick r255037. rdar://problem/59446986
 
-    WebSWServerConnection::registerServiceWorkerClient is not sending IPC message to UIProcess when it should
-    https://bugs.webkit.org/show_bug.cgi?id=207537
+    Fixed elements no longer stay fixed with elastic overscroll
+    https://bugs.webkit.org/show_bug.cgi?id=206227
+    rdar://problem/58707084
     
-    Reviewed by Chris Dumez.
+    Reviewed by Antti Koivisto.
+    Source/WebCore:
     
+    Intended behavior on iOS and macOS is for position:fixed and sticky elements to maintain
+    their position relative to the view bounds when rubber-banding ("overscrolling"). This broke
+    some time back. This change restores the correct behavior with the call to layoutViewportRespectingRubberBanding()
+    in ScrollingTreeFixedNode::applyLayerPositions() and ScrollingTreeStickyNode::computeLayerPosition().
+    layoutViewportRespectingRubberBanding() computes a layout viewport without clamping.
+    
+    The rest of the changes are to support testing. internals.unconstrainedScrollTo()
+    didn't work for main frame scrolling because of scroll position clamping in various places,
+    so propagate ScrollClamping in more places (and replace the redundant ScrollPositionClamp with ScrollClamping).
+    
+    "requested scroll position" updates now carry along both clamping and "is programmatic" data, wrapped in a struct
+    which is passed around the scrolling tree. This allows us to not clamp the scroll position (for testing) in more places.
+    
+    Internals::unconstrainedScrollTo() needs one weird hack to trigger a layout (and thus a scrolling tree commit),
+    because the layout is normally triggered by a layout viewport change, but when rubber-banding we clamp the layoutViewport
+    used for layout, so those layouts are never triggered.
+    
+    Tests: tiled-drawing/scrolling/fixed/fixed-during-rubberband.html
+           tiled-drawing/scrolling/sticky/sticky-during-rubberband.html
+    
+    * Sources.txt:
+    * WebCore.xcodeproj/project.pbxproj:
+    * dom/Element.cpp:
+    (WebCore::Element::scrollTo):
+    * page/DOMWindow.cpp:
+    (WebCore::DOMWindow::scrollTo const):
+    * page/FrameView.cpp:
+    (WebCore::FrameView::setScrollPosition):
+    (WebCore::FrameView::requestScrollPositionUpdate):
+    * page/FrameView.h:
+    * page/scrolling/AsyncScrollingCoordinator.cpp:
+    (WebCore::AsyncScrollingCoordinator::requestScrollPositionUpdate):
+    * page/scrolling/AsyncScrollingCoordinator.h:
+    * page/scrolling/ScrollingCoordinator.cpp:
+    * page/scrolling/ScrollingCoordinator.h:
+    (WebCore::ScrollingCoordinator::requestScrollPositionUpdate):
+    * page/scrolling/ScrollingStateScrollingNode.cpp:
+    (WebCore::ScrollingStateScrollingNode::ScrollingStateScrollingNode):
+    (WebCore::ScrollingStateScrollingNode::setRequestedScrollData):
+    (WebCore::ScrollingStateScrollingNode::dumpProperties const):
+    (WebCore::ScrollingStateScrollingNode::setRequestedScrollPosition): Deleted.
+    * page/scrolling/ScrollingStateScrollingNode.h:
+    (WebCore::RequestedScrollData::operator== const):
+    (WebCore::ScrollingStateScrollingNode::requestedScrollData const):
+    (WebCore::ScrollingStateScrollingNode::requestedScrollPosition const): Deleted.
+    (WebCore::ScrollingStateScrollingNode::requestedScrollPositionRepresentsProgrammaticScroll const): Deleted.
+    * page/scrolling/ScrollingTree.h:
+    (WebCore::ScrollingTree::scrollingTreeNodeRequestsScroll):
+    * page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
+    (WebCore::ScrollingTreeFrameScrollingNode::layoutViewportForScrollPosition const):
+    (WebCore::ScrollingTreeFrameScrollingNode::layoutViewportRespectingRubberBanding const):
+    * page/scrolling/ScrollingTreeFrameScrollingNode.h:
+    * page/scrolling/ScrollingTreeScrollingNode.cpp:
+    (WebCore::ScrollingTreeScrollingNode::commitStateAfterChildren):
+    (WebCore::ScrollingTreeScrollingNode::adjustedScrollPosition const):
+    (WebCore::ScrollingTreeScrollingNode::scrollBy):
+    (WebCore::ScrollingTreeScrollingNode::scrollTo):
+    (WebCore::ScrollingTreeScrollingNode::wasScrolledByDelegatedScrolling):
+    * page/scrolling/ScrollingTreeScrollingNode.h:
+    * page/scrolling/cocoa/ScrollingTreeFixedNode.mm:
+    (WebCore::ScrollingTreeFixedNode::applyLayerPositions):
+    * page/scrolling/cocoa/ScrollingTreeStickyNode.mm:
+    (WebCore::ScrollingTreeStickyNode::computeLayerPosition const):
+    * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
+    * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
+    (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateAfterChildren):
+    (WebCore::ScrollingTreeFrameScrollingNodeMac::adjustedScrollPosition const):
+    * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h:
+    * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
+    (WebCore::ScrollingTreeOverflowScrollingNodeMac::commitStateAfterChildren):
+    (WebCore::ScrollingTreeOverflowScrollingNodeMac::adjustedScrollPosition const):
+    * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm:
+    (WebCore::ScrollingTreeScrollingNodeDelegateMac::immediateScrollByWithoutContentEdgeConstraints):
+    * platform/ScrollTypes.cpp: Added.
+    (WebCore::operator<<):
+    * platform/ScrollTypes.h:
+    * platform/ScrollView.cpp:
+    (WebCore::ScrollView::setContentsScrollPosition):
+    (WebCore::ScrollView::setScrollPosition):
+    * platform/ScrollView.h:
+    * platform/ScrollableArea.cpp:
+    (WebCore::ScrollableArea::setScrollOffsetFromAnimation):
+    * platform/ScrollableArea.h:
+    (WebCore::ScrollableArea::requestScrollPositionUpdate):
+    * rendering/RenderLayer.cpp:
+    (WebCore::RenderLayer::scrollToOffset):
+    * testing/Internals.cpp:
+    (WebCore::Internals::unconstrainedScrollTo):
+    
     Source/WebKit:
     
-    Covered by added API test.
+    Intended behavior on iOS and macOS is for position:fixed and sticky elements to maintain
+    their position relative to the view bounds when rubber-banding ("overscrolling"). This broke
+    some time back. This change restores the correct behavior with the call to layoutViewportRespectingRubberBanding()
+    in ScrollingTreeFixedNode::applyLayerPositions() and ScrollingTreeStickyNode::computeLayerPosition().
+    layoutViewportRespectingRubberBanding() computes a layout viewport without clamping.
     
-    * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
-    (WebKit::WebSWServerConnection::registerServiceWorkerClient):
-    Fix use after move so that we can get the context connection and send the IPC message to UIProcess as expected.
+    The rest of the changes are to support testing. internals.unconstrainedScrollTo()
+    didn't work for main frame scrolling because of scroll position clamping in various places,
+    so propagate ScrollClamping in more places (and replace the redundant ScrollPositionClamp with ScrollClamping).
     
-    Tools:
+    "requested scroll position" updates now carry along both clamping and "is programmatic" data, wrapped in a struct
+    which is passed around the scrolling tree. This allows us to not clamp the scroll position (for testing) in more places.
     
-    * TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerBasic.mm:
+    * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
+    (ArgumentCoder<ScrollingStateScrollingNode>::encode):
+    (ArgumentCoder<ScrollingStateScrollingNode>::decode):
+    (ArgumentCoder<RequestedScrollData>::encode):
+    (ArgumentCoder<RequestedScrollData>::decode):
+    (WebKit::dump):
+    * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
+    (WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeNodeRequestsScroll):
+    * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
+    * UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp:
+    (WebKit::RemoteScrollingTree::scrollingTreeNodeRequestsScroll):
+    * UIProcess/RemoteLayerTree/RemoteScrollingTree.h:
+    * UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm:
+    (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::commitStateAfterChildren):
+    * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
+    (WebKit::ScrollingTreeScrollingNodeDelegateIOS::commitStateAfterChildren):
     
+    LayoutTests:
     
-    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256432 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+    * tiled-drawing/scrolling/fixed/fixed-during-rubberband-expected.html: Added.
+    * tiled-drawing/scrolling/fixed/fixed-during-rubberband.html: Added.
+    * tiled-drawing/scrolling/sticky/sticky-during-rubberband-expected.html: Added.
+    * tiled-drawing/scrolling/sticky/sticky-during-rubberband.html: Added.
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255037 268f45cc-cd09-0410-ab3c-d52691b4dbfc
 
-    2020-02-12  Youenn Fablet  <you...@apple.com>
+    2020-02-19  Russell Epstein  <repst...@apple.com>
 
-            WebSWServerConnection::registerServiceWorkerClient is not sending IPC message to UIProcess when it should
-            https://bugs.webkit.org/show_bug.cgi?id=207537
+            Cherry-pick r256432. rdar://problem/59446974
 
-            Reviewed by Chris Dumez.
+        WebSWServerConnection::registerServiceWorkerClient is not sending IPC message to UIProcess when it should
+        https://bugs.webkit.org/show_bug.cgi?id=207537
 
-            Covered by added API test.
+        Reviewed by Chris Dumez.
 
-            * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
-            (WebKit::WebSWServerConnection::registerServiceWorkerClient):
-            Fix use after move so that we can get the context connection and send the IPC message to UIProcess as expected.
+        Source/WebKit:
 
+        Covered by added API test.
+
+        * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
+        (WebKit::WebSWServerConnection::registerServiceWorkerClient):
+        Fix use after move so that we can get the context connection and send the IPC message to UIProcess as expected.
+
+        Tools:
+
+        * TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerBasic.mm:
+
+
+        git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256432 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+        2020-02-12  Youenn Fablet  <you...@apple.com>
+
+                WebSWServerConnection::registerServiceWorkerClient is not sending IPC message to UIProcess when it should
+                https://bugs.webkit.org/show_bug.cgi?id=207537
+
+                Reviewed by Chris Dumez.
+
+                Covered by added API test.
+
+                * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
+                (WebKit::WebSWServerConnection::registerServiceWorkerClient):
+                Fix use after move so that we can get the context connection and send the IPC message to UIProcess as expected.
+
 2020-02-19  Russell Epstein  <repst...@apple.com>
 
         Cherry-pick r256426. rdar://problem/59447008
@@ -391,7 +532,45 @@
             <rdar://problem/59043436>
 
             Reviewed by Brent Fulgham.
+2020-01-22  Simon Fraser  <simon.fra...@apple.com>
 
+        Fixed elements no longer stay fixed with elastic overscroll
+        https://bugs.webkit.org/show_bug.cgi?id=206227
+        rdar://problem/58707084
+
+        Reviewed by Antti Koivisto.
+
+        Intended behavior on iOS and macOS is for position:fixed and sticky elements to maintain
+        their position relative to the view bounds when rubber-banding ("overscrolling"). This broke
+        some time back. This change restores the correct behavior with the call to layoutViewportRespectingRubberBanding()
+        in ScrollingTreeFixedNode::applyLayerPositions() and ScrollingTreeStickyNode::computeLayerPosition().
+        layoutViewportRespectingRubberBanding() computes a layout viewport without clamping.
+
+        The rest of the changes are to support testing. internals.unconstrainedScrollTo()
+        didn't work for main frame scrolling because of scroll position clamping in various places,
+        so propagate ScrollClamping in more places (and replace the redundant ScrollPositionClamp with ScrollClamping).
+
+        "requested scroll position" updates now carry along both clamping and "is programmatic" data, wrapped in a struct
+        which is passed around the scrolling tree. This allows us to not clamp the scroll position (for testing) in more places.
+
+        * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
+        (ArgumentCoder<ScrollingStateScrollingNode>::encode):
+        (ArgumentCoder<ScrollingStateScrollingNode>::decode):
+        (ArgumentCoder<RequestedScrollData>::encode):
+        (ArgumentCoder<RequestedScrollData>::decode):
+        (WebKit::dump):
+        * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
+        (WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeNodeRequestsScroll):
+        * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
+        * UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp:
+        (WebKit::RemoteScrollingTree::scrollingTreeNodeRequestsScroll):
+        * UIProcess/RemoteLayerTree/RemoteScrollingTree.h:
+        * UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm:
+        (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::commitStateAfterChildren):
+        * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
+        (WebKit::ScrollingTreeScrollingNodeDelegateIOS::commitStateAfterChildren):
+
+
             * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
             (WebKit::WebProcessPool::initializeClassesForParameterCoding):
             - Change `className` to keep a copy of the CString object.

Modified: branches/safari-609.1.20.0-branch/Source/WebKit/Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp (257013 => 257014)


--- branches/safari-609.1.20.0-branch/Source/WebKit/Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp	2020-02-20 01:50:59 UTC (rev 257013)
+++ branches/safari-609.1.20.0-branch/Source/WebKit/Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp	2020-02-20 01:51:51 UTC (rev 257014)
@@ -29,6 +29,7 @@
 #include "ArgumentCoders.h"
 #include "WebCoreArgumentCoders.h"
 #include <WebCore/GraphicsLayer.h>
+#include <WebCore/ScrollTypes.h>
 #include <WebCore/ScrollingStateFixedNode.h>
 #include <WebCore/ScrollingStateFrameHostingNode.h>
 #include <WebCore/ScrollingStateFrameScrollingNode.h>
@@ -91,6 +92,11 @@
     static bool decode(Decoder&, ScrollingStatePositionedNode&);
 };
 
+template<> struct ArgumentCoder<RequestedScrollData> {
+    static void encode(Encoder&, const RequestedScrollData&);
+    static bool decode(Decoder&, RequestedScrollData&);
+};
+
 } // namespace IPC
 
 using namespace IPC;
@@ -150,8 +156,7 @@
     SCROLLING_NODE_ENCODE(ScrollingStateScrollingNode::CurrentVerticalSnapOffsetIndex, currentVerticalSnapPointIndex)
 #endif
     SCROLLING_NODE_ENCODE(ScrollingStateScrollingNode::ScrollableAreaParams, scrollableAreaParameters)
-    SCROLLING_NODE_ENCODE(ScrollingStateScrollingNode::RequestedScrollPosition, requestedScrollPosition)
-    SCROLLING_NODE_ENCODE(ScrollingStateScrollingNode::RequestedScrollPosition, requestedScrollPositionRepresentsProgrammaticScroll)
+    SCROLLING_NODE_ENCODE(ScrollingStateScrollingNode::RequestedScrollPosition, requestedScrollData)
 
     if (node.hasChangedProperty(ScrollingStateScrollingNode::ScrollContainerLayer))
         encoder << static_cast<GraphicsLayer::PlatformLayerID>(node.scrollContainerLayer());
@@ -250,19 +255,8 @@
     SCROLLING_NODE_DECODE(ScrollingStateScrollingNode::CurrentVerticalSnapOffsetIndex, unsigned, setCurrentVerticalSnapPointIndex);
 #endif
     SCROLLING_NODE_DECODE(ScrollingStateScrollingNode::ScrollableAreaParams, ScrollableAreaParameters, setScrollableAreaParameters);
-    
-    if (node.hasChangedProperty(ScrollingStateScrollingNode::RequestedScrollPosition)) {
-        FloatPoint scrollPosition;
-        if (!decoder.decode(scrollPosition))
-            return false;
+    SCROLLING_NODE_DECODE(ScrollingStateScrollingNode::RequestedScrollPosition, RequestedScrollData, setRequestedScrollData);
 
-        bool representsProgrammaticScroll;
-        if (!decoder.decode(representsProgrammaticScroll))
-            return false;
-
-        node.setRequestedScrollPosition(scrollPosition, representsProgrammaticScroll);
-    }
-
     if (node.hasChangedProperty(ScrollingStateScrollingNode::ScrollContainerLayer)) {
         GraphicsLayer::PlatformLayerID layerID;
         if (!decoder.decode(layerID))
@@ -449,6 +443,28 @@
     return true;
 }
 
+
+void ArgumentCoder<RequestedScrollData>::encode(Encoder& encoder, const RequestedScrollData& scrollData)
+{
+    encoder << scrollData.scrollPosition;
+    encoder.encodeEnum(scrollData.scrollType);
+    encoder.encodeEnum(scrollData.clamping);
+}
+
+bool ArgumentCoder<RequestedScrollData>::decode(Decoder& decoder, RequestedScrollData& scrollData)
+{
+    if (!decoder.decode(scrollData.scrollPosition))
+        return false;
+
+    if (!decoder.decodeEnum(scrollData.scrollType))
+        return false;
+
+    if (!decoder.decodeEnum(scrollData.clamping))
+        return false;
+
+    return true;
+}
+
 namespace WebKit {
 
 static void encodeNodeAndDescendants(IPC::Encoder& encoder, const ScrollingStateNode& stateNode, int& encodedNodeCount)
@@ -606,8 +622,10 @@
         ts.dumpProperty("scroll-origin", node.scrollOrigin());
 
     if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStateScrollingNode::RequestedScrollPosition)) {
-        ts.dumpProperty("requested-scroll-position", node.requestedScrollPosition());
-        ts.dumpProperty("requested-scroll-position-is-programatic", node.requestedScrollPositionRepresentsProgrammaticScroll());
+        const auto& requestedScrollData = node.requestedScrollData();
+        ts.dumpProperty("requested-scroll-position", requestedScrollData.scrollPosition);
+        ts.dumpProperty("requested-scroll-position-is-programatic", requestedScrollData.scrollType);
+        ts.dumpProperty("requested-scroll-position-clamping", requestedScrollData.clamping);
     }
 
     if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStateScrollingNode::ScrollContainerLayer))

Modified: branches/safari-609.1.20.0-branch/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp (257013 => 257014)


--- branches/safari-609.1.20.0-branch/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp	2020-02-20 01:50:59 UTC (rev 257013)
+++ branches/safari-609.1.20.0-branch/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp	2020-02-20 01:51:51 UTC (rev 257014)
@@ -228,11 +228,11 @@
     m_webPageProxy.send(Messages::RemoteScrollingCoordinator::ScrollPositionChangedForNode(scrolledNodeID, newScrollPosition, scrollingLayerPositionAction == ScrollingLayerPositionAction::Sync));
 }
 
-void RemoteScrollingCoordinatorProxy::scrollingTreeNodeRequestsScroll(ScrollingNodeID scrolledNodeID, const FloatPoint& scrollPosition, bool representsProgrammaticScroll)
+void RemoteScrollingCoordinatorProxy::scrollingTreeNodeRequestsScroll(ScrollingNodeID scrolledNodeID, const FloatPoint& scrollPosition, ScrollType scrollType, ScrollClamping)
 {
     if (scrolledNodeID == rootScrollingNodeID() && m_requestedScrollInfo) {
         m_requestedScrollInfo->requestsScrollPositionUpdate = true;
-        m_requestedScrollInfo->requestIsProgrammaticScroll = representsProgrammaticScroll;
+        m_requestedScrollInfo->requestIsProgrammaticScroll = scrollType == ScrollType::Programmatic;
         m_requestedScrollInfo->requestedScrollPosition = scrollPosition;
     }
 }

Modified: branches/safari-609.1.20.0-branch/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h (257013 => 257014)


--- branches/safari-609.1.20.0-branch/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h	2020-02-20 01:50:59 UTC (rev 257013)
+++ branches/safari-609.1.20.0-branch/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h	2020-02-20 01:51:51 UTC (rev 257014)
@@ -57,7 +57,7 @@
 
     // Inform the web process that the scroll position changed (called from the scrolling tree)
     void scrollingTreeNodeDidScroll(WebCore::ScrollingNodeID, const WebCore::FloatPoint& newScrollPosition, const Optional<WebCore::FloatPoint>& layoutViewportOrigin, WebCore::ScrollingLayerPositionAction);
-    void scrollingTreeNodeRequestsScroll(WebCore::ScrollingNodeID, const WebCore::FloatPoint& scrollPosition, bool representsProgrammaticScroll);
+    void scrollingTreeNodeRequestsScroll(WebCore::ScrollingNodeID, const WebCore::FloatPoint& scrollPosition, WebCore::ScrollType, WebCore::ScrollClamping);
 
     WebCore::TrackingType eventTrackingTypeForPoint(const AtomString& eventName, WebCore::IntPoint) const;
 

Modified: branches/safari-609.1.20.0-branch/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp (257013 => 257014)


--- branches/safari-609.1.20.0-branch/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp	2020-02-20 01:50:59 UTC (rev 257013)
+++ branches/safari-609.1.20.0-branch/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp	2020-02-20 01:51:51 UTC (rev 257014)
@@ -107,9 +107,9 @@
     m_scrollingCoordinatorProxy.scrollingTreeNodeDidScroll(node.scrollingNodeID(), node.currentScrollPosition(), layoutViewportOrigin, scrollingLayerPositionAction);
 }
 
-void RemoteScrollingTree::scrollingTreeNodeRequestsScroll(ScrollingNodeID nodeID, const FloatPoint& scrollPosition, bool representsProgrammaticScroll)
+void RemoteScrollingTree::scrollingTreeNodeRequestsScroll(ScrollingNodeID nodeID, const FloatPoint& scrollPosition, ScrollType scrollType, ScrollClamping clamping)
 {
-    m_scrollingCoordinatorProxy.scrollingTreeNodeRequestsScroll(nodeID, scrollPosition, representsProgrammaticScroll);
+    m_scrollingCoordinatorProxy.scrollingTreeNodeRequestsScroll(nodeID, scrollPosition, scrollType, clamping);
 }
 
 Ref<ScrollingTreeNode> RemoteScrollingTree::createScrollingTreeNode(ScrollingNodeType nodeType, ScrollingNodeID nodeID)

Modified: branches/safari-609.1.20.0-branch/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.h (257013 => 257014)


--- branches/safari-609.1.20.0-branch/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.h	2020-02-20 01:50:59 UTC (rev 257013)
+++ branches/safari-609.1.20.0-branch/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.h	2020-02-20 01:51:51 UTC (rev 257014)
@@ -52,7 +52,7 @@
     const RemoteScrollingCoordinatorProxy& scrollingCoordinatorProxy() const { return m_scrollingCoordinatorProxy; }
 
     void scrollingTreeNodeDidScroll(WebCore::ScrollingTreeScrollingNode&, WebCore::ScrollingLayerPositionAction = WebCore::ScrollingLayerPositionAction::Sync) override;
-    void scrollingTreeNodeRequestsScroll(WebCore::ScrollingNodeID, const WebCore::FloatPoint& scrollPosition, bool representsProgrammaticScroll) override;
+    void scrollingTreeNodeRequestsScroll(WebCore::ScrollingNodeID, const WebCore::FloatPoint& scrollPosition, WebCore::ScrollType, WebCore::ScrollClamping) override;
 
     void currentSnapPointIndicesDidChange(WebCore::ScrollingNodeID, unsigned horizontal, unsigned vertical) override;
 

Modified: branches/safari-609.1.20.0-branch/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm (257013 => 257014)


--- branches/safari-609.1.20.0-branch/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm	2020-02-20 01:50:59 UTC (rev 257013)
+++ branches/safari-609.1.20.0-branch/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm	2020-02-20 01:51:51 UTC (rev 257014)
@@ -89,8 +89,8 @@
 
     // Update the scroll position after child nodes have been updated, because they need to have updated their constraints before any scrolling happens.
     if (scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::RequestedScrollPosition)) {
-        auto scrollType = scrollingStateNode.requestedScrollPositionRepresentsProgrammaticScroll() ? ScrollType::Programmatic : ScrollType::User;
-        scrollTo(scrollingStateNode.requestedScrollPosition(), scrollType);
+        const auto& requestedScrollData = scrollingStateNode.requestedScrollData();
+        scrollTo(requestedScrollData.scrollPosition, requestedScrollData.scrollType, requestedScrollData.clamping);
     }
 }
 

Modified: branches/safari-609.1.20.0-branch/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm (257013 => 257014)


--- branches/safari-609.1.20.0-branch/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm	2020-02-20 01:50:59 UTC (rev 257013)
+++ branches/safari-609.1.20.0-branch/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm	2020-02-20 01:51:51 UTC (rev 257014)
@@ -299,8 +299,8 @@
     }
 
     if (scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::RequestedScrollPosition)) {
-        auto scrollType = scrollingStateNode.requestedScrollPositionRepresentsProgrammaticScroll() ? ScrollType::Programmatic : ScrollType::User;
-        scrollingNode().scrollTo(scrollingStateNode.requestedScrollPosition(), scrollType);
+        const auto& requestedScrollData = scrollingStateNode.requestedScrollData();
+        scrollingNode().scrollTo(requestedScrollData.scrollPosition, requestedScrollData.scrollType, requestedScrollData.clamping);
     }
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to