Diff
Modified: trunk/Source/WebCore/ChangeLog (276158 => 276159)
--- trunk/Source/WebCore/ChangeLog 2021-04-16 19:26:25 UTC (rev 276158)
+++ trunk/Source/WebCore/ChangeLog 2021-04-16 19:28:28 UTC (rev 276159)
@@ -1,3 +1,16 @@
+2021-04-16 Commit Queue <[email protected]>
+
+ Unreviewed, reverting r273733.
+ https://bugs.webkit.org/show_bug.cgi?id=224686
+
+ Broke mouse wheel scrolling speed
+
+ Reverted changeset:
+
+ "Eliminate ScrollAnimatorGeneric::m_smoothAnimation"
+ https://bugs.webkit.org/show_bug.cgi?id=222588
+ https://trac.webkit.org/changeset/273733
+
2021-04-16 Alex Christensen <[email protected]>
Reduce maximum HashTable entry size to 128 bytes
Modified: trunk/Source/WebCore/platform/ScrollAnimator.cpp (276158 => 276159)
--- trunk/Source/WebCore/platform/ScrollAnimator.cpp 2021-04-16 19:26:25 UTC (rev 276158)
+++ trunk/Source/WebCore/platform/ScrollAnimator.cpp 2021-04-16 19:28:28 UTC (rev 276159)
@@ -57,7 +57,7 @@
#if ENABLE(CSS_SCROLL_SNAP) || ENABLE(RUBBER_BANDING)
, m_scrollController(*this)
#endif
- , m_scrollAnimation(makeUnique<ScrollAnimationSmooth>(
+ , m_animationProgrammaticScroll(makeUnique<ScrollAnimationSmooth>(
[this]() -> ScrollExtents {
return { m_scrollableArea.minimumScrollPosition(), m_scrollableArea.maximumScrollPosition(), m_scrollableArea.visibleSize() };
},
@@ -99,13 +99,6 @@
UNUSED_PARAM(behavior);
#endif
-#if ENABLE(SMOOTH_SCROLLING) && !PLATFORM(IOS_FAMILY)
- if (m_scrollableArea.scrollAnimatorEnabled()) {
- m_scrollAnimation->setCurrentPosition(m_currentPosition);
- return m_scrollAnimation->scroll(orientation, granularity, step, multiplier);
- }
-#endif
-
return scrollToPositionWithoutAnimation(positionFromStep(orientation, step, multiplier));
}
@@ -124,7 +117,6 @@
if (adjustedPosition == currentPosition && adjustedPosition == scrollableArea().scrollPosition() && !scrollableArea().scrollOriginChanged())
return false;
- m_scrollAnimation->setCurrentPosition(adjustedPosition);
m_currentPosition = adjustedPosition;
notifyPositionChanged(adjustedPosition - currentPosition);
updateActiveScrollSnapIndexForOffset();
@@ -142,8 +134,8 @@
if (!positionChanged && !scrollableArea().scrollOriginChanged())
return false;
- m_scrollAnimation->setCurrentPosition(m_currentPosition);
- m_scrollAnimation->scroll(newPosition);
+ m_animationProgrammaticScroll->setCurrentPosition(m_currentPosition);
+ m_animationProgrammaticScroll->scroll(newPosition);
scrollableArea().setScrollBehaviorStatus(ScrollBehaviorStatus::InNonNativeAnimation);
return true;
}
@@ -346,23 +338,23 @@
void ScrollAnimator::cancelAnimations()
{
#if !USE(REQUEST_ANIMATION_FRAME_TIMER)
- m_scrollAnimation->stop();
+ m_animationProgrammaticScroll->stop();
#endif
}
void ScrollAnimator::willEndLiveResize()
{
- m_scrollAnimation->updateVisibleLengths();
+ m_animationProgrammaticScroll->updateVisibleLengths();
}
void ScrollAnimator::didAddVerticalScrollbar(Scrollbar*)
{
- m_scrollAnimation->updateVisibleLengths();
+ m_animationProgrammaticScroll->updateVisibleLengths();
}
void ScrollAnimator::didAddHorizontalScrollbar(Scrollbar*)
{
- m_scrollAnimation->updateVisibleLengths();
+ m_animationProgrammaticScroll->updateVisibleLengths();
}
FloatPoint ScrollAnimator::adjustScrollOffsetForSnappingIfNeeded(const FloatPoint& offset, ScrollSnapPointSelectionMethod method)
Modified: trunk/Source/WebCore/platform/ScrollAnimator.h (276158 => 276159)
--- trunk/Source/WebCore/platform/ScrollAnimator.h 2021-04-16 19:26:25 UTC (rev 276158)
+++ trunk/Source/WebCore/platform/ScrollAnimator.h 2021-04-16 19:28:28 UTC (rev 276159)
@@ -182,7 +182,7 @@
#endif
FloatPoint m_currentPosition;
- std::unique_ptr<ScrollAnimation> m_scrollAnimation;
+ std::unique_ptr<ScrollAnimation> m_animationProgrammaticScroll;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/generic/ScrollAnimatorGeneric.cpp (276158 => 276159)
--- trunk/Source/WebCore/platform/generic/ScrollAnimatorGeneric.cpp 2021-04-16 19:26:25 UTC (rev 276158)
+++ trunk/Source/WebCore/platform/generic/ScrollAnimatorGeneric.cpp 2021-04-16 19:28:28 UTC (rev 276159)
@@ -55,17 +55,70 @@
return { m_scrollableArea.minimumScrollPosition(), m_scrollableArea.maximumScrollPosition(), m_scrollableArea.visibleSize() };
},
[this](FloatPoint&& position) {
- m_scrollAnimation->setCurrentPosition(position);
+#if ENABLE(SMOOTH_SCROLLING)
+ if (m_smoothAnimation)
+ m_smoothAnimation->setCurrentPosition(position);
+#endif
updatePosition(WTFMove(position));
});
+
+#if ENABLE(SMOOTH_SCROLLING)
+ if (scrollableArea.scrollAnimatorEnabled())
+ ensureSmoothScrollingAnimation();
+#endif
}
ScrollAnimatorGeneric::~ScrollAnimatorGeneric() = default;
+#if ENABLE(SMOOTH_SCROLLING)
+void ScrollAnimatorGeneric::ensureSmoothScrollingAnimation()
+{
+ if (m_smoothAnimation) {
+ if (!m_smoothAnimation->isActive())
+ m_smoothAnimation->setCurrentPosition(m_currentPosition);
+ return;
+ }
+
+ m_smoothAnimation = makeUnique<ScrollAnimationSmooth>(
+ [this]() -> ScrollExtents {
+ return { m_scrollableArea.minimumScrollPosition(), m_scrollableArea.maximumScrollPosition(), m_scrollableArea.visibleSize() };
+ },
+ m_currentPosition,
+ [this](FloatPoint&& position) {
+ updatePosition(WTFMove(position));
+ },
+ [this] {
+ m_scrollableArea.setScrollBehaviorStatus(ScrollBehaviorStatus::NotInAnimation);
+ });
+}
+#endif
+
+#if ENABLE(SMOOTH_SCROLLING)
+bool ScrollAnimatorGeneric::scroll(ScrollbarOrientation orientation, ScrollGranularity granularity, float step, float multiplier, ScrollBehavior behavior)
+{
+ if (!m_scrollableArea.scrollAnimatorEnabled())
+ return ScrollAnimator::scroll(orientation, granularity, step, multiplier, behavior);
+
+ // This method doesn't do directional snapping, but our base class does. It will call into
+ // ScrollAnimatorGeneric::scroll again with the snapped positions and ScrollBehavior::Default.
+ if (behavior == ScrollBehavior::DoDirectionalSnapping)
+ return ScrollAnimator::scroll(orientation, granularity, step, multiplier, behavior);
+
+ ensureSmoothScrollingAnimation();
+ return m_smoothAnimation->scroll(orientation, granularity, step, multiplier);
+}
+#endif
+
bool ScrollAnimatorGeneric::scrollToPositionWithoutAnimation(const FloatPoint& position, ScrollClamping clamping)
{
m_kineticAnimation->stop();
m_kineticAnimation->clearScrollHistory();
+
+#if ENABLE(SMOOTH_SCROLLING)
+ if (m_smoothAnimation)
+ m_smoothAnimation->setCurrentPosition(position);
+#endif
+
return ScrollAnimator::scrollToPositionWithoutAnimation(position, clamping);
}
@@ -90,6 +143,14 @@
return ScrollAnimator::handleWheelEvent(event);
}
+void ScrollAnimatorGeneric::willEndLiveResize()
+{
+#if ENABLE(SMOOTH_SCROLLING)
+ if (m_smoothAnimation)
+ m_smoothAnimation->updateVisibleLengths();
+#endif
+}
+
void ScrollAnimatorGeneric::updatePosition(FloatPoint&& position)
{
FloatSize delta = position - m_currentPosition;
@@ -100,8 +161,10 @@
void ScrollAnimatorGeneric::didAddVerticalScrollbar(Scrollbar* scrollbar)
{
- ScrollAnimator::didAddVerticalScrollbar(scrollbar);
-
+#if ENABLE(SMOOTH_SCROLLING)
+ if (m_smoothAnimation)
+ m_smoothAnimation->updateVisibleLengths();
+#endif
if (!scrollbar->isOverlayScrollbar())
return;
m_verticalOverlayScrollbar = scrollbar;
@@ -113,8 +176,10 @@
void ScrollAnimatorGeneric::didAddHorizontalScrollbar(Scrollbar* scrollbar)
{
- ScrollAnimator::didAddHorizontalScrollbar(scrollbar);
-
+#if ENABLE(SMOOTH_SCROLLING)
+ if (m_smoothAnimation)
+ m_smoothAnimation->updateVisibleLengths();
+#endif
if (!scrollbar->isOverlayScrollbar())
return;
m_horizontalOverlayScrollbar = scrollbar;
Modified: trunk/Source/WebCore/platform/generic/ScrollAnimatorGeneric.h (276158 => 276159)
--- trunk/Source/WebCore/platform/generic/ScrollAnimatorGeneric.h 2021-04-16 19:26:25 UTC (rev 276158)
+++ trunk/Source/WebCore/platform/generic/ScrollAnimatorGeneric.h 2021-04-16 19:28:28 UTC (rev 276159)
@@ -44,7 +44,11 @@
virtual ~ScrollAnimatorGeneric();
private:
+#if ENABLE(SMOOTH_SCROLLING)
+ bool scroll(ScrollbarOrientation, ScrollGranularity, float step, float multiplier, ScrollBehavior) override;
+#endif
bool scrollToPositionWithoutAnimation(const FloatPoint&, ScrollClamping) override;
+ void willEndLiveResize() override;
bool handleWheelEvent(const PlatformWheelEvent&) override;
@@ -68,6 +72,11 @@
void hideOverlayScrollbars();
void updateOverlayScrollbarsOpacity();
+#if ENABLE(SMOOTH_SCROLLING)
+ void ensureSmoothScrollingAnimation();
+
+ std::unique_ptr<ScrollAnimation> m_smoothAnimation;
+#endif
std::unique_ptr<ScrollAnimationKinetic> m_kineticAnimation;
Scrollbar* m_horizontalOverlayScrollbar { nullptr };
Scrollbar* m_verticalOverlayScrollbar { nullptr };