Changeset 267673 in webkit
- Timestamp:
- Sep 27, 2020, 1:00:14 PM (6 years ago)
- Location:
- branches/safari-610-branch/Source
- Files:
-
- 20 edited
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/page/FrameView.cpp (modified) (1 diff)
-
WebCore/page/scrolling/AsyncScrollingCoordinator.cpp (modified) (1 diff)
-
WebCore/page/scrolling/AsyncScrollingCoordinator.h (modified) (1 diff)
-
WebCore/page/scrolling/ScrollingCoordinator.h (modified) (1 diff)
-
WebCore/page/scrolling/ScrollingTree.cpp (modified) (1 diff)
-
WebCore/page/scrolling/ScrollingTree.h (modified) (2 diffs)
-
WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp (modified) (1 diff)
-
WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm (modified) (2 diffs)
-
WebCore/page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h (modified) (1 diff)
-
WebCore/page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm (modified) (1 diff)
-
WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h (modified) (3 diffs)
-
WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm (modified) (2 diffs)
-
WebCore/platform/ScrollAnimator.cpp (modified) (1 diff)
-
WebCore/platform/cocoa/ScrollController.h (modified) (4 diffs)
-
WebCore/platform/cocoa/ScrollController.mm (modified) (9 diffs)
-
WebCore/rendering/RenderLayer.cpp (modified) (2 diffs)
-
WebKit/ChangeLog (modified) (1 diff)
-
WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.h (modified) (2 diffs)
-
WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.mm (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-610-branch/Source/WebCore/ChangeLog
r267672 r267673 1 2020-09-27 Alan Coon <alancoon@apple.com> 2 3 Cherry-pick r267002. rdar://problem/69594199 4 5 Overflow:scroll rubberbanding is interrupted by post-layout scrolling 6 https://bugs.webkit.org/show_bug.cgi?id=216463 7 <rdar://problem/67095741> 8 9 Reviewed by Darin Adler. 10 11 When rubberbanding overflow:scroll RenderLayer has an overscrolled scroll offset. 12 If RenderLayer::updateScrollInfoAfterLayout() happens when in this state, it can 13 clamp the scroll offset, causing the rubberband to collapse which interferes with 14 the user interaction. This happend on Gmail when composing a reply. 15 16 Fix by tracking the rubberbanding state in the scrolling tree, and having RenderLayer 17 query this state via the ScrollingCoordinator. RenderLayer::updateScrollInfoAfterLayout() 18 already tested isRubberBandInProgress(). This is similar to how isUserScrollInProgress() 19 and isScrollSnapInProgress() work. 20 21 This patch also fixes the tracking of rubberbanding state. Previously setMainFrameIsRubberBanding() 22 was just based on when the timer was started and stopped, which did not match the 23 implementation of ScrollController::isRubberBandInProgress(). Now ScrollController 24 correctly notifies its clients when the rubberbanding state changes by updating that 25 state whenever any of the conditions consulted in isRubberBandInProgressInternal() change. 26 27 Source/WebCore: 28 29 I tried to make tests for this, but the timing of wheel and scroll event delivery makes 30 reliable detection of interrupted rubberbands impossible in WebKitTestRunner. 31 32 * page/FrameView.cpp: 33 (WebCore::FrameView::isRubberBandInProgress const): 34 * page/scrolling/AsyncScrollingCoordinator.cpp: 35 (WebCore::AsyncScrollingCoordinator::isRubberBandInProgress const): 36 * page/scrolling/AsyncScrollingCoordinator.h: 37 * page/scrolling/ScrollingCoordinator.h: 38 (WebCore::ScrollingCoordinator::isRubberBandInProgress const): 39 * page/scrolling/ScrollingTree.cpp: 40 (WebCore::ScrollingTree::isRubberBandInProgressForNode): 41 (WebCore::ScrollingTree::setRubberBandingInProgressForNode): 42 (WebCore::ScrollingTree::isRubberBandInProgress): Deleted. 43 (WebCore::ScrollingTree::setMainFrameIsRubberBanding): Deleted. 44 * page/scrolling/ScrollingTree.h: 45 * page/scrolling/ScrollingTreeScrollingNode.cpp: 46 (WebCore::ScrollingTreeScrollingNode::commitStateBeforeChildren): 47 * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm: 48 (WebCore::ScrollingTreeFrameScrollingNodeMac::currentScrollPositionChanged): 49 (WebCore::ScrollingTreeFrameScrollingNodeMac::updateMainFramePinAndRubberbandState): 50 * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h: 51 * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm: 52 (WebCore::ScrollingTreeOverflowScrollingNodeMac::currentScrollPositionChanged): 53 * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h: 54 * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: 55 (WebCore::ScrollingTreeScrollingNodeDelegateMac::currentScrollPositionChanged): 56 (WebCore::ScrollingTreeScrollingNodeDelegateMac::isRubberBandInProgress const): 57 (WebCore::ScrollingTreeScrollingNodeDelegateMac::didStopRubberbandSnapAnimation): 58 (WebCore::ScrollingTreeScrollingNodeDelegateMac::rubberBandingStateChanged): 59 * platform/ScrollAnimator.cpp: 60 (WebCore::ScrollAnimator::notifyPositionChanged): 61 * platform/cocoa/ScrollController.h: 62 (WebCore::ScrollControllerClient::rubberBandingStateChanged): 63 * platform/cocoa/ScrollController.mm: 64 (WebCore::ScrollController::handleWheelEvent): 65 (WebCore::ScrollController::snapRubberBandTimerFired): 66 (WebCore::ScrollController::scrollPositionChanged): 67 (WebCore::ScrollController::isRubberBandInProgress const): 68 (WebCore::ScrollController::stopSnapRubberbandTimer): 69 (WebCore::ScrollController::isRubberBandInProgressInternal const): 70 (WebCore::ScrollController::updateRubberBandingState): 71 (WebCore::ScrollController::updateGestureInProgressState): 72 * rendering/RenderLayer.cpp: 73 (WebCore::RenderLayer::isRubberBandInProgress const): 74 (WebCore::RenderLayer::updateScrollInfoAfterLayout): 75 76 Source/WebKit: 77 78 * WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.h: 79 * WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.mm: 80 (WebKit::RemoteScrollingCoordinator::isRubberBandInProgress const): 81 (WebKit::RemoteScrollingCoordinator::scrollingStateInUIProcessChanged): 82 83 84 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267002 268f45cc-cd09-0410-ab3c-d52691b4dbfc 85 86 2020-09-13 Simon Fraser <simon.fraser@apple.com> 87 88 Overflow:scroll rubberbanding is interrupted by post-layout scrolling 89 https://bugs.webkit.org/show_bug.cgi?id=216463 90 <rdar://problem/67095741> 91 92 Reviewed by Darin Adler. 93 94 When rubberbanding overflow:scroll RenderLayer has an overscrolled scroll offset. 95 If RenderLayer::updateScrollInfoAfterLayout() happens when in this state, it can 96 clamp the scroll offset, causing the rubberband to collapse which interferes with 97 the user interaction. This happend on Gmail when composing a reply. 98 99 Fix by tracking the rubberbanding state in the scrolling tree, and having RenderLayer 100 query this state via the ScrollingCoordinator. RenderLayer::updateScrollInfoAfterLayout() 101 already tested isRubberBandInProgress(). This is similar to how isUserScrollInProgress() 102 and isScrollSnapInProgress() work. 103 104 This patch also fixes the tracking of rubberbanding state. Previously setMainFrameIsRubberBanding() 105 was just based on when the timer was started and stopped, which did not match the 106 implementation of ScrollController::isRubberBandInProgress(). Now ScrollController 107 correctly notifies its clients when the rubberbanding state changes by updating that 108 state whenever any of the conditions consulted in isRubberBandInProgressInternal() change. 109 110 I tried to make tests for this, but the timing of wheel and scroll event delivery makes 111 reliable detection of interrupted rubberbands impossible in WebKitTestRunner. 112 113 * page/FrameView.cpp: 114 (WebCore::FrameView::isRubberBandInProgress const): 115 * page/scrolling/AsyncScrollingCoordinator.cpp: 116 (WebCore::AsyncScrollingCoordinator::isRubberBandInProgress const): 117 * page/scrolling/AsyncScrollingCoordinator.h: 118 * page/scrolling/ScrollingCoordinator.h: 119 (WebCore::ScrollingCoordinator::isRubberBandInProgress const): 120 * page/scrolling/ScrollingTree.cpp: 121 (WebCore::ScrollingTree::isRubberBandInProgressForNode): 122 (WebCore::ScrollingTree::setRubberBandingInProgressForNode): 123 (WebCore::ScrollingTree::isRubberBandInProgress): Deleted. 124 (WebCore::ScrollingTree::setMainFrameIsRubberBanding): Deleted. 125 * page/scrolling/ScrollingTree.h: 126 * page/scrolling/ScrollingTreeScrollingNode.cpp: 127 (WebCore::ScrollingTreeScrollingNode::commitStateBeforeChildren): 128 * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm: 129 (WebCore::ScrollingTreeFrameScrollingNodeMac::currentScrollPositionChanged): 130 (WebCore::ScrollingTreeFrameScrollingNodeMac::updateMainFramePinAndRubberbandState): 131 * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h: 132 * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm: 133 (WebCore::ScrollingTreeOverflowScrollingNodeMac::currentScrollPositionChanged): 134 * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h: 135 * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: 136 (WebCore::ScrollingTreeScrollingNodeDelegateMac::currentScrollPositionChanged): 137 (WebCore::ScrollingTreeScrollingNodeDelegateMac::isRubberBandInProgress const): 138 (WebCore::ScrollingTreeScrollingNodeDelegateMac::didStopRubberbandSnapAnimation): 139 (WebCore::ScrollingTreeScrollingNodeDelegateMac::rubberBandingStateChanged): 140 * platform/ScrollAnimator.cpp: 141 (WebCore::ScrollAnimator::notifyPositionChanged): 142 * platform/cocoa/ScrollController.h: 143 (WebCore::ScrollControllerClient::rubberBandingStateChanged): 144 * platform/cocoa/ScrollController.mm: 145 (WebCore::ScrollController::handleWheelEvent): 146 (WebCore::ScrollController::snapRubberBandTimerFired): 147 (WebCore::ScrollController::scrollPositionChanged): 148 (WebCore::ScrollController::isRubberBandInProgress const): 149 (WebCore::ScrollController::stopSnapRubberbandTimer): 150 (WebCore::ScrollController::isRubberBandInProgressInternal const): 151 (WebCore::ScrollController::updateRubberBandingState): 152 (WebCore::ScrollController::updateGestureInProgressState): 153 * rendering/RenderLayer.cpp: 154 (WebCore::RenderLayer::isRubberBandInProgress const): 155 (WebCore::RenderLayer::updateScrollInfoAfterLayout): 156 1 157 2020-09-27 Alan Coon <alancoon@apple.com> 2 158 -
branches/safari-610-branch/Source/WebCore/page/FrameView.cpp
r266549 r267673 2633 2633 if (auto scrollingCoordinator = this->scrollingCoordinator()) { 2634 2634 if (!scrollingCoordinator->shouldUpdateScrollLayerPositionSynchronously(*this)) 2635 return scrollingCoordinator->isRubberBandInProgress( );2635 return scrollingCoordinator->isRubberBandInProgress(scrollingNodeID()); 2636 2636 } 2637 2637 -
branches/safari-610-branch/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp
r267271 r267673 840 840 } 841 841 842 bool AsyncScrollingCoordinator::isRubberBandInProgress( ) const842 bool AsyncScrollingCoordinator::isRubberBandInProgress(ScrollingNodeID nodeID) const 843 843 { 844 844 if (m_scrollingTree) 845 return m_scrollingTree->isRubberBandInProgress ();845 return m_scrollingTree->isRubberBandInProgressForNode(nodeID); 846 846 847 847 return false; -
branches/safari-610-branch/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h
r267271 r267673 130 130 131 131 WEBCORE_EXPORT bool isUserScrollInProgress(ScrollingNodeID) const override; 132 bool isRubberBandInProgress( ) const override;132 bool isRubberBandInProgress(ScrollingNodeID) const override; 133 133 134 134 #if ENABLE(CSS_SCROLL_SNAP) -
branches/safari-610-branch/Source/WebCore/page/scrolling/ScrollingCoordinator.h
r267271 r267673 171 171 virtual String scrollingStateTreeAsText(ScrollingStateTreeAsTextBehavior = ScrollingStateTreeAsTextBehaviorNormal) const; 172 172 virtual String scrollingTreeAsText(ScrollingStateTreeAsTextBehavior = ScrollingStateTreeAsTextBehaviorNormal) const; 173 virtual bool isRubberBandInProgress( ) const { return false; }173 virtual bool isRubberBandInProgress(ScrollingNodeID) const { return false; } 174 174 virtual bool isUserScrollInProgress(ScrollingNodeID) const { return false; } 175 175 virtual bool isScrollSnapInProgress(ScrollingNodeID) const { return false; } -
branches/safari-610-branch/Source/WebCore/page/scrolling/ScrollingTree.cpp
r266851 r267673 466 466 467 467 // Can be called from the main thread. 468 bool ScrollingTree::isRubberBandInProgress() 469 { 468 bool ScrollingTree::isRubberBandInProgressForNode(ScrollingNodeID nodeID) 469 { 470 if (!nodeID) 471 return false; 472 470 473 LockHolder lock(m_treeStateMutex); 471 return m_treeState. mainFrameIsRubberBanding;472 } 473 474 void ScrollingTree::set MainFrameIsRubberBanding(bool isRubberBanding)474 return m_treeState.nodesWithActiveRubberBanding.contains(nodeID); 475 } 476 477 void ScrollingTree::setRubberBandingInProgressForNode(ScrollingNodeID nodeID, bool isRubberBanding) 475 478 { 476 479 LockHolder locker(m_treeStateMutex); 477 m_treeState.mainFrameIsRubberBanding = isRubberBanding; 480 if (isRubberBanding) 481 m_treeState.nodesWithActiveRubberBanding.add(nodeID); 482 else 483 m_treeState.nodesWithActiveRubberBanding.remove(nodeID); 478 484 } 479 485 -
branches/safari-610-branch/Source/WebCore/page/scrolling/ScrollingTree.h
r266549 r267673 93 93 WEBCORE_EXPORT virtual WheelEventHandlingResult handleWheelEvent(const PlatformWheelEvent&); 94 94 95 void setMainFrameIsRubberBanding(bool);96 bool isRubberBandInProgress();95 bool isRubberBandInProgressForNode(ScrollingNodeID); 96 void setRubberBandingInProgressForNode(ScrollingNodeID, bool); 97 97 98 98 bool isUserScrollInProgressForNode(ScrollingNodeID); … … 258 258 PlatformDisplayID displayID { 0 }; 259 259 Optional<unsigned> nominalFramesPerSecond; 260 HashSet<ScrollingNodeID> nodesWithActiveRubberBanding; 260 261 HashSet<ScrollingNodeID> nodesWithActiveScrollSnap; 261 262 HashSet<ScrollingNodeID> nodesWithActiveUserScrolls; 262 bool mainFrameIsRubberBanding { false };263 263 }; 264 264 -
branches/safari-610-branch/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp
r265820 r267673 55 55 56 56 if (state.hasChangedProperty(ScrollingStateScrollingNode::TotalContentsSize)) { 57 if (scrollingTree().isRubberBandInProgress ())57 if (scrollingTree().isRubberBandInProgressForNode(scrollingNodeID())) 58 58 m_totalContentsSizeForRubberBand = m_totalContentsSize; 59 59 else -
branches/safari-610-branch/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm
r264008 r267673 144 144 LOG_WITH_STREAM(Scrolling, stream << "ScrollingTreeFrameScrollingNodeMac::currentScrollPositionChanged to " << currentScrollPosition() << " min: " << minimumScrollPosition() << " max: " << maximumScrollPosition() << " sync: " << hasSynchronousScrollingReasons()); 145 145 146 m_delegate.currentScrollPositionChanged(); 147 146 148 if (isRootNode()) 147 149 updateMainFramePinAndRubberbandState(); … … 225 227 { 226 228 ASSERT(isRootNode()); 227 228 229 scrollingTree().setMainFramePinnedState(edgePinnedState()); 229 scrollingTree().setMainFrameIsRubberBanding(isRubberBanding());230 230 } 231 231 -
branches/safari-610-branch/Source/WebCore/page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h
r262294 r267673 48 48 FloatPoint adjustedScrollPosition(const FloatPoint&, ScrollClamping) const override; 49 49 50 void currentScrollPositionChanged(ScrollingLayerPositionAction) final; 51 50 52 void repositionScrollingLayers() override; 51 53 void repositionRelatedLayers() override; -
branches/safari-610-branch/Source/WebCore/page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm
r264008 r267673 87 87 } 88 88 89 void ScrollingTreeOverflowScrollingNodeMac::currentScrollPositionChanged(ScrollingLayerPositionAction action) 90 { 91 ScrollingTreeOverflowScrollingNode::currentScrollPositionChanged(action); 92 m_delegate.currentScrollPositionChanged(); 93 } 94 89 95 FloatPoint ScrollingTreeOverflowScrollingNodeMac::adjustedScrollPosition(const FloatPoint& position, ScrollClamping clamp) const 90 96 { -
branches/safari-610-branch/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h
r264008 r267673 51 51 52 52 bool handleWheelEvent(const PlatformWheelEvent&); 53 54 void currentScrollPositionChanged(); 53 55 54 56 #if ENABLE(CSS_SCROLL_SNAP) … … 59 61 bool isScrollSnapInProgress() const; 60 62 #endif 63 64 bool isRubberBandInProgress() const; 61 65 62 66 void updateFromStateNode(const ScrollingStateScrollingNode&); … … 81 85 void immediateScrollByWithoutContentEdgeConstraints(const FloatSize&) final; 82 86 void didStopRubberbandSnapAnimation() final; 87 void rubberBandingStateChanged(bool) final; 83 88 void adjustScrollPositionToBoundsIfNecessary() final; 84 89 -
branches/safari-610-branch/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm
r264908 r267673 161 161 } 162 162 163 void ScrollingTreeScrollingNodeDelegateMac::currentScrollPositionChanged() 164 { 165 m_scrollController.scrollPositionChanged(); 166 } 167 168 bool ScrollingTreeScrollingNodeDelegateMac::isRubberBandInProgress() const 169 { 170 return m_scrollController.isRubberBandInProgress(); 171 } 172 163 173 bool ScrollingTreeScrollingNodeDelegateMac::isScrollSnapInProgress() const 164 174 { … … 319 329 void ScrollingTreeScrollingNodeDelegateMac::didStopRubberbandSnapAnimation() 320 330 { 321 scrollingTree().setMainFrameIsRubberBanding(false);322 323 331 // Since the rubberband timer has stopped, totalContentsSizeForRubberBand can be synchronized with totalContentsSize. 324 332 scrollingNode().setTotalContentsSizeForRubberBand(totalContentsSize()); 333 } 334 335 void ScrollingTreeScrollingNodeDelegateMac::rubberBandingStateChanged(bool inRubberBand) 336 { 337 scrollingTree().setRubberBandingInProgressForNode(scrollingNode().scrollingNodeID(), inRubberBand); 325 338 } 326 339 -
branches/safari-610-branch/Source/WebCore/platform/ScrollAnimator.cpp
r264908 r267673 215 215 // FIXME: need to not map back and forth all the time. 216 216 m_scrollableArea.setScrollOffsetFromAnimation(m_scrollableArea.scrollOffsetFromPosition(roundedIntPoint(currentPosition()))); 217 218 #if ENABLE(CSS_SCROLL_SNAP) || ENABLE(RUBBER_BANDING) 219 m_scrollController.scrollPositionChanged(); 220 #endif 217 221 } 218 222 -
branches/safari-610-branch/Source/WebCore/platform/cocoa/ScrollController.h
r264891 r267673 84 84 virtual void immediateScrollBy(const FloatSize&) = 0; 85 85 virtual void immediateScrollByWithoutContentEdgeConstraints(const FloatSize&) = 0; 86 86 87 virtual void willStartRubberBandSnapAnimation() { } 87 88 virtual void didStopRubberbandSnapAnimation() { } 88 89 90 virtual void rubberBandingStateChanged(bool) { } 91 89 92 // If the current scroll position is within the overhang area, this function will cause 90 93 // the page to scroll to the nearest boundary point. … … 143 146 bool isRubberBandInProgress() const; 144 147 bool isScrollSnapInProgress() const; 148 149 void scrollPositionChanged(); 145 150 146 151 #if ENABLE(CSS_SCROLL_SNAP) … … 176 181 bool shouldRubberBandInHorizontalDirection(const PlatformWheelEvent&) const; 177 182 bool shouldRubberBandInDirection(ScrollDirection) const; 183 184 bool isRubberBandInProgressInternal() const; 185 void updateRubberBandingState(); 178 186 #endif 179 187 … … 224 232 bool m_momentumScrollInProgress { false }; 225 233 bool m_ignoreMomentumScrolls { false }; 234 bool m_isRubberBanding { false }; 226 235 #endif 227 236 -
branches/safari-610-branch/Source/WebCore/platform/cocoa/ScrollController.mm
r265545 r267673 149 149 150 150 stopSnapRubberbandTimer(); 151 151 updateRubberBandingState(); 152 152 return true; 153 153 } … … 155 155 if (wheelEvent.phase() == PlatformWheelEventPhaseEnded) { 156 156 snapRubberBand(); 157 updateRubberBandingState(); 157 158 return true; 158 159 } … … 318 319 } 319 320 321 updateRubberBandingState(); 322 320 323 return handled; 321 324 } … … 413 416 m_startStretch = { }; 414 417 m_origVelocity = { }; 418 419 updateRubberBandingState(); 415 420 return; 416 421 } … … 453 458 m_startTime = MonotonicTime::now(); 454 459 m_startStretch = { }; 455 if (!isRubberBandInProgress ())460 if (!isRubberBandInProgressInternal()) 456 461 stopSnapRubberbandTimer(); 457 462 } 458 } 459 #endif 463 464 updateRubberBandingState(); 465 } 466 #endif 467 468 void ScrollController::scrollPositionChanged() 469 { 470 #if ENABLE(RUBBER_BANDING) 471 updateRubberBandingState(); 472 #endif 473 } 460 474 461 475 bool ScrollController::usesScrollSnap() const … … 480 494 { 481 495 #if ENABLE(RUBBER_BANDING) && PLATFORM(MAC) 482 if (!m_inScrollGesture && !m_momentumScrollInProgress && !m_snapRubberbandTimer) 483 return false; 484 485 return !m_client.stretchAmount().isZero(); 496 return m_isRubberBanding; 486 497 #else 487 498 return false; … … 518 529 { 519 530 m_client.didStopRubberbandSnapAnimation(); 520 531 521 532 if (m_snapRubberbandTimer) { 522 533 m_snapRubberbandTimer->stop(); 523 534 m_snapRubberbandTimer = nullptr; 524 535 } 525 536 526 537 m_client.removeWheelEventTestCompletionDeferralForReason(reinterpret_cast<WheelEventTestMonitor::ScrollableAreaIdentifier>(this), WheelEventTestMonitor::RubberbandInProgress); 527 538 } … … 555 566 { 556 567 return m_client.shouldRubberBandInDirection(direction); 568 } 569 570 bool ScrollController::isRubberBandInProgressInternal() const 571 { 572 if (!m_inScrollGesture && !m_momentumScrollInProgress && !m_snapRubberbandTimer) 573 return false; 574 575 return !m_client.stretchAmount().isZero(); 576 } 577 578 void ScrollController::updateRubberBandingState() 579 { 580 bool isRubberBanding = isRubberBandInProgressInternal(); 581 if (isRubberBanding == m_isRubberBanding) 582 return; 583 584 m_isRubberBanding = isRubberBanding; 585 m_client.rubberBandingStateChanged(m_isRubberBanding); 557 586 } 558 587 … … 718 747 else if (wheelEvent.isEndOfNonMomentumScroll() || wheelEvent.isGestureCancel() || wheelEvent.isEndOfMomentumScroll()) 719 748 m_inScrollGesture = false; 749 750 updateRubberBandingState(); 720 751 } 721 752 -
branches/safari-610-branch/Source/WebCore/rendering/RenderLayer.cpp
r267634 r267673 1911 1911 return false; 1912 1912 1913 if (auto scrollingCoordinator = page().scrollingCoordinator()) { 1914 if (scrollingCoordinator->isRubberBandInProgress(scrollingNodeID())) 1915 return true; 1916 } 1917 1913 1918 if (auto scrollAnimator = existingScrollAnimator()) 1914 1919 return scrollAnimator->isRubberBandInProgress(); … … 3915 3920 #endif 3916 3921 3917 if (!box->isHTMLMarquee() && !isRubberBandInProgress() ) {3922 if (!box->isHTMLMarquee() && !isRubberBandInProgress() && !isUserScrollInProgress()) { 3918 3923 // Layout may cause us to be at an invalid scroll position. In this case we need 3919 3924 // to pull our scroll offsets back to the max (or push them up to the min). -
branches/safari-610-branch/Source/WebKit/ChangeLog
r267672 r267673 1 2020-09-27 Alan Coon <alancoon@apple.com> 2 3 Cherry-pick r267002. rdar://problem/69594199 4 5 Overflow:scroll rubberbanding is interrupted by post-layout scrolling 6 https://bugs.webkit.org/show_bug.cgi?id=216463 7 <rdar://problem/67095741> 8 9 Reviewed by Darin Adler. 10 11 When rubberbanding overflow:scroll RenderLayer has an overscrolled scroll offset. 12 If RenderLayer::updateScrollInfoAfterLayout() happens when in this state, it can 13 clamp the scroll offset, causing the rubberband to collapse which interferes with 14 the user interaction. This happend on Gmail when composing a reply. 15 16 Fix by tracking the rubberbanding state in the scrolling tree, and having RenderLayer 17 query this state via the ScrollingCoordinator. RenderLayer::updateScrollInfoAfterLayout() 18 already tested isRubberBandInProgress(). This is similar to how isUserScrollInProgress() 19 and isScrollSnapInProgress() work. 20 21 This patch also fixes the tracking of rubberbanding state. Previously setMainFrameIsRubberBanding() 22 was just based on when the timer was started and stopped, which did not match the 23 implementation of ScrollController::isRubberBandInProgress(). Now ScrollController 24 correctly notifies its clients when the rubberbanding state changes by updating that 25 state whenever any of the conditions consulted in isRubberBandInProgressInternal() change. 26 27 Source/WebCore: 28 29 I tried to make tests for this, but the timing of wheel and scroll event delivery makes 30 reliable detection of interrupted rubberbands impossible in WebKitTestRunner. 31 32 * page/FrameView.cpp: 33 (WebCore::FrameView::isRubberBandInProgress const): 34 * page/scrolling/AsyncScrollingCoordinator.cpp: 35 (WebCore::AsyncScrollingCoordinator::isRubberBandInProgress const): 36 * page/scrolling/AsyncScrollingCoordinator.h: 37 * page/scrolling/ScrollingCoordinator.h: 38 (WebCore::ScrollingCoordinator::isRubberBandInProgress const): 39 * page/scrolling/ScrollingTree.cpp: 40 (WebCore::ScrollingTree::isRubberBandInProgressForNode): 41 (WebCore::ScrollingTree::setRubberBandingInProgressForNode): 42 (WebCore::ScrollingTree::isRubberBandInProgress): Deleted. 43 (WebCore::ScrollingTree::setMainFrameIsRubberBanding): Deleted. 44 * page/scrolling/ScrollingTree.h: 45 * page/scrolling/ScrollingTreeScrollingNode.cpp: 46 (WebCore::ScrollingTreeScrollingNode::commitStateBeforeChildren): 47 * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm: 48 (WebCore::ScrollingTreeFrameScrollingNodeMac::currentScrollPositionChanged): 49 (WebCore::ScrollingTreeFrameScrollingNodeMac::updateMainFramePinAndRubberbandState): 50 * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h: 51 * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm: 52 (WebCore::ScrollingTreeOverflowScrollingNodeMac::currentScrollPositionChanged): 53 * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h: 54 * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: 55 (WebCore::ScrollingTreeScrollingNodeDelegateMac::currentScrollPositionChanged): 56 (WebCore::ScrollingTreeScrollingNodeDelegateMac::isRubberBandInProgress const): 57 (WebCore::ScrollingTreeScrollingNodeDelegateMac::didStopRubberbandSnapAnimation): 58 (WebCore::ScrollingTreeScrollingNodeDelegateMac::rubberBandingStateChanged): 59 * platform/ScrollAnimator.cpp: 60 (WebCore::ScrollAnimator::notifyPositionChanged): 61 * platform/cocoa/ScrollController.h: 62 (WebCore::ScrollControllerClient::rubberBandingStateChanged): 63 * platform/cocoa/ScrollController.mm: 64 (WebCore::ScrollController::handleWheelEvent): 65 (WebCore::ScrollController::snapRubberBandTimerFired): 66 (WebCore::ScrollController::scrollPositionChanged): 67 (WebCore::ScrollController::isRubberBandInProgress const): 68 (WebCore::ScrollController::stopSnapRubberbandTimer): 69 (WebCore::ScrollController::isRubberBandInProgressInternal const): 70 (WebCore::ScrollController::updateRubberBandingState): 71 (WebCore::ScrollController::updateGestureInProgressState): 72 * rendering/RenderLayer.cpp: 73 (WebCore::RenderLayer::isRubberBandInProgress const): 74 (WebCore::RenderLayer::updateScrollInfoAfterLayout): 75 76 Source/WebKit: 77 78 * WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.h: 79 * WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.mm: 80 (WebKit::RemoteScrollingCoordinator::isRubberBandInProgress const): 81 (WebKit::RemoteScrollingCoordinator::scrollingStateInUIProcessChanged): 82 83 84 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267002 268f45cc-cd09-0410-ab3c-d52691b4dbfc 85 86 2020-09-13 Simon Fraser <simon.fraser@apple.com> 87 88 Overflow:scroll rubberbanding is interrupted by post-layout scrolling 89 https://bugs.webkit.org/show_bug.cgi?id=216463 90 <rdar://problem/67095741> 91 92 Reviewed by Darin Adler. 93 94 When rubberbanding overflow:scroll RenderLayer has an overscrolled scroll offset. 95 If RenderLayer::updateScrollInfoAfterLayout() happens when in this state, it can 96 clamp the scroll offset, causing the rubberband to collapse which interferes with 97 the user interaction. This happend on Gmail when composing a reply. 98 99 Fix by tracking the rubberbanding state in the scrolling tree, and having RenderLayer 100 query this state via the ScrollingCoordinator. RenderLayer::updateScrollInfoAfterLayout() 101 already tested isRubberBandInProgress(). This is similar to how isUserScrollInProgress() 102 and isScrollSnapInProgress() work. 103 104 This patch also fixes the tracking of rubberbanding state. Previously setMainFrameIsRubberBanding() 105 was just based on when the timer was started and stopped, which did not match the 106 implementation of ScrollController::isRubberBandInProgress(). Now ScrollController 107 correctly notifies its clients when the rubberbanding state changes by updating that 108 state whenever any of the conditions consulted in isRubberBandInProgressInternal() change. 109 110 * WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.h: 111 * WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.mm: 112 (WebKit::RemoteScrollingCoordinator::isRubberBandInProgress const): 113 (WebKit::RemoteScrollingCoordinator::scrollingStateInUIProcessChanged): 114 1 115 2020-09-27 Alan Coon <alancoon@apple.com> 2 116 -
branches/safari-610-branch/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.h
r264704 r267673 66 66 void scheduleTreeStateCommit() override; 67 67 68 bool isRubberBandInProgress() const override; 69 68 bool isRubberBandInProgress(WebCore::ScrollingNodeID) const final; 70 69 bool isUserScrollInProgress(WebCore::ScrollingNodeID) const final; 71 70 #if ENABLE(CSS_SCROLL_SNAP) … … 84 83 WebPage* m_webPage; 85 84 85 HashSet<WebCore::ScrollingNodeID> m_nodesWithActiveRubberBanding; 86 86 HashSet<WebCore::ScrollingNodeID> m_nodesWithActiveScrollSnap; 87 87 HashSet<WebCore::ScrollingNodeID> m_nodesWithActiveUserScrolls; -
branches/safari-610-branch/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.mm
r264704 r267673 73 73 } 74 74 75 bool RemoteScrollingCoordinator::isRubberBandInProgress( ) const75 bool RemoteScrollingCoordinator::isRubberBandInProgress(ScrollingNodeID nodeID) const 76 76 { 77 // FIXME: need to maintain state in the web process? 78 return false; 77 return m_nodesWithActiveRubberBanding.contains(nodeID); 79 78 } 80 79 … … 113 112 void RemoteScrollingCoordinator::scrollingStateInUIProcessChanged(const RemoteScrollingUIState& uiState) 114 113 { 114 // FIXME: Also track m_nodesWithActiveRubberBanding. 115 115 if (uiState.changes().contains(RemoteScrollingUIState::Changes::ScrollSnapNodes)) 116 116 m_nodesWithActiveScrollSnap = uiState.nodesWithActiveScrollSnap();
Note:
See TracChangeset
for help on using the changeset viewer.