Diff
Modified: trunk/Source/WebCore/ChangeLog (278483 => 278484)
--- trunk/Source/WebCore/ChangeLog 2021-06-04 19:34:29 UTC (rev 278483)
+++ trunk/Source/WebCore/ChangeLog 2021-06-04 19:50:33 UTC (rev 278484)
@@ -1,3 +1,66 @@
+2021-06-04 Martin Robinson <[email protected]>
+
+ [css-scroll-snap] Snap offsets and active index are duplicated in ScrollController and ScrollableArea
+ https://bugs.webkit.org/show_bug.cgi?id=226538
+
+ Reviewed by Simon Fraser.
+
+ Remove duplicate css-scroll-snap state from ScrollableArea. This state is already
+ stored in ScrollController, so we do not need to store it also in ScrollableArea.
+ This change also renames a couple methods so that they have clearer and more
+ consistent names.
+
+ No new tests. This should not change behavior.
+
+ * page/FrameView.cpp:
+ (WebCore::FrameView::performPostLayoutTasks): updateScrollSnapState() is now called
+ resnapAfterLayout().
+ * page/scrolling/AsyncScrollingCoordinator.cpp: snapOffsetInfo() is now called
+ snapOffsetsInfo().
+ (WebCore::AsyncScrollingCoordinator::setScrollingNodeScrollableAreaGeometry): Ditto.
+ (WebCore::AsyncScrollingCoordinator::updateScrollSnapPropertiesWithFrameView): Ditto.
+ * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm:
+ (WebCore::ScrollingTreeScrollingNodeDelegateMac::updateFromStateNode): Use new method name.
+ * platform/ScrollAnimator.cpp:
+ (WebCore::ScrollAnimator::updateActiveScrollSnapIndexForOffset): We no longer need to
+ sync state with Scrollable Area.
+ (WebCore::ScrollAnimator::setSnapOffsetsInfo): Added this setter which
+ calls through to ScrollController.
+ (WebCore::ScrollAnimator::snapOffsetsInfo const): Added this getter which calls through
+ to ScrollController.
+ (WebCore::ScrollAnimator::setActiveScrollSnapIndexForAxis): Added this method.
+ * platform/ScrollAnimator.h: Update method declarations.
+ * platform/mac/ScrollAnimatorMac.mm:
+ (WebCore::ScrollAnimatorMac::allowsVerticalStretching const): Use new method names.
+ (WebCore::ScrollAnimatorMac::allowsHorizontalStretching const): Ditto.
+ * platform/ScrollController.cpp:
+ (WebCore::ScrollController::setSnapOffsetsInfo): Combined updateScrollSnapState and
+ updateScrollSnapPoints into this method.
+ (WebCore::ScrollController::snapOffsetsInfo const): Added this getter.
+ * platform/ScrollController.h: Update method declarations.
+ * platform/ScrollableArea.cpp:
+ (WebCore::ScrollableArea::handleWheelEventForScrolling): We no longer need to sync
+ from the ScrollAnimator.
+ (WebCore::ScrollableArea::snapOffsetsInfo const): Renamed this getter.
+ (WebCore::ScrollableArea::setScrollSnapOffsetInfo): This now calls through to
+ ScrollController.
+ (WebCore::ScrollableArea::clearSnapOffsets): Ditto.
+ (WebCore::ScrollableArea::currentHorizontalSnapPointIndex const): Ditto.
+ (WebCore::ScrollableArea::currentVerticalSnapPointIndex const): Ditto.
+ (WebCore::ScrollableArea::setCurrentHorizontalSnapPointIndex): Ditto.
+ (WebCore::ScrollableArea::setCurrentVerticalSnapPointIndex): Ditto.
+ (WebCore::ScrollableArea::resnapAfterLayout): Renamed this method and moved
+ setting the ScrollSnapOffsetsInfo to setScrollSnapOffsetInfo.
+ (WebCore::ScrollableArea::doPostThumbMoveSnapping): Use new methods to access
+ scroll snap state and return early if we don't have a ScrollAnimator already.
+ This was done implicitly in the previous implementation.
+ * platform/ScrollableArea.h:
+ * rendering/RenderLayerScrollableArea.cpp: Update method definitions and
+ remove members that are no longer used.
+ (WebCore::RenderLayerScrollableArea::updateScrollInfoAfterLayout): Use new method name.
+ * testing/Internals.cpp:
+ (WebCore::Internals::scrollSnapOffsets): Ditto.
+
2021-06-04 Chris Dumez <[email protected]>
Stop using legacy MainThreadTaskQueue in PlatformMediaSessionManager / MediaSessionManagerCocoa
Modified: trunk/Source/WebCore/page/FrameView.cpp (278483 => 278484)
--- trunk/Source/WebCore/page/FrameView.cpp 2021-06-04 19:34:29 UTC (rev 278483)
+++ trunk/Source/WebCore/page/FrameView.cpp 2021-06-04 19:50:33 UTC (rev 278484)
@@ -3353,7 +3353,7 @@
updateLayoutViewport();
viewportContentsChanged();
- updateScrollSnapState();
+ resnapAfterLayout();
if (AXObjectCache* cache = frame().document()->existingAXObjectCache())
cache->performDeferredCacheUpdate();
Modified: trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp (278483 => 278484)
--- trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp 2021-06-04 19:34:29 UTC (rev 278483)
+++ trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp 2021-06-04 19:50:33 UTC (rev 278484)
@@ -708,7 +708,7 @@
#if ENABLE(CSS_SCROLL_SNAP)
scrollableArea.updateSnapOffsets();
- setStateScrollingNodeSnapOffsetsAsFloat(scrollingNode, scrollableArea.snapOffsetInfo(), m_page->deviceScaleFactor());
+ setStateScrollingNodeSnapOffsetsAsFloat(scrollingNode, scrollableArea.snapOffsetsInfo(), m_page->deviceScaleFactor());
scrollingNode.setCurrentHorizontalSnapPointIndex(scrollableArea.currentHorizontalSnapPointIndex());
scrollingNode.setCurrentVerticalSnapPointIndex(scrollableArea.currentVerticalSnapPointIndex());
#endif
@@ -902,7 +902,7 @@
void AsyncScrollingCoordinator::updateScrollSnapPropertiesWithFrameView(const FrameView& frameView)
{
if (auto node = downcast<ScrollingStateFrameScrollingNode>(m_scrollingStateTree->stateNodeForID(frameView.scrollingNodeID()))) {
- setStateScrollingNodeSnapOffsetsAsFloat(*node, frameView.snapOffsetInfo(), m_page->deviceScaleFactor());
+ setStateScrollingNodeSnapOffsetsAsFloat(*node, frameView.snapOffsetsInfo(), m_page->deviceScaleFactor());
node->setCurrentHorizontalSnapPointIndex(frameView.currentHorizontalSnapPointIndex());
node->setCurrentVerticalSnapPointIndex(frameView.currentVerticalSnapPointIndex());
}
Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm (278483 => 278484)
--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm 2021-06-04 19:34:29 UTC (rev 278483)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm 2021-06-04 19:50:33 UTC (rev 278484)
@@ -65,7 +65,7 @@
#if ENABLE(CSS_SCROLL_SNAP)
if (scrollingStateNode.hasChangedProperty(ScrollingStateNode::Property::SnapOffsetsInfo))
- m_scrollController.updateScrollSnapPoints(scrollingStateNode.snapOffsetsInfo().convertUnits<LayoutScrollSnapOffsetsInfo>());
+ m_scrollController.setSnapOffsetsInfo(scrollingStateNode.snapOffsetsInfo().convertUnits<LayoutScrollSnapOffsetsInfo>());
if (scrollingStateNode.hasChangedProperty(ScrollingStateNode::Property::CurrentHorizontalSnapOffsetIndex))
m_scrollController.setActiveScrollSnapIndexForAxis(ScrollEventAxis::Horizontal, scrollingStateNode.currentHorizontalSnapPointIndex());
Modified: trunk/Source/WebCore/platform/ScrollAnimator.cpp (278483 => 278484)
--- trunk/Source/WebCore/platform/ScrollAnimator.cpp 2021-06-04 19:34:29 UTC (rev 278483)
+++ trunk/Source/WebCore/platform/ScrollAnimator.cpp 2021-06-04 19:50:33 UTC (rev 278484)
@@ -188,6 +188,11 @@
{
return m_scrollController.activeScrollSnapIndexForAxis(axis);
}
+
+void ScrollAnimator::setActiveScrollSnapIndexForAxis(ScrollEventAxis axis, unsigned index)
+{
+ return m_scrollController.setActiveScrollSnapIndexForAxis(axis, index);
+}
#endif
bool ScrollAnimator::handleWheelEvent(const PlatformWheelEvent& e)
@@ -270,10 +275,6 @@
#if ENABLE(CSS_SCROLL_SNAP)
auto scrollOffset = m_scrollableArea.scrollOffsetFromPosition(roundedIntPoint(currentPosition()));
m_scrollController.setActiveScrollSnapIndicesForOffset(scrollOffset);
- if (m_scrollController.activeScrollSnapIndexDidChange()) {
- m_scrollableArea.setCurrentHorizontalSnapPointIndex(m_scrollController.activeScrollSnapIndexForAxis(ScrollEventAxis::Horizontal));
- m_scrollableArea.setCurrentVerticalSnapPointIndex(m_scrollController.activeScrollSnapIndexForAxis(ScrollEventAxis::Vertical));
- }
#endif
}
@@ -288,11 +289,16 @@
}
#if ENABLE(CSS_SCROLL_SNAP)
-void ScrollAnimator::updateScrollSnapState()
+void ScrollAnimator::setSnapOffsetsInfo(const LayoutScrollSnapOffsetsInfo& info)
{
- m_scrollController.updateScrollSnapState(m_scrollableArea);
+ m_scrollController.setSnapOffsetsInfo(info);
}
+const LayoutScrollSnapOffsetsInfo* ScrollAnimator::snapOffsetsInfo() const
+{
+ return m_scrollController.snapOffsetsInfo();
+}
+
FloatPoint ScrollAnimator::scrollOffset() const
{
return m_scrollableArea.scrollOffsetFromPosition(roundedIntPoint(currentPosition()));
Modified: trunk/Source/WebCore/platform/ScrollAnimator.h (278483 => 278484)
--- trunk/Source/WebCore/platform/ScrollAnimator.h 2021-06-04 19:34:29 UTC (rev 278483)
+++ trunk/Source/WebCore/platform/ScrollAnimator.h 2021-06-04 19:50:33 UTC (rev 278484)
@@ -158,6 +158,9 @@
void updateScrollSnapState();
bool activeScrollSnapIndexDidChange() const;
unsigned activeScrollSnapIndexForAxis(ScrollEventAxis) const;
+ void setActiveScrollSnapIndexForAxis(ScrollEventAxis, unsigned index);
+ void setSnapOffsetsInfo(const LayoutScrollSnapOffsetsInfo&);
+ const LayoutScrollSnapOffsetsInfo* snapOffsetsInfo() const;
#endif
// ScrollControllerClient.
Modified: trunk/Source/WebCore/platform/ScrollController.cpp (278483 => 278484)
--- trunk/Source/WebCore/platform/ScrollController.cpp 2021-06-04 19:34:29 UTC (rev 278483)
+++ trunk/Source/WebCore/platform/ScrollController.cpp 2021-06-04 19:50:33 UTC (rev 278484)
@@ -99,19 +99,8 @@
#if ENABLE(CSS_SCROLL_SNAP)
-void ScrollController::updateScrollSnapState(const ScrollableArea& scrollableArea)
+void ScrollController::setSnapOffsetsInfo(const LayoutScrollSnapOffsetsInfo& snapOffsetInfo)
{
- const auto* snapOffsetInfo = scrollableArea.snapOffsetInfo();
- if (!snapOffsetInfo) {
- m_scrollSnapState = nullptr;
- return;
- }
-
- updateScrollSnapPoints(*snapOffsetInfo);
-}
-
-void ScrollController::updateScrollSnapPoints(const LayoutScrollSnapOffsetsInfo& snapOffsetInfo)
-{
if (snapOffsetInfo.isEmpty()) {
m_scrollSnapState = nullptr;
return;
@@ -126,9 +115,14 @@
if (shouldComputeCurrentSnapIndices)
setActiveScrollSnapIndicesForOffset(roundedIntPoint(m_client.scrollOffset()));
- LOG_WITH_STREAM(ScrollSnap, stream << "ScrollController " << this << " updateScrollSnapState new state: " << ValueOrNull(m_scrollSnapState.get()));
+ LOG_WITH_STREAM(ScrollSnap, stream << "ScrollController " << this << " setSnapOffsetsInfo new state: " << ValueOrNull(m_scrollSnapState.get()));
}
+const LayoutScrollSnapOffsetsInfo* ScrollController::snapOffsetsInfo() const
+{
+ return m_scrollSnapState ? &m_scrollSnapState->snapOffsetInfo() : nullptr;
+}
+
unsigned ScrollController::activeScrollSnapIndexForAxis(ScrollEventAxis axis) const
{
if (!usesScrollSnap())
Modified: trunk/Source/WebCore/platform/ScrollController.h (278483 => 278484)
--- trunk/Source/WebCore/platform/ScrollController.h 2021-06-04 19:34:29 UTC (rev 278483)
+++ trunk/Source/WebCore/platform/ScrollController.h 2021-06-04 19:50:33 UTC (rev 278484)
@@ -139,7 +139,8 @@
void animationCallback(MonotonicTime);
#if ENABLE(CSS_SCROLL_SNAP)
- void updateScrollSnapPoints(const LayoutScrollSnapOffsetsInfo&);
+ void setSnapOffsetsInfo(const LayoutScrollSnapOffsetsInfo&);
+ const LayoutScrollSnapOffsetsInfo* snapOffsetsInfo() const;
void setActiveScrollSnapIndexForAxis(ScrollEventAxis, unsigned);
void setActiveScrollSnapIndicesForOffset(ScrollOffset);
bool activeScrollSnapIndexDidChange() const { return m_activeScrollSnapIndexDidChange; }
Modified: trunk/Source/WebCore/platform/ScrollableArea.cpp (278483 => 278484)
--- trunk/Source/WebCore/platform/ScrollableArea.cpp 2021-06-04 19:34:29 UTC (rev 278483)
+++ trunk/Source/WebCore/platform/ScrollableArea.cpp 2021-06-04 19:50:33 UTC (rev 278484)
@@ -50,12 +50,7 @@
#if ASSERT_ENABLED
bool weakPtrFactorWasConstructedOnMainThread;
#endif
-#if ENABLE(CSS_SCROLL_SNAP)
- void* pointers[3];
- unsigned currentIndices[2];
-#else
void* pointer[2];
-#endif
IntPoint origin;
unsigned bitfields : 16;
};
@@ -217,12 +212,6 @@
bool handledEvent = scrollAnimator().handleWheelEvent(wheelEvent);
LOG_WITH_STREAM(Scrolling, stream << "ScrollableArea (" << *this << ") handleWheelEvent - handled " << handledEvent);
-#if ENABLE(CSS_SCROLL_SNAP)
- if (scrollAnimator().activeScrollSnapIndexDidChange()) {
- setCurrentHorizontalSnapPointIndex(scrollAnimator().activeScrollSnapIndexForAxis(ScrollEventAxis::Horizontal));
- setCurrentVerticalSnapPointIndex(scrollAnimator().activeScrollSnapIndexForAxis(ScrollEventAxis::Vertical));
- }
-#endif
return handledEvent;
}
@@ -479,18 +468,11 @@
}
#if ENABLE(CSS_SCROLL_SNAP)
-LayoutScrollSnapOffsetsInfo& ScrollableArea::ensureSnapOffsetsInfo()
+const LayoutScrollSnapOffsetsInfo* ScrollableArea::snapOffsetsInfo() const
{
- if (!m_snapOffsetsInfo)
- m_snapOffsetsInfo = makeUnique<LayoutScrollSnapOffsetsInfo>();
- return *m_snapOffsetsInfo;
+ return existingScrollAnimator() ? existingScrollAnimator()->snapOffsetsInfo() : nullptr;
}
-const LayoutScrollSnapOffsetsInfo* ScrollableArea::snapOffsetInfo() const
-{
- return m_snapOffsetsInfo.get();
-}
-
void ScrollableArea::setScrollSnapOffsetInfo(const LayoutScrollSnapOffsetsInfo& info)
{
if (info.isEmpty()) {
@@ -499,59 +481,62 @@
}
// Consider having a non-empty set of snap offsets as a cue to initialize the ScrollAnimator.
- scrollAnimator();
- ensureSnapOffsetsInfo() = info;
+ scrollAnimator().setSnapOffsetsInfo(info);
}
void ScrollableArea::clearSnapOffsets()
{
- m_snapOffsetsInfo = nullptr;
+ if (auto* scrollAnimator = existingScrollAnimator())
+ return scrollAnimator->setSnapOffsetsInfo(LayoutScrollSnapOffsetsInfo());
}
-bool ScrollableArea::usesScrollSnap() const
+unsigned ScrollableArea::currentHorizontalSnapPointIndex() const
{
- return !!m_snapOffsetsInfo;
+ if (auto* scrollAnimator = existingScrollAnimator())
+ return scrollAnimator->activeScrollSnapIndexForAxis(ScrollEventAxis::Horizontal);
+ return 0; // FIXME: This should really be invalidSnapOffsetIndex.
}
-IntPoint ScrollableArea::nearestActiveSnapPoint(const IntPoint& currentPosition)
+unsigned ScrollableArea::currentVerticalSnapPointIndex() const
{
- if (!m_snapOffsetsInfo)
- return currentPosition;
-
- if (!existingScrollAnimator())
- return currentPosition;
+ if (auto* scrollAnimator = existingScrollAnimator())
+ return scrollAnimator->activeScrollSnapIndexForAxis(ScrollEventAxis::Vertical);
+ return 0; // FIXME: This should really be invalidSnapOffsetIndex.
+}
- IntPoint correctedPosition = currentPosition;
+void ScrollableArea::setCurrentHorizontalSnapPointIndex(unsigned index)
+{
+ scrollAnimator().setActiveScrollSnapIndexForAxis(ScrollEventAxis::Horizontal, index);
+}
- const auto& horizontal = m_snapOffsetsInfo->horizontalSnapOffsets;
- size_t activeHorizontalIndex = currentHorizontalSnapPointIndex();
- if (activeHorizontalIndex < horizontal.size())
- correctedPosition.setX(horizontal[activeHorizontalIndex].offset.toInt());
-
- const auto& vertical = m_snapOffsetsInfo->verticalSnapOffsets;
- size_t activeVerticalIndex = currentVerticalSnapPointIndex();
- if (activeVerticalIndex < vertical.size())
- correctedPosition.setY(vertical[activeVerticalIndex].offset.toInt());
-
- return correctedPosition;
+void ScrollableArea::setCurrentVerticalSnapPointIndex(unsigned index)
+{
+ scrollAnimator().setActiveScrollSnapIndexForAxis(ScrollEventAxis::Vertical, index);
}
-void ScrollableArea::updateScrollSnapState()
+void ScrollableArea::resnapAfterLayout()
{
- if (ScrollAnimator* scrollAnimator = existingScrollAnimator())
- scrollAnimator->updateScrollSnapState();
+ LOG_WITH_STREAM(ScrollSnap, stream << *this << " updateScrollSnapState: isScrollSnapInProgress " << isScrollSnapInProgress() << " isUserScrollInProgress " << isUserScrollInProgress());
- if (!usesScrollSnap())
+ if (!existingScrollAnimator() || isScrollSnapInProgress() || isUserScrollInProgress())
return;
- LOG_WITH_STREAM(ScrollSnap, stream << *this << " updateScrollSnapState: isScrollSnapInProgress " << isScrollSnapInProgress() << " isUserScrollInProgress " << isUserScrollInProgress());
-
- if (isScrollSnapInProgress() || isUserScrollInProgress())
+ const auto* info = snapOffsetsInfo();
+ if (!info)
return;
IntPoint currentPosition = scrollPosition();
- IntPoint correctedPosition = nearestActiveSnapPoint(currentPosition);
+ IntPoint correctedPosition = currentPosition;
+ const auto& horizontal = info->horizontalSnapOffsets;
+ auto activeHorizontalIndex = currentHorizontalSnapPointIndex();
+ if (activeHorizontalIndex < horizontal.size())
+ correctedPosition.setX(horizontal[activeHorizontalIndex].offset.toInt());
+ const auto& vertical = info->verticalSnapOffsets;
+ auto activeVerticalIndex = currentVerticalSnapPointIndex();
+ if (activeVerticalIndex < vertical.size())
+ correctedPosition.setY(vertical[activeVerticalIndex].offset.toInt());
+
if (correctedPosition != currentPosition) {
LOG_WITH_STREAM(ScrollSnap, stream << " adjusting position from " << currentPosition << " to " << correctedPosition);
scrollToPositionWithoutAnimation(correctedPosition);
@@ -560,22 +545,23 @@
void ScrollableArea::doPostThumbMoveSnapping(ScrollbarOrientation orientation)
{
- if (!usesScrollSnap())
+ auto* scrollAnimator = existingScrollAnimator();
+ if (!scrollAnimator)
return;
auto currentOffset = scrollOffset();
auto newOffset = currentOffset;
if (orientation == HorizontalScrollbar)
- newOffset.setX(m_scrollAnimator->adjustScrollOffsetForSnappingIfNeeded(ScrollEventAxis::Horizontal, currentOffset.x(), ScrollSnapPointSelectionMethod::Closest));
+ newOffset.setX(scrollAnimator->adjustScrollOffsetForSnappingIfNeeded(ScrollEventAxis::Horizontal, currentOffset.x(), ScrollSnapPointSelectionMethod::Closest));
else
- newOffset.setY(m_scrollAnimator->adjustScrollOffsetForSnappingIfNeeded(ScrollEventAxis::Vertical, currentOffset.y(), ScrollSnapPointSelectionMethod::Closest));
+ newOffset.setY(scrollAnimator->adjustScrollOffsetForSnappingIfNeeded(ScrollEventAxis::Vertical, currentOffset.y(), ScrollSnapPointSelectionMethod::Closest));
if (newOffset == currentOffset)
return;
- scrollAnimator().scrollToOffsetWithAnimation(newOffset);
+ scrollAnimator->scrollToOffsetWithAnimation(newOffset);
}
#else
-void ScrollableArea::updateScrollSnapState()
+void ScrollableArea::resnapAfterLayout()
{
}
Modified: trunk/Source/WebCore/platform/ScrollableArea.h (278483 => 278484)
--- trunk/Source/WebCore/platform/ScrollableArea.h 2021-06-04 19:34:29 UTC (rev 278483)
+++ trunk/Source/WebCore/platform/ScrollableArea.h 2021-06-04 19:50:33 UTC (rev 278484)
@@ -88,21 +88,18 @@
WEBCORE_EXPORT virtual bool handleWheelEventForScrolling(const PlatformWheelEvent&, std::optional<WheelScrollGestureState>);
- bool usesScrollSnap() const;
-
#if ENABLE(CSS_SCROLL_SNAP)
- WEBCORE_EXPORT const LayoutScrollSnapOffsetsInfo* snapOffsetInfo() const;
virtual void updateSnapOffsets() { };
+ WEBCORE_EXPORT const LayoutScrollSnapOffsetsInfo* snapOffsetsInfo() const;
void setScrollSnapOffsetInfo(const LayoutScrollSnapOffsetsInfo&);
void clearSnapOffsets();
- unsigned currentHorizontalSnapPointIndex() const { return m_currentHorizontalSnapPointIndex; }
- void setCurrentHorizontalSnapPointIndex(unsigned index) { m_currentHorizontalSnapPointIndex = index; }
- unsigned currentVerticalSnapPointIndex() const { return m_currentVerticalSnapPointIndex; }
- void setCurrentVerticalSnapPointIndex(unsigned index) { m_currentVerticalSnapPointIndex = index; }
- IntPoint nearestActiveSnapPoint(const IntPoint&);
+ WEBCORE_EXPORT unsigned currentHorizontalSnapPointIndex() const;
+ WEBCORE_EXPORT unsigned currentVerticalSnapPointIndex() const;
+ WEBCORE_EXPORT void setCurrentHorizontalSnapPointIndex(unsigned);
+ WEBCORE_EXPORT void setCurrentVerticalSnapPointIndex(unsigned);
#endif
- void updateScrollSnapState();
+ void resnapAfterLayout();
void doPostThumbMoveSnapping(ScrollbarOrientation);
#if ENABLE(TOUCH_EVENTS)
@@ -384,13 +381,6 @@
mutable std::unique_ptr<ScrollAnimator> m_scrollAnimator;
-#if ENABLE(CSS_SCROLL_SNAP)
- LayoutScrollSnapOffsetsInfo& ensureSnapOffsetsInfo();
- std::unique_ptr<LayoutScrollSnapOffsetsInfo> m_snapOffsetsInfo;
- unsigned m_currentHorizontalSnapPointIndex { 0 };
- unsigned m_currentVerticalSnapPointIndex { 0 };
-#endif
-
// There are 8 possible combinations of writing mode and direction. Scroll origin will be non-zero in the x or y axis
// if there is any reversed direction or writing-mode. The combinations are:
// writing-mode / direction scrollOrigin.x() set scrollOrigin.y() set
Modified: trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm (278483 => 278484)
--- trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm 2021-06-04 19:34:29 UTC (rev 278483)
+++ trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm 2021-06-04 19:50:33 UTC (rev 278484)
@@ -1303,7 +1303,7 @@
bool eventPreventsStretching = m_scrollableArea.hasScrollableOrRubberbandableAncestor() && wheelEvent.isGestureStart() && m_scrollableArea.isPinnedForScrollDeltaOnAxis(-wheelEvent.deltaY(), ScrollEventAxis::Vertical);
#if ENABLE(CSS_SCROLL_SNAP)
if (!eventPreventsStretching)
- eventPreventsStretching = gestureShouldBeginSnap(wheelEvent, ScrollEventAxis::Vertical, m_scrollableArea.snapOffsetInfo());
+ eventPreventsStretching = gestureShouldBeginSnap(wheelEvent, ScrollEventAxis::Vertical, m_scrollableArea.snapOffsetsInfo());
#endif
return scrollbarsAllowStretching && !eventPreventsStretching;
}
@@ -1327,7 +1327,7 @@
bool eventPreventsStretching = m_scrollableArea.hasScrollableOrRubberbandableAncestor() && wheelEvent.isGestureStart() && m_scrollableArea.isPinnedForScrollDeltaOnAxis(-wheelEvent.deltaX(), ScrollEventAxis::Horizontal);
#if ENABLE(CSS_SCROLL_SNAP)
if (!eventPreventsStretching)
- eventPreventsStretching = gestureShouldBeginSnap(wheelEvent, ScrollEventAxis::Horizontal, m_scrollableArea.snapOffsetInfo());
+ eventPreventsStretching = gestureShouldBeginSnap(wheelEvent, ScrollEventAxis::Horizontal, m_scrollableArea.snapOffsetsInfo());
#endif
return scrollbarsAllowStretching && !eventPreventsStretching;
}
Modified: trunk/Source/WebCore/rendering/RenderLayerScrollableArea.cpp (278483 => 278484)
--- trunk/Source/WebCore/rendering/RenderLayerScrollableArea.cpp 2021-06-04 19:34:29 UTC (rev 278483)
+++ trunk/Source/WebCore/rendering/RenderLayerScrollableArea.cpp 2021-06-04 19:50:33 UTC (rev 278484)
@@ -1213,7 +1213,7 @@
if (canUseCompositedScrolling())
m_layer.setNeedsPostLayoutCompositingUpdate();
- updateScrollSnapState();
+ resnapAfterLayout();
}
bool RenderLayerScrollableArea::overflowControlsIntersectRect(const IntRect& localRect) const
Modified: trunk/Source/WebCore/testing/Internals.cpp (278483 => 278484)
--- trunk/Source/WebCore/testing/Internals.cpp 2021-06-04 19:34:29 UTC (rev 278483)
+++ trunk/Source/WebCore/testing/Internals.cpp 2021-06-04 19:50:33 UTC (rev 278484)
@@ -4736,7 +4736,7 @@
if (!scrollableArea)
return Exception { InvalidAccessError };
- auto* offsetInfo = scrollableArea->snapOffsetInfo();
+ auto* offsetInfo = scrollableArea->snapOffsetsInfo();
StringBuilder result;
if (offsetInfo && !offsetInfo->horizontalSnapOffsets.isEmpty()) {
result.append("horizontal = ");