Changeset 255037 in webkit
- Timestamp:
- Jan 23, 2020, 1:51:37 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 5 added
- 45 edited
-
LayoutTests/ChangeLog (modified) (2 diffs)
-
LayoutTests/tiled-drawing/scrolling/fixed/fixed-during-rubberband-expected.html (added)
-
LayoutTests/tiled-drawing/scrolling/fixed/fixed-during-rubberband.html (added)
-
LayoutTests/tiled-drawing/scrolling/sticky/sticky-during-rubberband-expected.html (added)
-
LayoutTests/tiled-drawing/scrolling/sticky/sticky-during-rubberband.html (added)
-
Source/WebCore/ChangeLog (modified) (2 diffs)
-
Source/WebCore/Sources.txt (modified) (1 diff)
-
Source/WebCore/WebCore.xcodeproj/project.pbxproj (modified) (2 diffs)
-
Source/WebCore/dom/Element.cpp (modified) (1 diff)
-
Source/WebCore/page/DOMWindow.cpp (modified) (2 diffs)
-
Source/WebCore/page/FrameView.cpp (modified) (4 diffs)
-
Source/WebCore/page/FrameView.h (modified) (3 diffs)
-
Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp (modified) (3 diffs)
-
Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h (modified) (1 diff)
-
Source/WebCore/page/scrolling/ScrollingCoordinator.cpp (modified) (1 diff)
-
Source/WebCore/page/scrolling/ScrollingCoordinator.h (modified) (2 diffs)
-
Source/WebCore/page/scrolling/ScrollingStateScrollingNode.cpp (modified) (4 diffs)
-
Source/WebCore/page/scrolling/ScrollingStateScrollingNode.h (modified) (4 diffs)
-
Source/WebCore/page/scrolling/ScrollingTree.h (modified) (1 diff)
-
Source/WebCore/page/scrolling/ScrollingTreeFrameScrollingNode.cpp (modified) (3 diffs)
-
Source/WebCore/page/scrolling/ScrollingTreeFrameScrollingNode.h (modified) (2 diffs)
-
Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp (modified) (4 diffs)
-
Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h (modified) (2 diffs)
-
Source/WebCore/page/scrolling/cocoa/ScrollingTreeFixedNode.mm (modified) (1 diff)
-
Source/WebCore/page/scrolling/cocoa/ScrollingTreeStickyNode.mm (modified) (1 diff)
-
Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h (modified) (1 diff)
-
Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm (modified) (2 diffs)
-
Source/WebCore/page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h (modified) (1 diff)
-
Source/WebCore/page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm (modified) (2 diffs)
-
Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm (modified) (1 diff)
-
Source/WebCore/page/scrolling/nicosia/ScrollingTreeFrameScrollingNodeNicosia.cpp (modified) (2 diffs)
-
Source/WebCore/page/scrolling/nicosia/ScrollingTreeFrameScrollingNodeNicosia.h (modified) (1 diff)
-
Source/WebCore/page/scrolling/nicosia/ScrollingTreeOverflowScrollingNodeNicosia.cpp (modified) (1 diff)
-
Source/WebCore/page/scrolling/nicosia/ScrollingTreeOverflowScrollingNodeNicosia.h (modified) (1 diff)
-
Source/WebCore/platform/ScrollTypes.cpp (added)
-
Source/WebCore/platform/ScrollTypes.h (modified) (3 diffs)
-
Source/WebCore/platform/ScrollView.cpp (modified) (4 diffs)
-
Source/WebCore/platform/ScrollView.h (modified) (2 diffs)
-
Source/WebCore/platform/ScrollableArea.cpp (modified) (1 diff)
-
Source/WebCore/platform/ScrollableArea.h (modified) (1 diff)
-
Source/WebCore/rendering/RenderLayer.cpp (modified) (1 diff)
-
Source/WebCore/testing/Internals.cpp (modified) (1 diff)
-
Source/WebKit/ChangeLog (modified) (1 diff)
-
Source/WebKit/Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp (modified) (6 diffs)
-
Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp (modified) (1 diff)
-
Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h (modified) (1 diff)
-
Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp (modified) (1 diff)
-
Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.h (modified) (1 diff)
-
Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm (modified) (1 diff)
-
Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r254980 r255037 190 190 * http/wpt/webauthn/public-key-credential-create-failure-local.https.html: 191 191 192 2020-01-22 Simon Fraser <simon.fraser@apple.com> 193 194 Fixed elements no longer stay fixed with elastic overscroll 195 https://bugs.webkit.org/show_bug.cgi?id=206227 196 rdar://problem/58707084 197 198 Reviewed by Antti Koivisto. 199 200 * tiled-drawing/scrolling/fixed/fixed-during-rubberband-expected.html: Added. 201 * tiled-drawing/scrolling/fixed/fixed-during-rubberband.html: Added. 202 * tiled-drawing/scrolling/sticky/sticky-during-rubberband-expected.html: Added. 203 * tiled-drawing/scrolling/sticky/sticky-during-rubberband.html: Added. 204 192 205 2020-01-21 Commit Queue <commit-queue@webkit.org> 193 206 … … 195 208 https://bugs.webkit.org/show_bug.cgi?id=206559 196 209 197 Broke page up/page down on macO W(Requested by smfr on210 Broke page up/page down on macOS (Requested by smfr on 198 211 #webkit). 199 212 -
trunk/Source/WebCore/ChangeLog
r255036 r255037 849 849 (WebCore::SVGImage::nativeImageForCurrentFrame): 850 850 851 2020-01-22 Simon Fraser <simon.fraser@apple.com> 852 853 Fixed elements no longer stay fixed with elastic overscroll 854 https://bugs.webkit.org/show_bug.cgi?id=206227 855 rdar://problem/58707084 856 857 Reviewed by Antti Koivisto. 858 859 Intended behavior on iOS and macOS is for position:fixed and sticky elements to maintain 860 their position relative to the view bounds when rubber-banding ("overscrolling"). This broke 861 some time back. This change restores the correct behavior with the call to layoutViewportRespectingRubberBanding() 862 in ScrollingTreeFixedNode::applyLayerPositions() and ScrollingTreeStickyNode::computeLayerPosition(). 863 layoutViewportRespectingRubberBanding() computes a layout viewport without clamping. 864 865 The rest of the changes are to support testing. internals.unconstrainedScrollTo() 866 didn't work for main frame scrolling because of scroll position clamping in various places, 867 so propagate ScrollClamping in more places (and replace the redundant ScrollPositionClamp with ScrollClamping). 868 869 "requested scroll position" updates now carry along both clamping and "is programmatic" data, wrapped in a struct 870 which is passed around the scrolling tree. This allows us to not clamp the scroll position (for testing) in more places. 871 872 Internals::unconstrainedScrollTo() needs one weird hack to trigger a layout (and thus a scrolling tree commit), 873 because the layout is normally triggered by a layout viewport change, but when rubber-banding we clamp the layoutViewport 874 used for layout, so those layouts are never triggered. 875 876 Tests: tiled-drawing/scrolling/fixed/fixed-during-rubberband.html 877 tiled-drawing/scrolling/sticky/sticky-during-rubberband.html 878 879 * Sources.txt: 880 * WebCore.xcodeproj/project.pbxproj: 881 * dom/Element.cpp: 882 (WebCore::Element::scrollTo): 883 * page/DOMWindow.cpp: 884 (WebCore::DOMWindow::scrollTo const): 885 * page/FrameView.cpp: 886 (WebCore::FrameView::setScrollPosition): 887 (WebCore::FrameView::requestScrollPositionUpdate): 888 * page/FrameView.h: 889 * page/scrolling/AsyncScrollingCoordinator.cpp: 890 (WebCore::AsyncScrollingCoordinator::requestScrollPositionUpdate): 891 * page/scrolling/AsyncScrollingCoordinator.h: 892 * page/scrolling/ScrollingCoordinator.cpp: 893 * page/scrolling/ScrollingCoordinator.h: 894 (WebCore::ScrollingCoordinator::requestScrollPositionUpdate): 895 * page/scrolling/ScrollingStateScrollingNode.cpp: 896 (WebCore::ScrollingStateScrollingNode::ScrollingStateScrollingNode): 897 (WebCore::ScrollingStateScrollingNode::setRequestedScrollData): 898 (WebCore::ScrollingStateScrollingNode::dumpProperties const): 899 (WebCore::ScrollingStateScrollingNode::setRequestedScrollPosition): Deleted. 900 * page/scrolling/ScrollingStateScrollingNode.h: 901 (WebCore::RequestedScrollData::operator== const): 902 (WebCore::ScrollingStateScrollingNode::requestedScrollData const): 903 (WebCore::ScrollingStateScrollingNode::requestedScrollPosition const): Deleted. 904 (WebCore::ScrollingStateScrollingNode::requestedScrollPositionRepresentsProgrammaticScroll const): Deleted. 905 * page/scrolling/ScrollingTree.h: 906 (WebCore::ScrollingTree::scrollingTreeNodeRequestsScroll): 907 * page/scrolling/ScrollingTreeFrameScrollingNode.cpp: 908 (WebCore::ScrollingTreeFrameScrollingNode::layoutViewportForScrollPosition const): 909 (WebCore::ScrollingTreeFrameScrollingNode::layoutViewportRespectingRubberBanding const): 910 * page/scrolling/ScrollingTreeFrameScrollingNode.h: 911 * page/scrolling/ScrollingTreeScrollingNode.cpp: 912 (WebCore::ScrollingTreeScrollingNode::commitStateAfterChildren): 913 (WebCore::ScrollingTreeScrollingNode::adjustedScrollPosition const): 914 (WebCore::ScrollingTreeScrollingNode::scrollBy): 915 (WebCore::ScrollingTreeScrollingNode::scrollTo): 916 (WebCore::ScrollingTreeScrollingNode::wasScrolledByDelegatedScrolling): 917 * page/scrolling/ScrollingTreeScrollingNode.h: 918 * page/scrolling/cocoa/ScrollingTreeFixedNode.mm: 919 (WebCore::ScrollingTreeFixedNode::applyLayerPositions): 920 * page/scrolling/cocoa/ScrollingTreeStickyNode.mm: 921 (WebCore::ScrollingTreeStickyNode::computeLayerPosition const): 922 * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h: 923 * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm: 924 (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateAfterChildren): 925 (WebCore::ScrollingTreeFrameScrollingNodeMac::adjustedScrollPosition const): 926 * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h: 927 * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm: 928 (WebCore::ScrollingTreeOverflowScrollingNodeMac::commitStateAfterChildren): 929 (WebCore::ScrollingTreeOverflowScrollingNodeMac::adjustedScrollPosition const): 930 * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: 931 (WebCore::ScrollingTreeScrollingNodeDelegateMac::immediateScrollByWithoutContentEdgeConstraints): 932 * platform/ScrollTypes.cpp: Added. 933 (WebCore::operator<<): 934 * platform/ScrollTypes.h: 935 * platform/ScrollView.cpp: 936 (WebCore::ScrollView::setContentsScrollPosition): 937 (WebCore::ScrollView::setScrollPosition): 938 * platform/ScrollView.h: 939 * platform/ScrollableArea.cpp: 940 (WebCore::ScrollableArea::setScrollOffsetFromAnimation): 941 * platform/ScrollableArea.h: 942 (WebCore::ScrollableArea::requestScrollPositionUpdate): 943 * rendering/RenderLayer.cpp: 944 (WebCore::RenderLayer::scrollToOffset): 945 * testing/Internals.cpp: 946 (WebCore::Internals::unconstrainedScrollTo): 947 851 948 2020-01-21 Commit Queue <commit-queue@webkit.org> 852 949 … … 854 951 https://bugs.webkit.org/show_bug.cgi?id=206559 855 952 856 Broke page up/page down on macO W(Requested by smfr on953 Broke page up/page down on macOS (Requested by smfr on 857 954 #webkit). 858 955 -
trunk/Source/WebCore/Sources.txt
r254890 r255037 1764 1764 platform/SSLKeyGenerator.cpp 1765 1765 platform/ScrollAnimator.cpp 1766 platform/ScrollTypes.cpp 1766 1767 platform/ScrollView.cpp 1767 1768 platform/ScrollableArea.cpp -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r254995 r255037 5748 5748 0F4966A81DB40C4300A274BB /* JSDOMPointReadOnly.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMPointReadOnly.cpp; sourceTree = "<group>"; }; 5749 5749 0F4966A91DB40C4300A274BB /* JSDOMPointReadOnly.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDOMPointReadOnly.h; sourceTree = "<group>"; }; 5750 0F4CDEAA23D91A8A00251B02 /* ScrollTypes.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ScrollTypes.cpp; sourceTree = "<group>"; }; 5750 5751 0F53FB81213B1BB800C40D34 /* CSSFilter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSFilter.cpp; sourceTree = "<group>"; }; 5751 5752 0F53FB83213B1BB800C40D34 /* CSSFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSFilter.h; sourceTree = "<group>"; }; … … 26085 26086 BC1402880E83680800319717 /* ScrollbarThemeComposite.cpp */, 26086 26087 BC1402890E83680800319717 /* ScrollbarThemeComposite.h */, 26088 0F4CDEAA23D91A8A00251B02 /* ScrollTypes.cpp */, 26087 26089 93C09C850B0657AA005ABD4D /* ScrollTypes.h */, 26088 26090 BC2441C30E8B65D00055320F /* ScrollView.cpp */, -
trunk/Source/WebCore/dom/Element.cpp
r254890 r255037 943 943 return; 944 944 945 window->scrollTo(options );945 window->scrollTo(options, clamping); 946 946 return; 947 947 } -
trunk/Source/WebCore/page/DOMWindow.cpp
r254890 r255037 1699 1699 } 1700 1700 1701 void DOMWindow::scrollTo(const ScrollToOptions& options, ScrollClamping ) const1701 void DOMWindow::scrollTo(const ScrollToOptions& options, ScrollClamping clamping) const 1702 1702 { 1703 1703 if (!isCurrentlyDisplayedInFrame()) … … 1718 1718 1719 1719 IntPoint layoutPos(view->mapFromCSSToLayoutUnits(scrollToOptions.left.value()), view->mapFromCSSToLayoutUnits(scrollToOptions.top.value())); 1720 view->setContentsScrollPosition(layoutPos );1720 view->setContentsScrollPosition(layoutPos, clamping); 1721 1721 } 1722 1722 -
trunk/Source/WebCore/page/FrameView.cpp
r254890 r255037 2280 2280 } 2281 2281 2282 void FrameView::setScrollPosition(const ScrollPosition& scrollPosition )2282 void FrameView::setScrollPosition(const ScrollPosition& scrollPosition, ScrollClamping clamping) 2283 2283 { 2284 2284 LOG_WITH_STREAM(Scrolling, stream << "FrameView::setScrollPosition " << scrollPosition << " , clearing anchor"); … … 2293 2293 if (page && page->isMonitoringWheelEvents()) 2294 2294 scrollAnimator().setWheelEventTestMonitor(page->wheelEventTestMonitor()); 2295 ScrollView::setScrollPosition(scrollPosition );2295 ScrollView::setScrollPosition(scrollPosition, clamping); 2296 2296 2297 2297 setCurrentScrollType(oldScrollType); … … 2617 2617 } 2618 2618 2619 bool FrameView::requestScrollPositionUpdate(const ScrollPosition& position )2619 bool FrameView::requestScrollPositionUpdate(const ScrollPosition& position, ScrollType scrollType, ScrollClamping clamping) 2620 2620 { 2621 2621 LOG_WITH_STREAM(Scrolling, stream << "FrameView::requestScrollPositionUpdate " << position); … … 2629 2629 if (Page* page = frame().page()) { 2630 2630 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator()) 2631 return scrollingCoordinator->requestScrollPositionUpdate(*this, position );2631 return scrollingCoordinator->requestScrollPositionUpdate(*this, position, scrollType, clamping); 2632 2632 } 2633 2633 #else -
trunk/Source/WebCore/page/FrameView.h
r254890 r255037 118 118 void setNeedsCompositingGeometryUpdate(); 119 119 120 void setViewportConstrainedObjectsNeedLayout();120 WEBCORE_EXPORT void setViewportConstrainedObjectsNeedLayout(); 121 121 122 122 WEBCORE_EXPORT bool renderedCharactersExceed(unsigned threshold); … … 224 224 WEBCORE_EXPORT void setFixedVisibleContentRect(const IntRect&) final; 225 225 #endif 226 WEBCORE_EXPORT void setScrollPosition(const ScrollPosition& ) final;226 WEBCORE_EXPORT void setScrollPosition(const ScrollPosition&, ScrollClamping = ScrollClamping::Clamped) final; 227 227 void restoreScrollbar(); 228 228 void scheduleScrollToFocusedElement(SelectionRevealMode); … … 230 230 void updateLayerPositionsAfterScrolling() final; 231 231 void updateCompositingLayersAfterScrolling() final; 232 bool requestScrollPositionUpdate(const ScrollPosition& ) final;232 bool requestScrollPositionUpdate(const ScrollPosition&, ScrollType = ScrollType::User, ScrollClamping = ScrollClamping::Clamped) final; 233 233 bool isRubberBandInProgress() const final; 234 234 WEBCORE_EXPORT ScrollPosition minimumScrollPosition() const final; -
trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp
r251262 r255037 231 231 } 232 232 233 bool AsyncScrollingCoordinator::requestScrollPositionUpdate(ScrollableArea& scrollableArea, const IntPoint& scrollPosition )233 bool AsyncScrollingCoordinator::requestScrollPositionUpdate(ScrollableArea& scrollableArea, const IntPoint& scrollPosition, ScrollType scrollType, ScrollClamping clamping) 234 234 { 235 235 ASSERT(isMainThread()); … … 252 252 updateScrollPositionAfterAsyncScroll(scrollingNodeID, scrollPosition, { }, ScrollType::Programmatic, ScrollingLayerPositionAction::Set); 253 253 254 ASSERT(inProgrammaticScroll == (scrollType == ScrollType::Programmatic)); 255 254 256 // If this frame view's document is being put into the back/forward cache, we don't want to update our 255 257 // main frame scroll position. Just let the FrameView think that we did. … … 261 263 return false; 262 264 263 stateNode->setRequestedScroll Position(scrollPosition, inProgrammaticScroll);265 stateNode->setRequestedScrollData({ scrollPosition, scrollType, clamping }); 264 266 return true; 265 267 } -
trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h
r250946 r255037 99 99 WEBCORE_EXPORT void frameViewEventTrackingRegionsChanged(FrameView&) override; 100 100 101 WEBCORE_EXPORT bool requestScrollPositionUpdate(ScrollableArea&, const IntPoint& ) override;101 WEBCORE_EXPORT bool requestScrollPositionUpdate(ScrollableArea&, const IntPoint&, ScrollType, ScrollClamping) override; 102 102 103 103 WEBCORE_EXPORT void applyScrollingTreeLayerPositions() override; -
trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp
r251041 r255037 499 499 } 500 500 501 TextStream& operator<<(TextStream& ts, ScrollType scrollType)502 {503 switch (scrollType) {504 case ScrollType::User: ts << "user"; break;505 case ScrollType::Programmatic: ts << "programmatic"; break;506 }507 return ts;508 }509 510 501 } // namespace WebCore -
trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h
r250946 r255037 122 122 // These virtual functions are currently unique to the threaded scrolling architecture. 123 123 virtual void commitTreeStateIfNeeded() { } 124 virtual bool requestScrollPositionUpdate(ScrollableArea&, const IntPoint& ) { return false; }124 virtual bool requestScrollPositionUpdate(ScrollableArea&, const IntPoint&, ScrollType = ScrollType::Programmatic, ScrollClamping = ScrollClamping::Clamped) { return false; } 125 125 virtual ScrollingEventResult handleWheelEvent(FrameView&, const PlatformWheelEvent&) { return ScrollingEventResult::DidNotHandleEvent; } 126 126 … … 222 222 WEBCORE_EXPORT WTF::TextStream& operator<<(WTF::TextStream&, ScrollingLayerPositionAction); 223 223 WEBCORE_EXPORT WTF::TextStream& operator<<(WTF::TextStream&, ViewportRectStability); 224 WEBCORE_EXPORT WTF::TextStream& operator<<(WTF::TextStream&, ScrollType);225 224 226 225 } // namespace WebCore -
trunk/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.cpp
r250946 r255037 46 46 , m_parentRelativeScrollableRect(stateNode.parentRelativeScrollableRect()) 47 47 , m_scrollPosition(stateNode.scrollPosition()) 48 , m_requestedScrollPosition(stateNode.requestedScrollPosition())49 48 , m_scrollOrigin(stateNode.scrollOrigin()) 50 49 #if ENABLE(CSS_SCROLL_SNAP) … … 56 55 #endif 57 56 , m_scrollableAreaParameters(stateNode.scrollableAreaParameters()) 58 , m_requestedScroll PositionRepresentsProgrammaticScroll(stateNode.requestedScrollPositionRepresentsProgrammaticScroll())57 , m_requestedScrollData(stateNode.requestedScrollData()) 59 58 , m_isMonitoringWheelEvents(stateNode.isMonitoringWheelEvents()) 60 59 { … … 220 219 } 221 220 222 void ScrollingStateScrollingNode::setRequestedScrollPosition(const FloatPoint& requestedScrollPosition, bool representsProgrammaticScroll) 223 { 224 m_requestedScrollPosition = requestedScrollPosition; 225 m_requestedScrollPositionRepresentsProgrammaticScroll = representsProgrammaticScroll; 221 void ScrollingStateScrollingNode::setRequestedScrollData(const RequestedScrollData& scrollData) 222 { 223 if (scrollData == m_requestedScrollData) 224 return; 225 226 m_requestedScrollData = scrollData; 226 227 setPropertyChanged(RequestedScrollPosition); 227 228 } … … 306 307 ts.dumpProperty("reachable contents size", m_reachableContentsSize); 307 308 308 if ( m_requestedScrollPosition != IntPoint()) {309 if (!m_requestedScrollData.scrollPosition.isZero()) { 309 310 TextStream::GroupScope scope(ts); 310 311 ts << "requested scroll position " 311 << TextStream::FormatNumberRespectingIntegers(m_requestedScrollPosition.x()) << " " 312 << TextStream::FormatNumberRespectingIntegers(m_requestedScrollPosition.y()); 313 } 314 if (m_requestedScrollPositionRepresentsProgrammaticScroll) 315 ts.dumpProperty("requested scroll position represents programmatic scroll", m_requestedScrollPositionRepresentsProgrammaticScroll); 312 << TextStream::FormatNumberRespectingIntegers(m_requestedScrollData.scrollPosition.x()) << " " 313 << TextStream::FormatNumberRespectingIntegers(m_requestedScrollData.scrollPosition.y()); 314 } 315 if (m_requestedScrollData.scrollType == ScrollType::Programmatic) 316 ts.dumpProperty("requested scroll position represents programmatic scroll", true); 317 318 if (m_requestedScrollData.clamping == ScrollClamping::Unclamped) 319 ts.dumpProperty("requested scroll position clamping", m_requestedScrollData.clamping); 316 320 317 321 if (!m_parentRelativeScrollableRect.isEmpty()) -
trunk/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.h
r250946 r255037 38 38 39 39 namespace WebCore { 40 41 struct RequestedScrollData { 42 FloatPoint scrollPosition; 43 ScrollType scrollType { ScrollType::User }; 44 ScrollClamping clamping { ScrollClamping::Clamped }; 45 46 bool operator==(const RequestedScrollData& other) const 47 { 48 return scrollPosition == other.scrollPosition 49 && scrollType == other.scrollType 50 && clamping == other.clamping; 51 } 52 }; 40 53 41 54 class ScrollingStateScrollingNode : public ScrollingStateNode { … … 110 123 WEBCORE_EXPORT void setScrollableAreaParameters(const ScrollableAreaParameters& params); 111 124 112 const FloatPoint& requestedScrollPosition() const { return m_requestedScrollPosition; } 113 bool requestedScrollPositionRepresentsProgrammaticScroll() const { return m_requestedScrollPositionRepresentsProgrammaticScroll; } 114 WEBCORE_EXPORT void setRequestedScrollPosition(const FloatPoint&, bool representsProgrammaticScroll); 125 const RequestedScrollData& requestedScrollData() const { return m_requestedScrollData; } 126 WEBCORE_EXPORT void setRequestedScrollData(const RequestedScrollData&); 115 127 116 128 bool isMonitoringWheelEvents() const { return m_isMonitoringWheelEvents; } … … 150 162 LayoutRect m_parentRelativeScrollableRect; 151 163 FloatPoint m_scrollPosition; 152 FloatPoint m_requestedScrollPosition;153 164 IntPoint m_scrollOrigin; 154 165 … … 170 181 171 182 ScrollableAreaParameters m_scrollableAreaParameters; 183 RequestedScrollData m_requestedScrollData; 172 184 173 bool m_requestedScrollPositionRepresentsProgrammaticScroll { false };174 185 bool m_isMonitoringWheelEvents { false }; 175 186 }; -
trunk/Source/WebCore/page/scrolling/ScrollingTree.h
r252742 r255037 84 84 85 85 // Called for requested scroll position updates. 86 virtual void scrollingTreeNodeRequestsScroll(ScrollingNodeID, const FloatPoint& /*scrollPosition*/, bool /*representsProgrammaticScroll*/) { }86 virtual void scrollingTreeNodeRequestsScroll(ScrollingNodeID, const FloatPoint& /*scrollPosition*/, ScrollType, ScrollClamping) { } 87 87 88 88 // Delegated scrolling/zooming has caused the viewport to change, so update viewport-constrained layers -
trunk/Source/WebCore/page/scrolling/ScrollingTreeFrameScrollingNode.cpp
r249815 r255037 96 96 } 97 97 98 FloatRect ScrollingTreeFrameScrollingNode::layoutViewportForScrollPosition(const FloatPoint& visibleContentOrigin, float scale ) const98 FloatRect ScrollingTreeFrameScrollingNode::layoutViewportForScrollPosition(const FloatPoint& visibleContentOrigin, float scale, ScrollBehaviorForFixedElements fixedBehavior) const 99 99 { 100 100 FloatSize visualViewportSize = m_overrideVisualViewportSize.valueOr(scrollableAreaSize()); … … 108 108 LOG_WITH_STREAM(Scrolling, stream << " scroll positions: min: " << minLayoutViewportOrigin() << " max: "<< maxLayoutViewportOrigin()); 109 109 110 LayoutPoint newLocation = FrameView::computeLayoutViewportOrigin(LayoutRect(visualViewport), LayoutPoint(minLayoutViewportOrigin()), LayoutPoint(maxLayoutViewportOrigin()), layoutViewport, StickToDocumentBounds);110 LayoutPoint newLocation = FrameView::computeLayoutViewportOrigin(LayoutRect(visualViewport), LayoutPoint(minLayoutViewportOrigin()), LayoutPoint(maxLayoutViewportOrigin()), layoutViewport, fixedBehavior); 111 111 112 112 if (layoutViewport.location() != newLocation) { … … 124 124 else 125 125 setLayoutViewport(layoutViewportForScrollPosition(currentScrollPosition(), frameScaleFactor())); 126 } 127 128 FloatRect ScrollingTreeFrameScrollingNode::layoutViewportRespectingRubberBanding() const 129 { 130 return layoutViewportForScrollPosition(currentScrollPosition(), frameScaleFactor(), StickToViewportBounds); 126 131 } 127 132 -
trunk/Source/WebCore/page/scrolling/ScrollingTreeFrameScrollingNode.h
r247839 r255037 48 48 49 49 FloatSize viewToContentsOffset(const FloatPoint& scrollPosition) const; 50 FloatRect layoutViewportForScrollPosition(const FloatPoint& visibleContentOrigin, float scale) const;51 50 52 51 FloatRect layoutViewport() const { return m_layoutViewport; }; 53 52 void setLayoutViewport(const FloatRect& r) { m_layoutViewport = r; }; 53 54 FloatRect layoutViewportRespectingRubberBanding() const; 54 55 55 56 float frameScaleFactor() const { return m_frameScaleFactor; } … … 73 74 void updateViewportForCurrentScrollPosition(Optional<FloatRect>) override; 74 75 bool scrollPositionAndLayoutViewportMatch(const FloatPoint& position, Optional<FloatRect> overrideLayoutViewport) override; 76 FloatRect layoutViewportForScrollPosition(const FloatPoint&, float scale, ScrollBehaviorForFixedElements = StickToDocumentBounds) const; 75 77 76 78 void dumpProperties(WTF::TextStream&, ScrollingStateTreeAsTextBehavior) const override; -
trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp
r251262 r255037 108 108 { 109 109 const ScrollingStateScrollingNode& scrollingStateNode = downcast<ScrollingStateScrollingNode>(stateNode); 110 if (scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::RequestedScrollPosition)) 111 scrollingTree().scrollingTreeNodeRequestsScroll(scrollingNodeID(), scrollingStateNode.requestedScrollPosition(), scrollingStateNode.requestedScrollPositionRepresentsProgrammaticScroll()); 110 if (scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::RequestedScrollPosition)) { 111 const auto& requestedScrollData = scrollingStateNode.requestedScrollData(); 112 scrollingTree().scrollingTreeNodeRequestsScroll(scrollingNodeID(), requestedScrollData.scrollPosition, requestedScrollData.scrollType, requestedScrollData.clamping); 113 } 112 114 113 115 m_isFirstCommit = false; … … 145 147 } 146 148 147 FloatPoint ScrollingTreeScrollingNode::adjustedScrollPosition(const FloatPoint& scrollPosition, Scroll PositionClamp clamp) const148 { 149 if (clamp == ScrollPositionClamp::ToContentEdges)149 FloatPoint ScrollingTreeScrollingNode::adjustedScrollPosition(const FloatPoint& scrollPosition, ScrollClamping clamping) const 150 { 151 if (clamping == ScrollClamping::Clamped) 150 152 return clampScrollPosition(scrollPosition); 151 153 … … 153 155 } 154 156 155 void ScrollingTreeScrollingNode::scrollBy(const FloatSize& delta, Scroll PositionClampclamp)157 void ScrollingTreeScrollingNode::scrollBy(const FloatSize& delta, ScrollClamping clamp) 156 158 { 157 159 scrollTo(currentScrollPosition() + delta, ScrollType::User, clamp); 158 160 } 159 161 160 void ScrollingTreeScrollingNode::scrollTo(const FloatPoint& position, ScrollType scrollType, Scroll PositionClampclamp)162 void ScrollingTreeScrollingNode::scrollTo(const FloatPoint& position, ScrollType scrollType, ScrollClamping clamp) 161 163 { 162 164 if (position == m_currentScrollPosition) … … 201 203 return; 202 204 203 m_currentScrollPosition = adjustedScrollPosition(position, Scroll PositionClamp::None);205 m_currentScrollPosition = adjustedScrollPosition(position, ScrollClamping::Unclamped); 204 206 updateViewportForCurrentScrollPosition(overrideLayoutViewport); 205 207 -
trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h
r251262 r255037 61 61 62 62 // These are imperative; they adjust the scrolling layers. 63 void scrollTo(const FloatPoint&, ScrollType = ScrollType::User, Scroll PositionClamp = ScrollPositionClamp::ToContentEdges);64 void scrollBy(const FloatSize&, Scroll PositionClamp = ScrollPositionClamp::ToContentEdges);63 void scrollTo(const FloatPoint&, ScrollType = ScrollType::User, ScrollClamping = ScrollClamping::Clamped); 64 void scrollBy(const FloatSize&, ScrollClamping = ScrollClamping::Clamped); 65 65 66 66 void wasScrolledByDelegatedScrolling(const FloatPoint& position, Optional<FloatRect> overrideLayoutViewport = { }, ScrollingLayerPositionAction = ScrollingLayerPositionAction::Sync); … … 100 100 FloatPoint clampScrollPosition(const FloatPoint&) const; 101 101 102 virtual FloatPoint adjustedScrollPosition(const FloatPoint&, Scroll PositionClamp = ScrollPositionClamp::ToContentEdges) const;102 virtual FloatPoint adjustedScrollPosition(const FloatPoint&, ScrollClamping = ScrollClamping::Clamped) const; 103 103 104 104 virtual void currentScrollPositionChanged(); -
trunk/Source/WebCore/page/scrolling/cocoa/ScrollingTreeFixedNode.mm
r250491 r255037 78 78 // Fixed nodes are positioned relative to the containing frame scrolling node. 79 79 // We bail out after finding one. 80 auto layoutViewport = downcast<ScrollingTreeFrameScrollingNode>(*ancestor).layoutViewport ();80 auto layoutViewport = downcast<ScrollingTreeFrameScrollingNode>(*ancestor).layoutViewportRespectingRubberBanding(); 81 81 return m_constraints.layerPositionForViewportRect(layoutViewport) - overflowScrollDelta; 82 82 } -
trunk/Source/WebCore/page/scrolling/cocoa/ScrollingTreeStickyNode.mm
r250491 r255037 74 74 if (is<ScrollingTreeFrameScrollingNode>(scrollingNode)) { 75 75 auto& frameScrollingNode = downcast<ScrollingTreeFrameScrollingNode>(scrollingNode); 76 constrainingRect = frameScrollingNode.layoutViewport ();76 constrainingRect = frameScrollingNode.layoutViewportRespectingRubberBanding(); 77 77 } else { 78 78 auto& overflowScrollingNode = downcast<ScrollingTreeOverflowScrollingNode>(scrollingNode); -
trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h
r251173 r255037 62 62 63 63 private: 64 FloatPoint adjustedScrollPosition(const FloatPoint&, Scroll PositionClamp) const override;64 FloatPoint adjustedScrollPosition(const FloatPoint&, ScrollClamping) const override; 65 65 66 66 void currentScrollPositionChanged() override; -
trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm
r251173 r255037 138 138 // Update the scroll position after child nodes have been updated, because they need to have updated their constraints before any scrolling happens. 139 139 if (scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::RequestedScrollPosition)) { 140 auto scrollType = scrollingStateNode.requestedScrollPositionRepresentsProgrammaticScroll() ? ScrollType::Programmatic : ScrollType::User;141 scrollTo( scrollingStateNode.requestedScrollPosition(), scrollType);140 const auto& requestedScrollData = scrollingStateNode.requestedScrollData(); 141 scrollTo(requestedScrollData.scrollPosition, requestedScrollData.scrollType, requestedScrollData.clamping); 142 142 } 143 143 … … 170 170 } 171 171 172 FloatPoint ScrollingTreeFrameScrollingNodeMac::adjustedScrollPosition(const FloatPoint& position, Scroll PositionClampclamp) const172 FloatPoint ScrollingTreeFrameScrollingNodeMac::adjustedScrollPosition(const FloatPoint& position, ScrollClamping clamp) const 173 173 { 174 174 FloatPoint scrollPosition(roundf(position.x()), roundf(position.y())); -
trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h
r242359 r255037 46 46 void commitStateAfterChildren(const ScrollingStateNode&) override; 47 47 48 FloatPoint adjustedScrollPosition(const FloatPoint&, Scroll PositionClamp) const override;48 FloatPoint adjustedScrollPosition(const FloatPoint&, ScrollClamping) const override; 49 49 50 50 void repositionScrollingLayers() override; -
trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm
r250498 r255037 63 63 64 64 if (overflowStateNode.hasChangedProperty(ScrollingStateScrollingNode::RequestedScrollPosition)) { 65 auto scrollType = overflowStateNode.requestedScrollPositionRepresentsProgrammaticScroll() ? ScrollType::Programmatic : ScrollType::User;66 scrollTo( overflowStateNode.requestedScrollPosition(), scrollType);65 const auto& requestedScrollData = overflowStateNode.requestedScrollData(); 66 scrollTo(requestedScrollData.scrollPosition, requestedScrollData.scrollType, requestedScrollData.clamping); 67 67 } 68 68 } … … 84 84 } 85 85 86 FloatPoint ScrollingTreeOverflowScrollingNodeMac::adjustedScrollPosition(const FloatPoint& position, Scroll PositionClampclamp) const86 FloatPoint ScrollingTreeOverflowScrollingNodeMac::adjustedScrollPosition(const FloatPoint& position, ScrollClamping clamp) const 87 87 { 88 88 FloatPoint scrollPosition(roundf(position.x()), roundf(position.y())); -
trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm
r251262 r255037 236 236 void ScrollingTreeScrollingNodeDelegateMac::immediateScrollByWithoutContentEdgeConstraints(const FloatSize& offset) 237 237 { 238 scrollingNode().scrollBy(offset, Scroll PositionClamp::None);238 scrollingNode().scrollBy(offset, ScrollClamping::Unclamped); 239 239 } 240 240 -
trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeFrameScrollingNodeNicosia.cpp
r250857 r255037 92 92 // Update the scroll position after child nodes have been updated, because they need to have updated their constraints before any scrolling happens. 93 93 if (scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::RequestedScrollPosition)) { 94 auto scrollType = scrollingStateNode.requestedScrollPositionRepresentsProgrammaticScroll() ? ScrollType::Programmatic : ScrollType::User;95 scrollTo( scrollingStateNode.requestedScrollPosition(), scrollType);94 const auto& requestedScrollData = scrollingStateNode.requestedScrollData(); 95 scrollTo(requestedScrollData.scrollPosition, requestedScrollData.scrollType, requestedScrollData.clamping); 96 96 } 97 97 } … … 117 117 } 118 118 119 FloatPoint ScrollingTreeFrameScrollingNodeNicosia::adjustedScrollPosition(const FloatPoint& position, Scroll PositionClamp clamp) const119 FloatPoint ScrollingTreeFrameScrollingNodeNicosia::adjustedScrollPosition(const FloatPoint& position, ScrollClamping clamping) const 120 120 { 121 121 FloatPoint scrollPosition(roundf(position.x()), roundf(position.y())); 122 return ScrollingTreeFrameScrollingNode::adjustedScrollPosition(scrollPosition, clamp );122 return ScrollingTreeFrameScrollingNode::adjustedScrollPosition(scrollPosition, clamping); 123 123 } 124 124 -
trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeFrameScrollingNodeNicosia.h
r250420 r255037 54 54 ScrollingEventResult handleWheelEvent(const PlatformWheelEvent&) override; 55 55 56 FloatPoint adjustedScrollPosition(const FloatPoint&, Scroll PositionClamp) const override;56 FloatPoint adjustedScrollPosition(const FloatPoint&, ScrollClamping) const override; 57 57 58 58 void currentScrollPositionChanged() override; -
trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeOverflowScrollingNodeNicosia.cpp
r250857 r255037 56 56 const auto& overflowStateNode = downcast<ScrollingStateOverflowScrollingNode>(stateNode); 57 57 if (overflowStateNode.hasChangedProperty(ScrollingStateScrollingNode::RequestedScrollPosition)) { 58 auto scrollType = overflowStateNode.requestedScrollPositionRepresentsProgrammaticScroll() ? ScrollType::Programmatic : ScrollType::User;59 scrollTo( overflowStateNode.requestedScrollPosition(), scrollType);58 const auto& requestedScrollData = overflowStateNode.requestedScrollData(); 59 scrollTo(requestedScrollData.scrollPosition, requestedScrollData.scrollType, requestedScrollData.clamping); 60 60 } 61 61 } 62 62 63 FloatPoint ScrollingTreeOverflowScrollingNodeNicosia::adjustedScrollPosition(const FloatPoint& position, Scroll PositionClamp clamp) const63 FloatPoint ScrollingTreeOverflowScrollingNodeNicosia::adjustedScrollPosition(const FloatPoint& position, ScrollClamping clamping) const 64 64 { 65 65 FloatPoint scrollPosition(roundf(position.x()), roundf(position.y())); 66 return ScrollingTreeOverflowScrollingNode::adjustedScrollPosition(scrollPosition, clamp );66 return ScrollingTreeOverflowScrollingNode::adjustedScrollPosition(scrollPosition, clamping); 67 67 } 68 68 -
trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeOverflowScrollingNodeNicosia.h
r250489 r255037 45 45 void commitStateAfterChildren(const ScrollingStateNode&) override; 46 46 47 FloatPoint adjustedScrollPosition(const FloatPoint&, Scroll PositionClamp) const override;47 FloatPoint adjustedScrollPosition(const FloatPoint&, ScrollClamping) const override; 48 48 49 49 void repositionScrollingLayers() override; -
trunk/Source/WebCore/platform/ScrollTypes.h
r254890 r255037 29 29 #include <wtf/Assertions.h> 30 30 31 namespace WTF { 32 class TextStream; 33 } 34 31 35 namespace WebCore { 32 36 … … 48 52 ScrollInlineDirectionBackward, 49 53 ScrollInlineDirectionForward 50 };51 52 enum class ScrollPositionClamp : uint8_t {53 None,54 ToContentEdges,55 54 }; 56 55 … … 230 229 using ScrollingNodeID = uint64_t; 231 230 231 WEBCORE_EXPORT WTF::TextStream& operator<<(WTF::TextStream&, ScrollType); 232 WEBCORE_EXPORT WTF::TextStream& operator<<(WTF::TextStream&, ScrollClamping); 233 232 234 } // namespace WebCore -
trunk/Source/WebCore/platform/ScrollView.cpp
r254890 r255037 212 212 } 213 213 214 void ScrollView::setContentsScrollPosition(const IntPoint& position )214 void ScrollView::setContentsScrollPosition(const IntPoint& position, ScrollClamping clamping) 215 215 { 216 216 #if PLATFORM(IOS_FAMILY) … … 218 218 setActualScrollPosition(position); 219 219 #endif 220 setScrollPosition(position );220 setScrollPosition(position, clamping); 221 221 } 222 222 … … 519 519 } 520 520 521 void ScrollView::setScrollPosition(const ScrollPosition& scrollPosition )521 void ScrollView::setScrollPosition(const ScrollPosition& scrollPosition, ScrollClamping clamping) 522 522 { 523 523 LOG_WITH_STREAM(Scrolling, stream << "ScrollView::setScrollPosition " << scrollPosition); … … 531 531 } 532 532 533 ScrollPosition newScrollPosition = !delegatesScrolling() ? adjustScrollPositionWithinRange(scrollPosition) : scrollPosition;533 ScrollPosition newScrollPosition = (!delegatesScrolling() && clamping == ScrollClamping::Clamped) ? adjustScrollPositionWithinRange(scrollPosition) : scrollPosition; 534 534 535 535 if ((!delegatesScrolling() || currentScrollType() == ScrollType::User) && newScrollPosition == this->scrollPosition()) 536 536 return; 537 537 538 if (requestScrollPositionUpdate(newScrollPosition ))538 if (requestScrollPositionUpdate(newScrollPosition, currentScrollType(), clamping)) 539 539 return; 540 540 -
trunk/Source/WebCore/platform/ScrollView.h
r254890 r255037 235 235 // Scroll position used by web-exposed features (has legacy iOS behavior). 236 236 WEBCORE_EXPORT IntPoint contentsScrollPosition() const; 237 void setContentsScrollPosition(const IntPoint& );237 void setContentsScrollPosition(const IntPoint&, ScrollClamping = ScrollClamping::Clamped); 238 238 239 239 #if PLATFORM(IOS_FAMILY) … … 265 265 266 266 // Functions for scrolling the view. 267 virtual void setScrollPosition(const ScrollPosition& );267 virtual void setScrollPosition(const ScrollPosition&, ScrollClamping = ScrollClamping::Clamped); 268 268 void scrollBy(const IntSize& s) { return setScrollPosition(scrollPosition() + s); } 269 269 -
trunk/Source/WebCore/platform/ScrollableArea.cpp
r254890 r255037 228 228 { 229 229 ScrollPosition position = scrollPositionFromOffset(offset); 230 if (requestScrollPositionUpdate(position ))230 if (requestScrollPositionUpdate(position, currentScrollType())) 231 231 return; 232 232 -
trunk/Source/WebCore/platform/ScrollableArea.h
r254890 r255037 74 74 // returns true, the scrollable area won't actually update the scroll position and instead 75 75 // expect it to happen sometime in the future. 76 virtual bool requestScrollPositionUpdate(const ScrollPosition& ) { return false; }76 virtual bool requestScrollPositionUpdate(const ScrollPosition&, ScrollType = ScrollType::User, ScrollClamping = ScrollClamping::Clamped) { return false; } 77 77 78 78 WEBCORE_EXPORT bool handleWheelEvent(const PlatformWheelEvent&); -
trunk/Source/WebCore/rendering/RenderLayer.cpp
r254893 r255037 2609 2609 #if ENABLE(ASYNC_SCROLLING) 2610 2610 if (ScrollingCoordinator* scrollingCoordinator = page().scrollingCoordinator()) 2611 handled = scrollingCoordinator->requestScrollPositionUpdate(*this, scrollPositionFromOffset(clampedScrollOffset) );2611 handled = scrollingCoordinator->requestScrollPositionUpdate(*this, scrollPositionFromOffset(clampedScrollOffset), scrollType, clamping); 2612 2612 #endif 2613 2613 -
trunk/Source/WebCore/testing/Internals.cpp
r254995 r255037 1773 1773 1774 1774 element.scrollTo({ x, y }, ScrollClamping::Unclamped); 1775 1776 auto& frameView = *document->view(); 1777 frameView.setViewportConstrainedObjectsNeedLayout(); 1778 1775 1779 return { }; 1776 1780 } -
trunk/Source/WebKit/ChangeLog
r254999 r255037 391 391 * WebProcess/Cache/WebCacheStorageConnection.cpp: 392 392 (WebKit::WebCacheStorageConnection::updateQuotaBasedOnSpaceUsage): 393 394 2020-01-22 Simon Fraser <simon.fraser@apple.com> 395 396 Fixed elements no longer stay fixed with elastic overscroll 397 https://bugs.webkit.org/show_bug.cgi?id=206227 398 rdar://problem/58707084 399 400 Reviewed by Antti Koivisto. 401 402 Intended behavior on iOS and macOS is for position:fixed and sticky elements to maintain 403 their position relative to the view bounds when rubber-banding ("overscrolling"). This broke 404 some time back. This change restores the correct behavior with the call to layoutViewportRespectingRubberBanding() 405 in ScrollingTreeFixedNode::applyLayerPositions() and ScrollingTreeStickyNode::computeLayerPosition(). 406 layoutViewportRespectingRubberBanding() computes a layout viewport without clamping. 407 408 The rest of the changes are to support testing. internals.unconstrainedScrollTo() 409 didn't work for main frame scrolling because of scroll position clamping in various places, 410 so propagate ScrollClamping in more places (and replace the redundant ScrollPositionClamp with ScrollClamping). 411 412 "requested scroll position" updates now carry along both clamping and "is programmatic" data, wrapped in a struct 413 which is passed around the scrolling tree. This allows us to not clamp the scroll position (for testing) in more places. 414 415 * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp: 416 (ArgumentCoder<ScrollingStateScrollingNode>::encode): 417 (ArgumentCoder<ScrollingStateScrollingNode>::decode): 418 (ArgumentCoder<RequestedScrollData>::encode): 419 (ArgumentCoder<RequestedScrollData>::decode): 420 (WebKit::dump): 421 * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp: 422 (WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeNodeRequestsScroll): 423 * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h: 424 * UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp: 425 (WebKit::RemoteScrollingTree::scrollingTreeNodeRequestsScroll): 426 * UIProcess/RemoteLayerTree/RemoteScrollingTree.h: 427 * UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm: 428 (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::commitStateAfterChildren): 429 * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm: 430 (WebKit::ScrollingTreeScrollingNodeDelegateIOS::commitStateAfterChildren): 393 431 394 432 2020-01-21 Daniel Bates <dabates@apple.com> -
trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp
r254311 r255037 33 33 #include "WebCoreArgumentCoders.h" 34 34 #include <WebCore/GraphicsLayer.h> 35 #include <WebCore/ScrollTypes.h> 35 36 #include <WebCore/ScrollingStateFixedNode.h> 36 37 #include <WebCore/ScrollingStateFrameHostingNode.h> … … 91 92 static void encode(Encoder&, const ScrollingStatePositionedNode&); 92 93 static bool decode(Decoder&, ScrollingStatePositionedNode&); 94 }; 95 96 template<> struct ArgumentCoder<RequestedScrollData> { 97 static void encode(Encoder&, const RequestedScrollData&); 98 static bool decode(Decoder&, RequestedScrollData&); 93 99 }; 94 100 … … 152 158 #endif 153 159 SCROLLING_NODE_ENCODE(ScrollingStateScrollingNode::ScrollableAreaParams, scrollableAreaParameters) 154 SCROLLING_NODE_ENCODE(ScrollingStateScrollingNode::RequestedScrollPosition, requestedScrollPosition) 155 SCROLLING_NODE_ENCODE(ScrollingStateScrollingNode::RequestedScrollPosition, requestedScrollPositionRepresentsProgrammaticScroll) 160 SCROLLING_NODE_ENCODE(ScrollingStateScrollingNode::RequestedScrollPosition, requestedScrollData) 156 161 157 162 if (node.hasChangedProperty(ScrollingStateScrollingNode::ScrollContainerLayer)) … … 252 257 #endif 253 258 SCROLLING_NODE_DECODE(ScrollingStateScrollingNode::ScrollableAreaParams, ScrollableAreaParameters, setScrollableAreaParameters); 254 255 if (node.hasChangedProperty(ScrollingStateScrollingNode::RequestedScrollPosition)) { 256 FloatPoint scrollPosition; 257 if (!decoder.decode(scrollPosition)) 258 return false; 259 260 bool representsProgrammaticScroll; 261 if (!decoder.decode(representsProgrammaticScroll)) 262 return false; 263 264 node.setRequestedScrollPosition(scrollPosition, representsProgrammaticScroll); 265 } 259 SCROLLING_NODE_DECODE(ScrollingStateScrollingNode::RequestedScrollPosition, RequestedScrollData, setRequestedScrollData); 266 260 267 261 if (node.hasChangedProperty(ScrollingStateScrollingNode::ScrollContainerLayer)) { … … 447 441 node.updateConstraints(decodedValue); 448 442 } 443 444 return true; 445 } 446 447 448 void ArgumentCoder<RequestedScrollData>::encode(Encoder& encoder, const RequestedScrollData& scrollData) 449 { 450 encoder << scrollData.scrollPosition; 451 encoder.encodeEnum(scrollData.scrollType); 452 encoder.encodeEnum(scrollData.clamping); 453 } 454 455 bool ArgumentCoder<RequestedScrollData>::decode(Decoder& decoder, RequestedScrollData& scrollData) 456 { 457 if (!decoder.decode(scrollData.scrollPosition)) 458 return false; 459 460 if (!decoder.decodeEnum(scrollData.scrollType)) 461 return false; 462 463 if (!decoder.decodeEnum(scrollData.clamping)) 464 return false; 449 465 450 466 return true; … … 608 624 609 625 if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStateScrollingNode::RequestedScrollPosition)) { 610 ts.dumpProperty("requested-scroll-position", node.requestedScrollPosition()); 611 ts.dumpProperty("requested-scroll-position-is-programatic", node.requestedScrollPositionRepresentsProgrammaticScroll()); 626 const auto& requestedScrollData = node.requestedScrollData(); 627 ts.dumpProperty("requested-scroll-position", requestedScrollData.scrollPosition); 628 ts.dumpProperty("requested-scroll-position-is-programatic", requestedScrollData.scrollType); 629 ts.dumpProperty("requested-scroll-position-clamping", requestedScrollData.clamping); 612 630 } 613 631 -
trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp
r254311 r255037 229 229 } 230 230 231 void RemoteScrollingCoordinatorProxy::scrollingTreeNodeRequestsScroll(ScrollingNodeID scrolledNodeID, const FloatPoint& scrollPosition, bool representsProgrammaticScroll)231 void RemoteScrollingCoordinatorProxy::scrollingTreeNodeRequestsScroll(ScrollingNodeID scrolledNodeID, const FloatPoint& scrollPosition, ScrollType scrollType, ScrollClamping) 232 232 { 233 233 if (scrolledNodeID == rootScrollingNodeID() && m_requestedScrollInfo) { 234 234 m_requestedScrollInfo->requestsScrollPositionUpdate = true; 235 m_requestedScrollInfo->requestIsProgrammaticScroll = representsProgrammaticScroll;235 m_requestedScrollInfo->requestIsProgrammaticScroll = scrollType == ScrollType::Programmatic; 236 236 m_requestedScrollInfo->requestedScrollPosition = scrollPosition; 237 237 } -
trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h
r254311 r255037 58 58 // Inform the web process that the scroll position changed (called from the scrolling tree) 59 59 void scrollingTreeNodeDidScroll(WebCore::ScrollingNodeID, const WebCore::FloatPoint& newScrollPosition, const Optional<WebCore::FloatPoint>& layoutViewportOrigin, WebCore::ScrollingLayerPositionAction); 60 void scrollingTreeNodeRequestsScroll(WebCore::ScrollingNodeID, const WebCore::FloatPoint& scrollPosition, bool representsProgrammaticScroll);60 void scrollingTreeNodeRequestsScroll(WebCore::ScrollingNodeID, const WebCore::FloatPoint& scrollPosition, WebCore::ScrollType, WebCore::ScrollClamping); 61 61 62 62 WebCore::TrackingType eventTrackingTypeForPoint(const AtomString& eventName, WebCore::IntPoint) const; -
trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp
r254311 r255037 108 108 } 109 109 110 void RemoteScrollingTree::scrollingTreeNodeRequestsScroll(ScrollingNodeID nodeID, const FloatPoint& scrollPosition, bool representsProgrammaticScroll)110 void RemoteScrollingTree::scrollingTreeNodeRequestsScroll(ScrollingNodeID nodeID, const FloatPoint& scrollPosition, ScrollType scrollType, ScrollClamping clamping) 111 111 { 112 m_scrollingCoordinatorProxy.scrollingTreeNodeRequestsScroll(nodeID, scrollPosition, representsProgrammaticScroll);112 m_scrollingCoordinatorProxy.scrollingTreeNodeRequestsScroll(nodeID, scrollPosition, scrollType, clamping); 113 113 } 114 114 -
trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.h
r254311 r255037 53 53 54 54 void scrollingTreeNodeDidScroll(WebCore::ScrollingTreeScrollingNode&, WebCore::ScrollingLayerPositionAction = WebCore::ScrollingLayerPositionAction::Sync) override; 55 void scrollingTreeNodeRequestsScroll(WebCore::ScrollingNodeID, const WebCore::FloatPoint& scrollPosition, bool representsProgrammaticScroll) override;55 void scrollingTreeNodeRequestsScroll(WebCore::ScrollingNodeID, const WebCore::FloatPoint& scrollPosition, WebCore::ScrollType, WebCore::ScrollClamping) override; 56 56 57 57 void currentSnapPointIndicesDidChange(WebCore::ScrollingNodeID, unsigned horizontal, unsigned vertical) override; -
trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm
r250491 r255037 90 90 // Update the scroll position after child nodes have been updated, because they need to have updated their constraints before any scrolling happens. 91 91 if (scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::RequestedScrollPosition)) { 92 auto scrollType = scrollingStateNode.requestedScrollPositionRepresentsProgrammaticScroll() ? ScrollType::Programmatic : ScrollType::User;93 scrollTo( scrollingStateNode.requestedScrollPosition(), scrollType);92 const auto& requestedScrollData = scrollingStateNode.requestedScrollData(); 93 scrollTo(requestedScrollData.scrollPosition, requestedScrollData.scrollType, requestedScrollData.clamping); 94 94 } 95 95 } -
trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm
r250491 r255037 300 300 301 301 if (scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::RequestedScrollPosition)) { 302 auto scrollType = scrollingStateNode.requestedScrollPositionRepresentsProgrammaticScroll() ? ScrollType::Programmatic : ScrollType::User;303 scrollingNode().scrollTo( scrollingStateNode.requestedScrollPosition(), scrollType);302 const auto& requestedScrollData = scrollingStateNode.requestedScrollData(); 303 scrollingNode().scrollTo(requestedScrollData.scrollPosition, requestedScrollData.scrollType, requestedScrollData.clamping); 304 304 } 305 305 }
Note:
See TracChangeset
for help on using the changeset viewer.