Diff
Modified: branches/safari-610-branch/Source/WebCore/ChangeLog (267672 => 267673)
--- branches/safari-610-branch/Source/WebCore/ChangeLog 2020-09-27 20:00:09 UTC (rev 267672)
+++ branches/safari-610-branch/Source/WebCore/ChangeLog 2020-09-27 20:00:14 UTC (rev 267673)
@@ -1,5 +1,161 @@
2020-09-27 Alan Coon <[email protected]>
+ Cherry-pick r267002. rdar://problem/69594199
+
+ Overflow:scroll rubberbanding is interrupted by post-layout scrolling
+ https://bugs.webkit.org/show_bug.cgi?id=216463
+ <rdar://problem/67095741>
+
+ Reviewed by Darin Adler.
+
+ When rubberbanding overflow:scroll RenderLayer has an overscrolled scroll offset.
+ If RenderLayer::updateScrollInfoAfterLayout() happens when in this state, it can
+ clamp the scroll offset, causing the rubberband to collapse which interferes with
+ the user interaction. This happend on Gmail when composing a reply.
+
+ Fix by tracking the rubberbanding state in the scrolling tree, and having RenderLayer
+ query this state via the ScrollingCoordinator. RenderLayer::updateScrollInfoAfterLayout()
+ already tested isRubberBandInProgress(). This is similar to how isUserScrollInProgress()
+ and isScrollSnapInProgress() work.
+
+ This patch also fixes the tracking of rubberbanding state. Previously setMainFrameIsRubberBanding()
+ was just based on when the timer was started and stopped, which did not match the
+ implementation of ScrollController::isRubberBandInProgress(). Now ScrollController
+ correctly notifies its clients when the rubberbanding state changes by updating that
+ state whenever any of the conditions consulted in isRubberBandInProgressInternal() change.
+
+ Source/WebCore:
+
+ I tried to make tests for this, but the timing of wheel and scroll event delivery makes
+ reliable detection of interrupted rubberbands impossible in WebKitTestRunner.
+
+ * page/FrameView.cpp:
+ (WebCore::FrameView::isRubberBandInProgress const):
+ * page/scrolling/AsyncScrollingCoordinator.cpp:
+ (WebCore::AsyncScrollingCoordinator::isRubberBandInProgress const):
+ * page/scrolling/AsyncScrollingCoordinator.h:
+ * page/scrolling/ScrollingCoordinator.h:
+ (WebCore::ScrollingCoordinator::isRubberBandInProgress const):
+ * page/scrolling/ScrollingTree.cpp:
+ (WebCore::ScrollingTree::isRubberBandInProgressForNode):
+ (WebCore::ScrollingTree::setRubberBandingInProgressForNode):
+ (WebCore::ScrollingTree::isRubberBandInProgress): Deleted.
+ (WebCore::ScrollingTree::setMainFrameIsRubberBanding): Deleted.
+ * page/scrolling/ScrollingTree.h:
+ * page/scrolling/ScrollingTreeScrollingNode.cpp:
+ (WebCore::ScrollingTreeScrollingNode::commitStateBeforeChildren):
+ * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
+ (WebCore::ScrollingTreeFrameScrollingNodeMac::currentScrollPositionChanged):
+ (WebCore::ScrollingTreeFrameScrollingNodeMac::updateMainFramePinAndRubberbandState):
+ * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h:
+ * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
+ (WebCore::ScrollingTreeOverflowScrollingNodeMac::currentScrollPositionChanged):
+ * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h:
+ * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm:
+ (WebCore::ScrollingTreeScrollingNodeDelegateMac::currentScrollPositionChanged):
+ (WebCore::ScrollingTreeScrollingNodeDelegateMac::isRubberBandInProgress const):
+ (WebCore::ScrollingTreeScrollingNodeDelegateMac::didStopRubberbandSnapAnimation):
+ (WebCore::ScrollingTreeScrollingNodeDelegateMac::rubberBandingStateChanged):
+ * platform/ScrollAnimator.cpp:
+ (WebCore::ScrollAnimator::notifyPositionChanged):
+ * platform/cocoa/ScrollController.h:
+ (WebCore::ScrollControllerClient::rubberBandingStateChanged):
+ * platform/cocoa/ScrollController.mm:
+ (WebCore::ScrollController::handleWheelEvent):
+ (WebCore::ScrollController::snapRubberBandTimerFired):
+ (WebCore::ScrollController::scrollPositionChanged):
+ (WebCore::ScrollController::isRubberBandInProgress const):
+ (WebCore::ScrollController::stopSnapRubberbandTimer):
+ (WebCore::ScrollController::isRubberBandInProgressInternal const):
+ (WebCore::ScrollController::updateRubberBandingState):
+ (WebCore::ScrollController::updateGestureInProgressState):
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::isRubberBandInProgress const):
+ (WebCore::RenderLayer::updateScrollInfoAfterLayout):
+
+ Source/WebKit:
+
+ * WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.h:
+ * WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.mm:
+ (WebKit::RemoteScrollingCoordinator::isRubberBandInProgress const):
+ (WebKit::RemoteScrollingCoordinator::scrollingStateInUIProcessChanged):
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267002 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2020-09-13 Simon Fraser <[email protected]>
+
+ Overflow:scroll rubberbanding is interrupted by post-layout scrolling
+ https://bugs.webkit.org/show_bug.cgi?id=216463
+ <rdar://problem/67095741>
+
+ Reviewed by Darin Adler.
+
+ When rubberbanding overflow:scroll RenderLayer has an overscrolled scroll offset.
+ If RenderLayer::updateScrollInfoAfterLayout() happens when in this state, it can
+ clamp the scroll offset, causing the rubberband to collapse which interferes with
+ the user interaction. This happend on Gmail when composing a reply.
+
+ Fix by tracking the rubberbanding state in the scrolling tree, and having RenderLayer
+ query this state via the ScrollingCoordinator. RenderLayer::updateScrollInfoAfterLayout()
+ already tested isRubberBandInProgress(). This is similar to how isUserScrollInProgress()
+ and isScrollSnapInProgress() work.
+
+ This patch also fixes the tracking of rubberbanding state. Previously setMainFrameIsRubberBanding()
+ was just based on when the timer was started and stopped, which did not match the
+ implementation of ScrollController::isRubberBandInProgress(). Now ScrollController
+ correctly notifies its clients when the rubberbanding state changes by updating that
+ state whenever any of the conditions consulted in isRubberBandInProgressInternal() change.
+
+ I tried to make tests for this, but the timing of wheel and scroll event delivery makes
+ reliable detection of interrupted rubberbands impossible in WebKitTestRunner.
+
+ * page/FrameView.cpp:
+ (WebCore::FrameView::isRubberBandInProgress const):
+ * page/scrolling/AsyncScrollingCoordinator.cpp:
+ (WebCore::AsyncScrollingCoordinator::isRubberBandInProgress const):
+ * page/scrolling/AsyncScrollingCoordinator.h:
+ * page/scrolling/ScrollingCoordinator.h:
+ (WebCore::ScrollingCoordinator::isRubberBandInProgress const):
+ * page/scrolling/ScrollingTree.cpp:
+ (WebCore::ScrollingTree::isRubberBandInProgressForNode):
+ (WebCore::ScrollingTree::setRubberBandingInProgressForNode):
+ (WebCore::ScrollingTree::isRubberBandInProgress): Deleted.
+ (WebCore::ScrollingTree::setMainFrameIsRubberBanding): Deleted.
+ * page/scrolling/ScrollingTree.h:
+ * page/scrolling/ScrollingTreeScrollingNode.cpp:
+ (WebCore::ScrollingTreeScrollingNode::commitStateBeforeChildren):
+ * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
+ (WebCore::ScrollingTreeFrameScrollingNodeMac::currentScrollPositionChanged):
+ (WebCore::ScrollingTreeFrameScrollingNodeMac::updateMainFramePinAndRubberbandState):
+ * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h:
+ * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
+ (WebCore::ScrollingTreeOverflowScrollingNodeMac::currentScrollPositionChanged):
+ * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h:
+ * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm:
+ (WebCore::ScrollingTreeScrollingNodeDelegateMac::currentScrollPositionChanged):
+ (WebCore::ScrollingTreeScrollingNodeDelegateMac::isRubberBandInProgress const):
+ (WebCore::ScrollingTreeScrollingNodeDelegateMac::didStopRubberbandSnapAnimation):
+ (WebCore::ScrollingTreeScrollingNodeDelegateMac::rubberBandingStateChanged):
+ * platform/ScrollAnimator.cpp:
+ (WebCore::ScrollAnimator::notifyPositionChanged):
+ * platform/cocoa/ScrollController.h:
+ (WebCore::ScrollControllerClient::rubberBandingStateChanged):
+ * platform/cocoa/ScrollController.mm:
+ (WebCore::ScrollController::handleWheelEvent):
+ (WebCore::ScrollController::snapRubberBandTimerFired):
+ (WebCore::ScrollController::scrollPositionChanged):
+ (WebCore::ScrollController::isRubberBandInProgress const):
+ (WebCore::ScrollController::stopSnapRubberbandTimer):
+ (WebCore::ScrollController::isRubberBandInProgressInternal const):
+ (WebCore::ScrollController::updateRubberBandingState):
+ (WebCore::ScrollController::updateGestureInProgressState):
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::isRubberBandInProgress const):
+ (WebCore::RenderLayer::updateScrollInfoAfterLayout):
+
+2020-09-27 Alan Coon <[email protected]>
+
Cherry-pick r266611. rdar://problem/69594191
MediaRecorder timeslice parameter causing internal error on longer videos
Modified: branches/safari-610-branch/Source/WebCore/page/FrameView.cpp (267672 => 267673)
--- branches/safari-610-branch/Source/WebCore/page/FrameView.cpp 2020-09-27 20:00:09 UTC (rev 267672)
+++ branches/safari-610-branch/Source/WebCore/page/FrameView.cpp 2020-09-27 20:00:14 UTC (rev 267673)
@@ -2632,7 +2632,7 @@
if (auto scrollingCoordinator = this->scrollingCoordinator()) {
if (!scrollingCoordinator->shouldUpdateScrollLayerPositionSynchronously(*this))
- return scrollingCoordinator->isRubberBandInProgress();
+ return scrollingCoordinator->isRubberBandInProgress(scrollingNodeID());
}
if (auto scrollAnimator = existingScrollAnimator())
Modified: branches/safari-610-branch/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp (267672 => 267673)
--- branches/safari-610-branch/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp 2020-09-27 20:00:09 UTC (rev 267672)
+++ branches/safari-610-branch/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp 2020-09-27 20:00:14 UTC (rev 267673)
@@ -839,10 +839,10 @@
return false;
}
-bool AsyncScrollingCoordinator::isRubberBandInProgress() const
+bool AsyncScrollingCoordinator::isRubberBandInProgress(ScrollingNodeID nodeID) const
{
if (m_scrollingTree)
- return m_scrollingTree->isRubberBandInProgress();
+ return m_scrollingTree->isRubberBandInProgressForNode(nodeID);
return false;
}
Modified: branches/safari-610-branch/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h (267672 => 267673)
--- branches/safari-610-branch/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h 2020-09-27 20:00:09 UTC (rev 267672)
+++ branches/safari-610-branch/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h 2020-09-27 20:00:14 UTC (rev 267673)
@@ -129,7 +129,7 @@
WEBCORE_EXPORT void scrollBySimulatingWheelEventForTesting(ScrollingNodeID, FloatSize) final;
WEBCORE_EXPORT bool isUserScrollInProgress(ScrollingNodeID) const override;
- bool isRubberBandInProgress() const override;
+ bool isRubberBandInProgress(ScrollingNodeID) const override;
#if ENABLE(CSS_SCROLL_SNAP)
WEBCORE_EXPORT bool isScrollSnapInProgress(ScrollingNodeID) const override;
Modified: branches/safari-610-branch/Source/WebCore/page/scrolling/ScrollingCoordinator.h (267672 => 267673)
--- branches/safari-610-branch/Source/WebCore/page/scrolling/ScrollingCoordinator.h 2020-09-27 20:00:09 UTC (rev 267672)
+++ branches/safari-610-branch/Source/WebCore/page/scrolling/ScrollingCoordinator.h 2020-09-27 20:00:14 UTC (rev 267673)
@@ -170,7 +170,7 @@
virtual void reconcileViewportConstrainedLayerPositions(ScrollingNodeID, const LayoutRect&, ScrollingLayerPositionAction) { }
virtual String scrollingStateTreeAsText(ScrollingStateTreeAsTextBehavior = ScrollingStateTreeAsTextBehaviorNormal) const;
virtual String scrollingTreeAsText(ScrollingStateTreeAsTextBehavior = ScrollingStateTreeAsTextBehaviorNormal) const;
- virtual bool isRubberBandInProgress() const { return false; }
+ virtual bool isRubberBandInProgress(ScrollingNodeID) const { return false; }
virtual bool isUserScrollInProgress(ScrollingNodeID) const { return false; }
virtual bool isScrollSnapInProgress(ScrollingNodeID) const { return false; }
virtual void updateScrollSnapPropertiesWithFrameView(const FrameView&) { }
Modified: branches/safari-610-branch/Source/WebCore/page/scrolling/ScrollingTree.cpp (267672 => 267673)
--- branches/safari-610-branch/Source/WebCore/page/scrolling/ScrollingTree.cpp 2020-09-27 20:00:09 UTC (rev 267672)
+++ branches/safari-610-branch/Source/WebCore/page/scrolling/ScrollingTree.cpp 2020-09-27 20:00:14 UTC (rev 267673)
@@ -465,16 +465,22 @@
}
// Can be called from the main thread.
-bool ScrollingTree::isRubberBandInProgress()
+bool ScrollingTree::isRubberBandInProgressForNode(ScrollingNodeID nodeID)
{
+ if (!nodeID)
+ return false;
+
LockHolder lock(m_treeStateMutex);
- return m_treeState.mainFrameIsRubberBanding;
+ return m_treeState.nodesWithActiveRubberBanding.contains(nodeID);
}
-void ScrollingTree::setMainFrameIsRubberBanding(bool isRubberBanding)
+void ScrollingTree::setRubberBandingInProgressForNode(ScrollingNodeID nodeID, bool isRubberBanding)
{
LockHolder locker(m_treeStateMutex);
- m_treeState.mainFrameIsRubberBanding = isRubberBanding;
+ if (isRubberBanding)
+ m_treeState.nodesWithActiveRubberBanding.add(nodeID);
+ else
+ m_treeState.nodesWithActiveRubberBanding.remove(nodeID);
}
// Can be called from the main thread.
Modified: branches/safari-610-branch/Source/WebCore/page/scrolling/ScrollingTree.h (267672 => 267673)
--- branches/safari-610-branch/Source/WebCore/page/scrolling/ScrollingTree.h 2020-09-27 20:00:09 UTC (rev 267672)
+++ branches/safari-610-branch/Source/WebCore/page/scrolling/ScrollingTree.h 2020-09-27 20:00:14 UTC (rev 267673)
@@ -92,8 +92,8 @@
WEBCORE_EXPORT OptionSet<WheelEventProcessingSteps> determineWheelEventProcessing(const PlatformWheelEvent&);
WEBCORE_EXPORT virtual WheelEventHandlingResult handleWheelEvent(const PlatformWheelEvent&);
- void setMainFrameIsRubberBanding(bool);
- bool isRubberBandInProgress();
+ bool isRubberBandInProgressForNode(ScrollingNodeID);
+ void setRubberBandingInProgressForNode(ScrollingNodeID, bool);
bool isUserScrollInProgressForNode(ScrollingNodeID);
void setUserScrollInProgressForNode(ScrollingNodeID, bool);
@@ -257,9 +257,9 @@
FloatPoint mainFrameScrollPosition;
PlatformDisplayID displayID { 0 };
Optional<unsigned> nominalFramesPerSecond;
+ HashSet<ScrollingNodeID> nodesWithActiveRubberBanding;
HashSet<ScrollingNodeID> nodesWithActiveScrollSnap;
HashSet<ScrollingNodeID> nodesWithActiveUserScrolls;
- bool mainFrameIsRubberBanding { false };
};
Lock m_treeStateMutex;
Modified: branches/safari-610-branch/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp (267672 => 267673)
--- branches/safari-610-branch/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp 2020-09-27 20:00:09 UTC (rev 267672)
+++ branches/safari-610-branch/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp 2020-09-27 20:00:14 UTC (rev 267673)
@@ -54,7 +54,7 @@
m_scrollableAreaSize = state.scrollableAreaSize();
if (state.hasChangedProperty(ScrollingStateScrollingNode::TotalContentsSize)) {
- if (scrollingTree().isRubberBandInProgress())
+ if (scrollingTree().isRubberBandInProgressForNode(scrollingNodeID()))
m_totalContentsSizeForRubberBand = m_totalContentsSize;
else
m_totalContentsSizeForRubberBand = state.totalContentsSize();
Modified: branches/safari-610-branch/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm (267672 => 267673)
--- branches/safari-610-branch/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm 2020-09-27 20:00:09 UTC (rev 267672)
+++ branches/safari-610-branch/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm 2020-09-27 20:00:14 UTC (rev 267673)
@@ -143,6 +143,8 @@
{
LOG_WITH_STREAM(Scrolling, stream << "ScrollingTreeFrameScrollingNodeMac::currentScrollPositionChanged to " << currentScrollPosition() << " min: " << minimumScrollPosition() << " max: " << maximumScrollPosition() << " sync: " << hasSynchronousScrollingReasons());
+ m_delegate.currentScrollPositionChanged();
+
if (isRootNode())
updateMainFramePinAndRubberbandState();
@@ -224,9 +226,7 @@
void ScrollingTreeFrameScrollingNodeMac::updateMainFramePinAndRubberbandState()
{
ASSERT(isRootNode());
-
scrollingTree().setMainFramePinnedState(edgePinnedState());
- scrollingTree().setMainFrameIsRubberBanding(isRubberBanding());
}
unsigned ScrollingTreeFrameScrollingNodeMac::exposedUnfilledArea() const
Modified: branches/safari-610-branch/Source/WebCore/page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h (267672 => 267673)
--- branches/safari-610-branch/Source/WebCore/page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h 2020-09-27 20:00:09 UTC (rev 267672)
+++ branches/safari-610-branch/Source/WebCore/page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h 2020-09-27 20:00:14 UTC (rev 267673)
@@ -47,6 +47,8 @@
FloatPoint adjustedScrollPosition(const FloatPoint&, ScrollClamping) const override;
+ void currentScrollPositionChanged(ScrollingLayerPositionAction) final;
+
void repositionScrollingLayers() override;
void repositionRelatedLayers() override;
Modified: branches/safari-610-branch/Source/WebCore/page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm (267672 => 267673)
--- branches/safari-610-branch/Source/WebCore/page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm 2020-09-27 20:00:09 UTC (rev 267672)
+++ branches/safari-610-branch/Source/WebCore/page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm 2020-09-27 20:00:14 UTC (rev 267673)
@@ -86,6 +86,12 @@
return WheelEventHandlingResult::result(m_delegate.handleWheelEvent(wheelEvent));
}
+void ScrollingTreeOverflowScrollingNodeMac::currentScrollPositionChanged(ScrollingLayerPositionAction action)
+{
+ ScrollingTreeOverflowScrollingNode::currentScrollPositionChanged(action);
+ m_delegate.currentScrollPositionChanged();
+}
+
FloatPoint ScrollingTreeOverflowScrollingNodeMac::adjustedScrollPosition(const FloatPoint& position, ScrollClamping clamp) const
{
FloatPoint scrollPosition(roundf(position.x()), roundf(position.y()));
Modified: branches/safari-610-branch/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h (267672 => 267673)
--- branches/safari-610-branch/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h 2020-09-27 20:00:09 UTC (rev 267672)
+++ branches/safari-610-branch/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h 2020-09-27 20:00:14 UTC (rev 267673)
@@ -50,6 +50,8 @@
void nodeWillBeDestroyed();
bool handleWheelEvent(const PlatformWheelEvent&);
+
+ void currentScrollPositionChanged();
#if ENABLE(CSS_SCROLL_SNAP)
void updateScrollSnapPoints(ScrollEventAxis, const Vector<LayoutUnit>&, const Vector<ScrollOffsetRange<LayoutUnit>>&);
@@ -59,6 +61,8 @@
bool isScrollSnapInProgress() const;
#endif
+ bool isRubberBandInProgress() const;
+
void updateFromStateNode(const ScrollingStateScrollingNode&);
void updateScrollbarPainters();
@@ -80,6 +84,7 @@
void immediateScrollBy(const FloatSize&) final;
void immediateScrollByWithoutContentEdgeConstraints(const FloatSize&) final;
void didStopRubberbandSnapAnimation() final;
+ void rubberBandingStateChanged(bool) final;
void adjustScrollPositionToBoundsIfNecessary() final;
#if ENABLE(CSS_SCROLL_SNAP)
Modified: branches/safari-610-branch/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm (267672 => 267673)
--- branches/safari-610-branch/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm 2020-09-27 20:00:09 UTC (rev 267672)
+++ branches/safari-610-branch/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm 2020-09-27 20:00:14 UTC (rev 267673)
@@ -160,6 +160,16 @@
return handled;
}
+void ScrollingTreeScrollingNodeDelegateMac::currentScrollPositionChanged()
+{
+ m_scrollController.scrollPositionChanged();
+}
+
+bool ScrollingTreeScrollingNodeDelegateMac::isRubberBandInProgress() const
+{
+ return m_scrollController.isRubberBandInProgress();
+}
+
bool ScrollingTreeScrollingNodeDelegateMac::isScrollSnapInProgress() const
{
return m_scrollController.isScrollSnapInProgress();
@@ -318,12 +328,15 @@
void ScrollingTreeScrollingNodeDelegateMac::didStopRubberbandSnapAnimation()
{
- scrollingTree().setMainFrameIsRubberBanding(false);
-
// Since the rubberband timer has stopped, totalContentsSizeForRubberBand can be synchronized with totalContentsSize.
scrollingNode().setTotalContentsSizeForRubberBand(totalContentsSize());
}
+void ScrollingTreeScrollingNodeDelegateMac::rubberBandingStateChanged(bool inRubberBand)
+{
+ scrollingTree().setRubberBandingInProgressForNode(scrollingNode().scrollingNodeID(), inRubberBand);
+}
+
void ScrollingTreeScrollingNodeDelegateMac::adjustScrollPositionToBoundsIfNecessary()
{
FloatPoint scrollPosition = currentScrollPosition();
Modified: branches/safari-610-branch/Source/WebCore/platform/ScrollAnimator.cpp (267672 => 267673)
--- branches/safari-610-branch/Source/WebCore/platform/ScrollAnimator.cpp 2020-09-27 20:00:09 UTC (rev 267672)
+++ branches/safari-610-branch/Source/WebCore/platform/ScrollAnimator.cpp 2020-09-27 20:00:14 UTC (rev 267673)
@@ -214,6 +214,10 @@
UNUSED_PARAM(delta);
// FIXME: need to not map back and forth all the time.
m_scrollableArea.setScrollOffsetFromAnimation(m_scrollableArea.scrollOffsetFromPosition(roundedIntPoint(currentPosition())));
+
+#if ENABLE(CSS_SCROLL_SNAP) || ENABLE(RUBBER_BANDING)
+ m_scrollController.scrollPositionChanged();
+#endif
}
#if ENABLE(CSS_SCROLL_SNAP)
Modified: branches/safari-610-branch/Source/WebCore/platform/cocoa/ScrollController.h (267672 => 267673)
--- branches/safari-610-branch/Source/WebCore/platform/cocoa/ScrollController.h 2020-09-27 20:00:09 UTC (rev 267672)
+++ branches/safari-610-branch/Source/WebCore/platform/cocoa/ScrollController.h 2020-09-27 20:00:14 UTC (rev 267673)
@@ -83,9 +83,12 @@
// FIXME: use ScrollClamping to collapse these to one.
virtual void immediateScrollBy(const FloatSize&) = 0;
virtual void immediateScrollByWithoutContentEdgeConstraints(const FloatSize&) = 0;
+
virtual void willStartRubberBandSnapAnimation() { }
virtual void didStopRubberbandSnapAnimation() { }
-
+
+ virtual void rubberBandingStateChanged(bool) { }
+
// If the current scroll position is within the overhang area, this function will cause
// the page to scroll to the nearest boundary point.
virtual void adjustScrollPositionToBoundsIfNecessary() = 0;
@@ -142,6 +145,8 @@
bool isUserScrollInProgress() const;
bool isRubberBandInProgress() const;
bool isScrollSnapInProgress() const;
+
+ void scrollPositionChanged();
#if ENABLE(CSS_SCROLL_SNAP)
void updateScrollSnapPoints(ScrollEventAxis, const Vector<LayoutUnit>&, const Vector<ScrollOffsetRange<LayoutUnit>>&);
@@ -175,6 +180,9 @@
bool shouldRubberBandInHorizontalDirection(const PlatformWheelEvent&) const;
bool shouldRubberBandInDirection(ScrollDirection) const;
+
+ bool isRubberBandInProgressInternal() const;
+ void updateRubberBandingState();
#endif
#if ENABLE(CSS_SCROLL_SNAP)
@@ -223,6 +231,7 @@
bool m_inScrollGesture { false };
bool m_momentumScrollInProgress { false };
bool m_ignoreMomentumScrolls { false };
+ bool m_isRubberBanding { false };
#endif
#if ASSERT_ENABLED
Modified: branches/safari-610-branch/Source/WebCore/platform/cocoa/ScrollController.mm (267672 => 267673)
--- branches/safari-610-branch/Source/WebCore/platform/cocoa/ScrollController.mm 2020-09-27 20:00:09 UTC (rev 267672)
+++ branches/safari-610-branch/Source/WebCore/platform/cocoa/ScrollController.mm 2020-09-27 20:00:14 UTC (rev 267673)
@@ -148,12 +148,13 @@
m_overflowScrollDelta = FloatSize();
stopSnapRubberbandTimer();
-
+ updateRubberBandingState();
return true;
}
if (wheelEvent.phase() == PlatformWheelEventPhaseEnded) {
snapRubberBand();
+ updateRubberBandingState();
return true;
}
@@ -317,6 +318,8 @@
m_lastMomentumScrollTimestamp = { };
}
+ updateRubberBandingState();
+
return handled;
}
#endif // PLATFORM(MAC)
@@ -412,6 +415,8 @@
m_startTime = { };
m_startStretch = { };
m_origVelocity = { };
+
+ updateRubberBandingState();
return;
}
@@ -452,12 +457,21 @@
} else {
m_startTime = MonotonicTime::now();
m_startStretch = { };
- if (!isRubberBandInProgress())
+ if (!isRubberBandInProgressInternal())
stopSnapRubberbandTimer();
}
+
+ updateRubberBandingState();
}
#endif
+void ScrollController::scrollPositionChanged()
+{
+#if ENABLE(RUBBER_BANDING)
+ updateRubberBandingState();
+#endif
+}
+
bool ScrollController::usesScrollSnap() const
{
#if ENABLE(CSS_SCROLL_SNAP)
@@ -479,10 +493,7 @@
bool ScrollController::isRubberBandInProgress() const
{
#if ENABLE(RUBBER_BANDING) && PLATFORM(MAC)
- if (!m_inScrollGesture && !m_momentumScrollInProgress && !m_snapRubberbandTimer)
- return false;
-
- return !m_client.stretchAmount().isZero();
+ return m_isRubberBanding;
#else
return false;
#endif
@@ -517,12 +528,12 @@
void ScrollController::stopSnapRubberbandTimer()
{
m_client.didStopRubberbandSnapAnimation();
-
+
if (m_snapRubberbandTimer) {
m_snapRubberbandTimer->stop();
m_snapRubberbandTimer = nullptr;
}
-
+
m_client.removeWheelEventTestCompletionDeferralForReason(reinterpret_cast<WheelEventTestMonitor::ScrollableAreaIdentifier>(this), WheelEventTestMonitor::RubberbandInProgress);
}
@@ -556,6 +567,24 @@
return m_client.shouldRubberBandInDirection(direction);
}
+bool ScrollController::isRubberBandInProgressInternal() const
+{
+ if (!m_inScrollGesture && !m_momentumScrollInProgress && !m_snapRubberbandTimer)
+ return false;
+
+ return !m_client.stretchAmount().isZero();
+}
+
+void ScrollController::updateRubberBandingState()
+{
+ bool isRubberBanding = isRubberBandInProgressInternal();
+ if (isRubberBanding == m_isRubberBanding)
+ return;
+
+ m_isRubberBanding = isRubberBanding;
+ m_client.rubberBandingStateChanged(m_isRubberBanding);
+}
+
#endif // ENABLE(RUBBER_BANDING)
#if ENABLE(CSS_SCROLL_SNAP)
@@ -717,6 +746,8 @@
m_inScrollGesture = true;
else if (wheelEvent.isEndOfNonMomentumScroll() || wheelEvent.isGestureCancel() || wheelEvent.isEndOfMomentumScroll())
m_inScrollGesture = false;
+
+ updateRubberBandingState();
}
void ScrollController::startScrollSnapTimer()
Modified: branches/safari-610-branch/Source/WebCore/rendering/RenderLayer.cpp (267672 => 267673)
--- branches/safari-610-branch/Source/WebCore/rendering/RenderLayer.cpp 2020-09-27 20:00:09 UTC (rev 267672)
+++ branches/safari-610-branch/Source/WebCore/rendering/RenderLayer.cpp 2020-09-27 20:00:14 UTC (rev 267673)
@@ -1910,6 +1910,11 @@
if (!scrollsOverflow())
return false;
+ if (auto scrollingCoordinator = page().scrollingCoordinator()) {
+ if (scrollingCoordinator->isRubberBandInProgress(scrollingNodeID()))
+ return true;
+ }
+
if (auto scrollAnimator = existingScrollAnimator())
return scrollAnimator->isRubberBandInProgress();
#endif
@@ -3914,7 +3919,7 @@
updateSnapOffsets();
#endif
- if (!box->isHTMLMarquee() && !isRubberBandInProgress()) {
+ if (!box->isHTMLMarquee() && !isRubberBandInProgress() && !isUserScrollInProgress()) {
// Layout may cause us to be at an invalid scroll position. In this case we need
// to pull our scroll offsets back to the max (or push them up to the min).
ScrollOffset clampedScrollOffset = clampScrollOffset(scrollOffset());
Modified: branches/safari-610-branch/Source/WebKit/ChangeLog (267672 => 267673)
--- branches/safari-610-branch/Source/WebKit/ChangeLog 2020-09-27 20:00:09 UTC (rev 267672)
+++ branches/safari-610-branch/Source/WebKit/ChangeLog 2020-09-27 20:00:14 UTC (rev 267673)
@@ -1,5 +1,119 @@
2020-09-27 Alan Coon <[email protected]>
+ Cherry-pick r267002. rdar://problem/69594199
+
+ Overflow:scroll rubberbanding is interrupted by post-layout scrolling
+ https://bugs.webkit.org/show_bug.cgi?id=216463
+ <rdar://problem/67095741>
+
+ Reviewed by Darin Adler.
+
+ When rubberbanding overflow:scroll RenderLayer has an overscrolled scroll offset.
+ If RenderLayer::updateScrollInfoAfterLayout() happens when in this state, it can
+ clamp the scroll offset, causing the rubberband to collapse which interferes with
+ the user interaction. This happend on Gmail when composing a reply.
+
+ Fix by tracking the rubberbanding state in the scrolling tree, and having RenderLayer
+ query this state via the ScrollingCoordinator. RenderLayer::updateScrollInfoAfterLayout()
+ already tested isRubberBandInProgress(). This is similar to how isUserScrollInProgress()
+ and isScrollSnapInProgress() work.
+
+ This patch also fixes the tracking of rubberbanding state. Previously setMainFrameIsRubberBanding()
+ was just based on when the timer was started and stopped, which did not match the
+ implementation of ScrollController::isRubberBandInProgress(). Now ScrollController
+ correctly notifies its clients when the rubberbanding state changes by updating that
+ state whenever any of the conditions consulted in isRubberBandInProgressInternal() change.
+
+ Source/WebCore:
+
+ I tried to make tests for this, but the timing of wheel and scroll event delivery makes
+ reliable detection of interrupted rubberbands impossible in WebKitTestRunner.
+
+ * page/FrameView.cpp:
+ (WebCore::FrameView::isRubberBandInProgress const):
+ * page/scrolling/AsyncScrollingCoordinator.cpp:
+ (WebCore::AsyncScrollingCoordinator::isRubberBandInProgress const):
+ * page/scrolling/AsyncScrollingCoordinator.h:
+ * page/scrolling/ScrollingCoordinator.h:
+ (WebCore::ScrollingCoordinator::isRubberBandInProgress const):
+ * page/scrolling/ScrollingTree.cpp:
+ (WebCore::ScrollingTree::isRubberBandInProgressForNode):
+ (WebCore::ScrollingTree::setRubberBandingInProgressForNode):
+ (WebCore::ScrollingTree::isRubberBandInProgress): Deleted.
+ (WebCore::ScrollingTree::setMainFrameIsRubberBanding): Deleted.
+ * page/scrolling/ScrollingTree.h:
+ * page/scrolling/ScrollingTreeScrollingNode.cpp:
+ (WebCore::ScrollingTreeScrollingNode::commitStateBeforeChildren):
+ * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
+ (WebCore::ScrollingTreeFrameScrollingNodeMac::currentScrollPositionChanged):
+ (WebCore::ScrollingTreeFrameScrollingNodeMac::updateMainFramePinAndRubberbandState):
+ * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h:
+ * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
+ (WebCore::ScrollingTreeOverflowScrollingNodeMac::currentScrollPositionChanged):
+ * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h:
+ * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm:
+ (WebCore::ScrollingTreeScrollingNodeDelegateMac::currentScrollPositionChanged):
+ (WebCore::ScrollingTreeScrollingNodeDelegateMac::isRubberBandInProgress const):
+ (WebCore::ScrollingTreeScrollingNodeDelegateMac::didStopRubberbandSnapAnimation):
+ (WebCore::ScrollingTreeScrollingNodeDelegateMac::rubberBandingStateChanged):
+ * platform/ScrollAnimator.cpp:
+ (WebCore::ScrollAnimator::notifyPositionChanged):
+ * platform/cocoa/ScrollController.h:
+ (WebCore::ScrollControllerClient::rubberBandingStateChanged):
+ * platform/cocoa/ScrollController.mm:
+ (WebCore::ScrollController::handleWheelEvent):
+ (WebCore::ScrollController::snapRubberBandTimerFired):
+ (WebCore::ScrollController::scrollPositionChanged):
+ (WebCore::ScrollController::isRubberBandInProgress const):
+ (WebCore::ScrollController::stopSnapRubberbandTimer):
+ (WebCore::ScrollController::isRubberBandInProgressInternal const):
+ (WebCore::ScrollController::updateRubberBandingState):
+ (WebCore::ScrollController::updateGestureInProgressState):
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::isRubberBandInProgress const):
+ (WebCore::RenderLayer::updateScrollInfoAfterLayout):
+
+ Source/WebKit:
+
+ * WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.h:
+ * WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.mm:
+ (WebKit::RemoteScrollingCoordinator::isRubberBandInProgress const):
+ (WebKit::RemoteScrollingCoordinator::scrollingStateInUIProcessChanged):
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267002 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2020-09-13 Simon Fraser <[email protected]>
+
+ Overflow:scroll rubberbanding is interrupted by post-layout scrolling
+ https://bugs.webkit.org/show_bug.cgi?id=216463
+ <rdar://problem/67095741>
+
+ Reviewed by Darin Adler.
+
+ When rubberbanding overflow:scroll RenderLayer has an overscrolled scroll offset.
+ If RenderLayer::updateScrollInfoAfterLayout() happens when in this state, it can
+ clamp the scroll offset, causing the rubberband to collapse which interferes with
+ the user interaction. This happend on Gmail when composing a reply.
+
+ Fix by tracking the rubberbanding state in the scrolling tree, and having RenderLayer
+ query this state via the ScrollingCoordinator. RenderLayer::updateScrollInfoAfterLayout()
+ already tested isRubberBandInProgress(). This is similar to how isUserScrollInProgress()
+ and isScrollSnapInProgress() work.
+
+ This patch also fixes the tracking of rubberbanding state. Previously setMainFrameIsRubberBanding()
+ was just based on when the timer was started and stopped, which did not match the
+ implementation of ScrollController::isRubberBandInProgress(). Now ScrollController
+ correctly notifies its clients when the rubberbanding state changes by updating that
+ state whenever any of the conditions consulted in isRubberBandInProgressInternal() change.
+
+ * WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.h:
+ * WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.mm:
+ (WebKit::RemoteScrollingCoordinator::isRubberBandInProgress const):
+ (WebKit::RemoteScrollingCoordinator::scrollingStateInUIProcessChanged):
+
+2020-09-27 Alan Coon <[email protected]>
+
Cherry-pick r266611. rdar://problem/69594191
MediaRecorder timeslice parameter causing internal error on longer videos
Modified: branches/safari-610-branch/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.h (267672 => 267673)
--- branches/safari-610-branch/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.h 2020-09-27 20:00:09 UTC (rev 267672)
+++ branches/safari-610-branch/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.h 2020-09-27 20:00:14 UTC (rev 267673)
@@ -65,8 +65,7 @@
bool coordinatesScrollingForFrameView(const WebCore::FrameView&) const override;
void scheduleTreeStateCommit() override;
- bool isRubberBandInProgress() const override;
-
+ bool isRubberBandInProgress(WebCore::ScrollingNodeID) const final;
bool isUserScrollInProgress(WebCore::ScrollingNodeID) const final;
#if ENABLE(CSS_SCROLL_SNAP)
bool isScrollSnapInProgress(WebCore::ScrollingNodeID) const final;
@@ -83,6 +82,7 @@
WebPage* m_webPage;
+ HashSet<WebCore::ScrollingNodeID> m_nodesWithActiveRubberBanding;
HashSet<WebCore::ScrollingNodeID> m_nodesWithActiveScrollSnap;
HashSet<WebCore::ScrollingNodeID> m_nodesWithActiveUserScrolls;
};
Modified: branches/safari-610-branch/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.mm (267672 => 267673)
--- branches/safari-610-branch/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.mm 2020-09-27 20:00:09 UTC (rev 267672)
+++ branches/safari-610-branch/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.mm 2020-09-27 20:00:14 UTC (rev 267673)
@@ -72,10 +72,9 @@
return renderView && renderView->usesCompositing();
}
-bool RemoteScrollingCoordinator::isRubberBandInProgress() const
+bool RemoteScrollingCoordinator::isRubberBandInProgress(ScrollingNodeID nodeID) const
{
- // FIXME: need to maintain state in the web process?
- return false;
+ return m_nodesWithActiveRubberBanding.contains(nodeID);
}
bool RemoteScrollingCoordinator::isUserScrollInProgress(ScrollingNodeID nodeID) const
@@ -112,6 +111,7 @@
void RemoteScrollingCoordinator::scrollingStateInUIProcessChanged(const RemoteScrollingUIState& uiState)
{
+ // FIXME: Also track m_nodesWithActiveRubberBanding.
if (uiState.changes().contains(RemoteScrollingUIState::Changes::ScrollSnapNodes))
m_nodesWithActiveScrollSnap = uiState.nodesWithActiveScrollSnap();