Changeset 288777 in webkit
- Timestamp:
- Jan 28, 2022 6:56:40 PM (6 months ago)
- Location:
- trunk
- Files:
-
- 9 added
- 8 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/fast/scrolling/mac/async-overscroll-behavior-element-expected.txt (added)
-
LayoutTests/fast/scrolling/mac/async-overscroll-behavior-element.html (added)
-
LayoutTests/fast/scrolling/mac/async-overscroll-behavior-iframe-expected.txt (added)
-
LayoutTests/fast/scrolling/mac/async-overscroll-behavior-iframe.html (added)
-
LayoutTests/fast/scrolling/mac/async-overscroll-behavior-unscrollable-element-expected.txt (added)
-
LayoutTests/fast/scrolling/mac/async-overscroll-behavior-unscrollable-element.html (added)
-
LayoutTests/fast/scrolling/mac/async-overscroll-behavior-unscrollable-iframe-expected.txt (added)
-
LayoutTests/fast/scrolling/mac/async-overscroll-behavior-unscrollable-iframe.html (added)
-
LayoutTests/fast/scrolling/resources/overscroll-behavior-support.js (added)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp (modified) (1 diff)
-
Source/WebCore/page/scrolling/ScrollingTree.cpp (modified) (3 diffs)
-
Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp (modified) (4 diffs)
-
Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h (modified) (1 diff)
-
Source/WebCore/rendering/RenderLayerCompositor.cpp (modified) (2 diffs)
-
Source/WebCore/rendering/style/RenderStyle.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r288775 r288777 1 2022-01-28 Nikolaos Mouchtaris <nmouchtaris@apple.com> 2 3 Implement CSS overscroll-behavior for asynchronous scroll on Mac 4 https://bugs.webkit.org/show_bug.cgi?id=220139 5 6 Reviewed by Simon Fraser. 7 8 * fast/scrolling/mac/async-overscroll-behavior-element-expected.txt: Added. 9 * fast/scrolling/mac/async-overscroll-behavior-element.html: Added. 10 * fast/scrolling/mac/async-overscroll-behavior-iframe-expected.txt: Added. 11 * fast/scrolling/mac/async-overscroll-behavior-iframe.html: Added. 12 * fast/scrolling/mac/async-overscroll-behavior-unscrollable-element-expected.txt: Added. 13 * fast/scrolling/mac/async-overscroll-behavior-unscrollable-element.html: Added. 14 * fast/scrolling/mac/async-overscroll-behavior-unscrollable-iframe-expected.txt: Added. 15 * fast/scrolling/mac/async-overscroll-behavior-unscrollable-iframe.html: Added. 16 * fast/scrolling/resources/overscroll-behavior-support.js: Added. 17 (getDeltas): 18 (async mouseWheelScrollAndWait): 19 1 20 2022-01-28 Robert Jenner <Jenner@apple.com> 2 21 -
trunk/Source/WebCore/ChangeLog
r288774 r288777 1 2022-01-28 Nikolaos Mouchtaris <nmouchtaris@apple.com> 2 3 Implement CSS overscroll-behavior for asynchronous scroll on Mac 4 https://bugs.webkit.org/show_bug.cgi?id=220139 5 6 Reviewed by Simon Fraser. 7 8 Split up patch by Cathie Chen and Frederic Wang. Add function for blocking scroll chaining 9 and filtering scroll delta depending on the values of overscroll behavior for a scrolling 10 node. This patch is for asynchronous scrolling only. 11 12 Tests: fast/scrolling/mac/async-overscroll-behavior-element.html 13 fast/scrolling/mac/async-overscroll-behavior-iframe.html 14 fast/scrolling/mac/async-overscroll-behavior-unscrollable-element.html 15 fast/scrolling/mac/async-overscroll-behavior-unscrollable-iframe.html 16 17 * page/scrolling/ScrollingTree.cpp: 18 (WebCore::ScrollingTree::shouldBlockScrollChainingWithNode): 19 (WebCore::ScrollingTree::handleWheelEventWithNode): 20 * page/scrolling/ScrollingTree.h: 21 * page/scrolling/ScrollingTreeScrollingNode.h: 22 * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: 23 (WebCore::ScrollingTreeScrollingNodeDelegateMac::allowsHorizontalStretching const): 24 (WebCore::ScrollingTreeScrollingNodeDelegateMac::allowsVerticalStretching const): 25 * rendering/RenderLayerCompositor.cpp: 26 (WebCore::recompositeChangeRequiresGeometryUpdate): 27 (WebCore::RenderLayerCompositor::rootOrBodyStyleChanged): 28 * rendering/style/RenderStyle.cpp: 29 (WebCore::RenderStyle::changeRequiresRecompositeLayer const): 30 1 31 2022-01-28 Tyler Wilcock <tyler_w@apple.com> 2 32 -
trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp
r286351 r288777 788 788 789 789 ScrollableAreaParameters scrollParameters; 790 scrollParameters.horizontalScrollElasticity = scrollableArea.horizontal ScrollElasticity();791 scrollParameters.verticalScrollElasticity = scrollableArea.vertical ScrollElasticity();790 scrollParameters.horizontalScrollElasticity = scrollableArea.horizontalOverscrollBehavior() == OverscrollBehavior::None ? ScrollElasticity::None : scrollableArea.horizontalScrollElasticity(); 791 scrollParameters.verticalScrollElasticity = scrollableArea.verticalOverscrollBehavior() == OverscrollBehavior::None ? ScrollElasticity::None : scrollableArea.verticalScrollElasticity(); 792 792 scrollParameters.allowsHorizontalScrolling = scrollableArea.allowsHorizontalScrolling(); 793 793 scrollParameters.allowsVerticalScrolling = scrollableArea.allowsVerticalScrolling(); -
trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp
r286411 r288777 32 32 #include "Logging.h" 33 33 #include "PlatformWheelEvent.h" 34 #include "ScrollingEffectsController.h" 34 35 #include "ScrollingStateFrameScrollingNode.h" 35 36 #include "ScrollingStateTree.h" … … 202 203 WheelEventHandlingResult ScrollingTree::handleWheelEventWithNode(const PlatformWheelEvent& wheelEvent, OptionSet<WheelEventProcessingSteps> processingSteps, ScrollingTreeNode* node, EventTargeting eventTargeting) 203 204 { 205 auto adjustedWheelEvent = wheelEvent; 204 206 while (node) { 205 207 if (is<ScrollingTreeScrollingNode>(*node)) { 206 208 auto& scrollingNode = downcast<ScrollingTreeScrollingNode>(*node); 207 auto result = scrollingNode.handleWheelEvent( wheelEvent, eventTargeting);209 auto result = scrollingNode.handleWheelEvent(adjustedWheelEvent, eventTargeting); 208 210 209 211 if (result.wasHandled) { 210 m_latchingController.nodeDidHandleEvent(scrollingNode.scrollingNodeID(), processingSteps, wheelEvent, m_allowLatching);211 m_gestureState.nodeDidHandleEvent(scrollingNode.scrollingNodeID(), wheelEvent);212 m_latchingController.nodeDidHandleEvent(scrollingNode.scrollingNodeID(), processingSteps, adjustedWheelEvent, m_allowLatching); 213 m_gestureState.nodeDidHandleEvent(scrollingNode.scrollingNodeID(), adjustedWheelEvent); 212 214 return result; 213 215 } … … 215 217 if (result.needsMainThreadProcessing() || eventTargeting != EventTargeting::Propagate) 216 218 return result; 219 220 if (scrollingNode.shouldBlockScrollPropagation(adjustedWheelEvent.delta())) { 221 m_latchingController.nodeDidHandleEvent(scrollingNode.scrollingNodeID(), processingSteps, adjustedWheelEvent, m_allowLatching); 222 m_gestureState.nodeDidHandleEvent(scrollingNode.scrollingNodeID(), adjustedWheelEvent); 223 return WheelEventHandlingResult::handled(); 224 } 225 adjustedWheelEvent = scrollingNode.eventForPropagation(adjustedWheelEvent); 217 226 } 218 227 -
trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp
r287739 r288777 33 33 #include "ScrollingStateFrameScrollingNode.h" 34 34 #endif 35 #include "ScrollingEffectsController.h" 35 36 #include "ScrollingStateScrollingNode.h" 36 37 #include "ScrollingStateTree.h" … … 122 123 } 123 124 125 bool ScrollingTreeScrollingNode::shouldRubberBand(const PlatformWheelEvent& wheelEvent, EventTargeting eventTargeting) const 126 { 127 // We always rubber-band the latched node, or the root node. 128 // The stateless wheel event doesn't trigger rubber-band. 129 // Also rubberband when we should block scroll propagation 130 // at this node, which has overscroll behavior that is not none. 131 return (isLatchedNode() || eventTargeting == EventTargeting::NodeOnly || (isRootNode() && !wheelEvent.isNonGestureEvent()) || (shouldBlockScrollPropagation(wheelEvent.delta()) && overscrollBehaviorAllowRubberBand())); 132 } 133 124 134 bool ScrollingTreeScrollingNode::canHandleWheelEvent(const PlatformWheelEvent& wheelEvent, EventTargeting eventTargeting) const 125 135 { … … 131 141 return true; 132 142 133 // We always rubber-band the latched node, or the root node. 134 // The stateless wheel event doesn't trigger rubber-band. 135 if (isLatchedNode() || eventTargeting == EventTargeting::NodeOnly || (isRootNode() && !wheelEvent.isNonGestureEvent())) 143 if (shouldRubberBand(wheelEvent, eventTargeting)) 136 144 return true; 137 145 … … 393 401 } 394 402 403 PlatformWheelEvent ScrollingTreeScrollingNode::eventForPropagation(const PlatformWheelEvent& wheelEvent) const 404 { 405 auto filteredDelta = wheelEvent.delta(); 406 #if PLATFORM(MAC) 407 auto biasedDelta = ScrollingEffectsController::wheelDeltaBiasingTowardsVertical(wheelEvent); 408 #else 409 auto biasedDelta = wheelEvent.delta(); 410 #endif 411 if (horizontalOverscrollBehaviorPreventsPropagation() || verticalOverscrollBehaviorPreventsPropagation()) { 412 if(horizontalOverscrollBehaviorPreventsPropagation() || (verticalOverscrollBehaviorPreventsPropagation() && !biasedDelta.width())) 413 filteredDelta.setWidth(0); 414 if(verticalOverscrollBehaviorPreventsPropagation() || (horizontalOverscrollBehaviorPreventsPropagation() && !biasedDelta.height())) 415 filteredDelta.setHeight(0); 416 return wheelEvent.copyWithDeltaAndVelocity(filteredDelta, wheelEvent.scrollingVelocity()); 417 } 418 return wheelEvent; 419 } 420 421 bool ScrollingTreeScrollingNode::shouldBlockScrollPropagation(const FloatSize& delta) const 422 { 423 return ((horizontalOverscrollBehaviorPreventsPropagation() || verticalOverscrollBehaviorPreventsPropagation()) && ((horizontalOverscrollBehaviorPreventsPropagation() && verticalOverscrollBehaviorPreventsPropagation()) || (horizontalOverscrollBehaviorPreventsPropagation() && !delta.height()) || (verticalOverscrollBehaviorPreventsPropagation() && !delta.width()))); 424 } 425 395 426 } // namespace WebCore 396 427 -
trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h
r287739 r288777 160 160 bool allowsHorizontalScrolling() const { return m_scrollableAreaParameters.allowsHorizontalScrolling; } 161 161 bool allowsVerticalScrolling() const { return m_scrollableAreaParameters.allowsVerticalScrolling; } 162 162 OverscrollBehavior horizontalOverscrollBehavior() const { return m_scrollableAreaParameters.horizontalOverscrollBehavior; } 163 OverscrollBehavior verticalOverscrollBehavior() const { return m_scrollableAreaParameters.verticalOverscrollBehavior; } 164 bool horizontalOverscrollBehaviorPreventsPropagation() const { return m_scrollableAreaParameters.horizontalOverscrollBehavior != OverscrollBehavior::Auto; } 165 bool verticalOverscrollBehaviorPreventsPropagation() const { return m_scrollableAreaParameters.verticalOverscrollBehavior != OverscrollBehavior::Auto; } 166 PlatformWheelEvent eventForPropagation(const PlatformWheelEvent&) const; 167 bool shouldBlockScrollPropagation(const FloatSize&) const; 168 bool overscrollBehaviorAllowRubberBand() const { return m_scrollableAreaParameters.horizontalOverscrollBehavior != OverscrollBehavior::None || m_scrollableAreaParameters.verticalOverscrollBehavior != OverscrollBehavior::None; } 169 bool shouldRubberBand(const PlatformWheelEvent&, EventTargeting) const; 163 170 void dumpProperties(WTF::TextStream&, OptionSet<ScrollingStateTreeAsTextBehavior>) const override; 164 171 -
trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp
r288067 r288777 1652 1652 || oldStyle.offsetDistance() != newStyle.offsetDistance() 1653 1653 || oldStyle.offsetRotate() != newStyle.offsetRotate() 1654 || !arePointingToEqualData(oldStyle.clipPath(), newStyle.clipPath()); 1654 || !arePointingToEqualData(oldStyle.clipPath(), newStyle.clipPath()) 1655 || oldStyle.overscrollBehaviorX() != newStyle.overscrollBehaviorX() 1656 || oldStyle.overscrollBehaviorY() != newStyle.overscrollBehaviorY(); 1655 1657 } 1656 1658 … … 3945 3947 if (hadFixedBackground != renderer.style().hasEntirelyFixedBackground()) 3946 3948 rootLayerConfigurationChanged(); 3949 3950 if (oldStyle && (oldStyle->overscrollBehaviorX() != renderer.style().overscrollBehaviorX() || oldStyle->overscrollBehaviorY() != renderer.style().overscrollBehaviorY())) { 3951 if (auto* layer = m_renderView.layer()) 3952 layer->setNeedsCompositingGeometryUpdate(); 3953 } 3947 3954 } 3948 3955 -
trunk/Source/WebCore/rendering/style/RenderStyle.cpp
r288627 r288777 1190 1190 || m_rareNonInheritedData->perspective != other.m_rareNonInheritedData->perspective 1191 1191 || m_rareNonInheritedData->perspectiveOriginX != other.m_rareNonInheritedData->perspectiveOriginX 1192 || m_rareNonInheritedData->perspectiveOriginY != other.m_rareNonInheritedData->perspectiveOriginY) 1192 || m_rareNonInheritedData->perspectiveOriginY != other.m_rareNonInheritedData->perspectiveOriginY 1193 || m_rareNonInheritedData->overscrollBehaviorX != other.m_rareNonInheritedData->overscrollBehaviorX 1194 || m_rareNonInheritedData->overscrollBehaviorY != other.m_rareNonInheritedData->overscrollBehaviorY) 1193 1195 return true; 1194 1196 }
Note: See TracChangeset
for help on using the changeset viewer.