Title: [184513] trunk/Source/WebCore
Revision
184513
Author
[email protected]
Date
2015-05-18 15:01:23 -0700 (Mon, 18 May 2015)

Log Message

REGRESSION(142590): Scroll-snap points are improperly snapping to earlier index values
https://bugs.webkit.org/show_bug.cgi?id=145140
<rdar://problem/21006738>

Reviewed by Beth Dakin.

The new "nearestActiveSnapPoint" logic is firing while scroll snap animations are running. We need
to add an "isScrollSnapInProgress" predicate, much like the existing "isRubberBandInProgress" to avoid
certain "fix-up" logic that we don't want running while we are in the process of moving to a new position.

* platform/ScrollAnimator.h:
(WebCore::ScrollAnimator::ScrollAnimator::isScrollSnapInProgress): Added.
* platform/ScrollableArea.cpp:
(WebCore::ScrollableArea::updateScrollSnapState): If we are in the midst of a scroll snap operation,
do not attempt to reset position to the current active snap point.
* platform/cocoa/ScrollController.h:
* platform/cocoa/ScrollController.mm:
(WebCore::ScrollController::isScrollSnapInProgress): Added.
* platform/mac/ScrollAnimatorMac.h:
* platform/mac/ScrollAnimatorMac.mm:
(WebCore::ScrollAnimatorMac::isScrollSnapInProgress): Added.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (184512 => 184513)


--- trunk/Source/WebCore/ChangeLog	2015-05-18 21:28:52 UTC (rev 184512)
+++ trunk/Source/WebCore/ChangeLog	2015-05-18 22:01:23 UTC (rev 184513)
@@ -1,3 +1,27 @@
+2015-05-18  Brent Fulgham  <[email protected]>
+
+        REGRESSION(142590): Scroll-snap points are improperly snapping to earlier index values
+        https://bugs.webkit.org/show_bug.cgi?id=145140
+        <rdar://problem/21006738>
+
+        Reviewed by Beth Dakin.
+
+        The new "nearestActiveSnapPoint" logic is firing while scroll snap animations are running. We need
+        to add an "isScrollSnapInProgress" predicate, much like the existing "isRubberBandInProgress" to avoid
+        certain "fix-up" logic that we don't want running while we are in the process of moving to a new position.
+
+        * platform/ScrollAnimator.h:
+        (WebCore::ScrollAnimator::ScrollAnimator::isScrollSnapInProgress): Added.
+        * platform/ScrollableArea.cpp:
+        (WebCore::ScrollableArea::updateScrollSnapState): If we are in the midst of a scroll snap operation,
+        do not attempt to reset position to the current active snap point.
+        * platform/cocoa/ScrollController.h:
+        * platform/cocoa/ScrollController.mm:
+        (WebCore::ScrollController::isScrollSnapInProgress): Added.
+        * platform/mac/ScrollAnimatorMac.h:
+        * platform/mac/ScrollAnimatorMac.mm:
+        (WebCore::ScrollAnimatorMac::isScrollSnapInProgress): Added.
+
 2015-05-17  Manuel Rego Casasnovas  <[email protected]>
 
         [CSS Grid Layout] Add scrollbar width in intrinsic logical widths computation

Modified: trunk/Source/WebCore/platform/ScrollAnimator.h (184512 => 184513)


--- trunk/Source/WebCore/platform/ScrollAnimator.h	2015-05-18 21:28:52 UTC (rev 184512)
+++ trunk/Source/WebCore/platform/ScrollAnimator.h	2015-05-18 22:01:23 UTC (rev 184513)
@@ -118,6 +118,7 @@
     virtual void notifyContentAreaScrolled(const FloatSize& delta) { UNUSED_PARAM(delta); }
 
     virtual bool isRubberBandInProgress() const { return false; }
+    virtual bool isScrollSnapInProgress() const { return false; }
 
     void setWheelEventTestTrigger(RefPtr<WheelEventTestTrigger>&& testTrigger) { m_wheelEventTestTrigger = testTrigger; }
 #if (ENABLE(CSS_SCROLL_SNAP) || ENABLE(RUBBER_BANDING)) && PLATFORM(MAC)

Modified: trunk/Source/WebCore/platform/ScrollableArea.cpp (184512 => 184513)


--- trunk/Source/WebCore/platform/ScrollableArea.cpp	2015-05-18 21:28:52 UTC (rev 184512)
+++ trunk/Source/WebCore/platform/ScrollableArea.cpp	2015-05-18 22:01:23 UTC (rev 184513)
@@ -458,8 +458,11 @@
 void ScrollableArea::updateScrollSnapState()
 {
 #if PLATFORM(MAC)
-    if (ScrollAnimator* scrollAnimator = existingScrollAnimator())
+    if (ScrollAnimator* scrollAnimator = existingScrollAnimator()) {
         scrollAnimator->updateScrollAnimatorsAndTimers();
+        if (scrollAnimator->isScrollSnapInProgress())
+            return;
+    }
 #endif
 
     IntPoint currentPosition = scrollPosition();

Modified: trunk/Source/WebCore/platform/cocoa/ScrollController.h (184512 => 184513)


--- trunk/Source/WebCore/platform/cocoa/ScrollController.h	2015-05-18 21:28:52 UTC (rev 184512)
+++ trunk/Source/WebCore/platform/cocoa/ScrollController.h	2015-05-18 22:01:23 UTC (rev 184513)
@@ -114,6 +114,7 @@
     bool handleWheelEvent(const PlatformWheelEvent&);
 
     bool isRubberBandInProgress() const;
+    bool isScrollSnapInProgress() const;
 
 #if ENABLE(CSS_SCROLL_SNAP) && PLATFORM(MAC)
     bool processWheelEventForScrollSnap(const PlatformWheelEvent&);

Modified: trunk/Source/WebCore/platform/cocoa/ScrollController.mm (184512 => 184513)


--- trunk/Source/WebCore/platform/cocoa/ScrollController.mm	2015-05-18 21:28:52 UTC (rev 184512)
+++ trunk/Source/WebCore/platform/cocoa/ScrollController.mm	2015-05-18 22:01:23 UTC (rev 184513)
@@ -404,6 +404,15 @@
     return !m_client.stretchAmount().isZero();
 }
 
+bool ScrollController::isScrollSnapInProgress() const
+{
+#if ENABLE(CSS_SCROLL_SNAP) && PLATFORM(MAC)
+    if (m_inScrollGesture || m_momentumScrollInProgress || m_horizontalScrollSnapTimer.isActive() || m_verticalScrollSnapTimer.isActive())
+        return true;
+#endif
+    return false;
+}
+
 void ScrollController::startSnapRubberbandTimer()
 {
     m_client.startSnapRubberbandTimer();

Modified: trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.h (184512 => 184513)


--- trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.h	2015-05-18 21:28:52 UTC (rev 184512)
+++ trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.h	2015-05-18 22:01:23 UTC (rev 184513)
@@ -132,7 +132,8 @@
 
     void immediateScrollTo(const FloatPoint&);
 
-    virtual bool isRubberBandInProgress() const override;
+    bool isRubberBandInProgress() const override;
+    bool isScrollSnapInProgress() const override;
 
 #if ENABLE(RUBBER_BANDING)
     /// ScrollControllerClient member functions.

Modified: trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm (184512 => 184513)


--- trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm	2015-05-18 21:28:52 UTC (rev 184512)
+++ trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm	2015-05-18 22:01:23 UTC (rev 184513)
@@ -769,6 +769,15 @@
 #endif
 }
 
+bool ScrollAnimatorMac::isScrollSnapInProgress() const
+{
+#if ENABLE(CSS_SCROLL_SNAP)
+    return m_scrollController.isScrollSnapInProgress();
+#else
+    return false;
+#endif
+}
+
 void ScrollAnimatorMac::immediateScrollToPointForScrollAnimation(const FloatPoint& newPosition)
 {
     ASSERT(m_scrollAnimationHelper);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to