Always-visible scrollbars continuously repaint after non-momentum scrollling
authorbdakin@apple.com <bdakin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 30 Apr 2014 22:05:15 +0000 (22:05 +0000)
committerbdakin@apple.com <bdakin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 30 Apr 2014 22:05:15 +0000 (22:05 +0000)
https://bugs.webkit.org/show_bug.cgi?id=132403
-and corresponding-
<rdar://problem/16553878>

Reviewed by Simon Fraser.

No longer universally opt into presentation value mode whenever the scroll
position changes on the scrolling thread. We really only want it for momentum
scrolls, and this will ensure that we always set it to NO once we have set it to
YES.
* page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm:
(WebCore::ScrollingTreeScrollingNodeMac::handleWheelEvent):
(WebCore::ScrollingTreeScrollingNodeMac::setScrollLayerPosition):

Expose shouldUsePresentationValue.
* platform/mac/NSScrollerImpDetails.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@168049 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm
Source/WebCore/platform/mac/NSScrollerImpDetails.h

index acb394d..10e3e65 100644 (file)
@@ -1,3 +1,23 @@
+2014-04-30  Beth Dakin  <bdakin@apple.com>
+
+        Always-visible scrollbars continuously repaint after non-momentum scrollling
+        https://bugs.webkit.org/show_bug.cgi?id=132403
+        -and corresponding-
+        <rdar://problem/16553878>
+
+        Reviewed by Simon Fraser.
+
+        No longer universally opt into presentation value mode whenever the scroll 
+        position changes on the scrolling thread. We really only want it for momentum 
+        scrolls, and this will ensure that we always set it to NO once we have set it to 
+        YES.
+        * page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm:
+        (WebCore::ScrollingTreeScrollingNodeMac::handleWheelEvent):
+        (WebCore::ScrollingTreeScrollingNodeMac::setScrollLayerPosition):
+
+        Expose shouldUsePresentationValue.
+        * platform/mac/NSScrollerImpDetails.h:
+
 2014-04-30  Anders Carlsson  <andersca@apple.com>
 
         Move the legacy WebKit API into WebKitLegacy.framework and move it inside WebKit.framework
index 4f4d7f6..2709aa2 100644 (file)
@@ -136,13 +136,13 @@ void ScrollingTreeScrollingNodeMac::handleWheelEvent(const PlatformWheelEvent& w
     if (!canHaveScrollbars())
         return;
 
+    if (wheelEvent.momentumPhase() == PlatformWheelEventPhaseBegan) {
+        [m_verticalScrollbarPainter setUsePresentationValue:YES];
+        [m_horizontalScrollbarPainter setUsePresentationValue:YES];
+    }
     if (wheelEvent.momentumPhase() == PlatformWheelEventPhaseEnded || wheelEvent.momentumPhase() == PlatformWheelEventPhaseCancelled) {
-        // If the wheel event is ending or cancelled, then we can tell the ScrollbarPainter API that we won't
-        // be updating the position from our scrolling thread anymore for the time being.
-        if (m_verticalScrollbarPainter)
-            [m_verticalScrollbarPainter setUsePresentationValue:NO];
-        if (m_horizontalScrollbarPainter)
-            [m_horizontalScrollbarPainter setUsePresentationValue:NO];
+        [m_verticalScrollbarPainter setUsePresentationValue:NO];
+        [m_horizontalScrollbarPainter setUsePresentationValue:NO];
     }
 
     m_scrollElasticityController.handleWheelEvent(wheelEvent);
@@ -371,16 +371,14 @@ void ScrollingTreeScrollingNodeMac::setScrollLayerPosition(const FloatPoint& pos
         [CATransaction begin];
         [CATransaction lock];
 
-        if (m_verticalScrollbarPainter) {
-            [m_verticalScrollbarPainter setUsePresentationValue:YES];
+        if ([m_verticalScrollbarPainter shouldUsePresentationValue]) {
             float presentationValue;
             float overhangAmount;
             ScrollableArea::computeScrollbarValueAndOverhang(position.y(), totalContentsSize().height(), viewportRect.height(), presentationValue, overhangAmount);
             [m_verticalScrollbarPainter setPresentationValue:presentationValue];
         }
 
-        if (m_horizontalScrollbarPainter) {
-            [m_horizontalScrollbarPainter setUsePresentationValue:YES];
+        if ([m_horizontalScrollbarPainter shouldUsePresentationValue]) {
             float presentationValue;
             float overhangAmount;
             ScrollableArea::computeScrollbarValueAndOverhang(position.x(), totalContentsSize().width(), viewportRect.width(), presentationValue, overhangAmount);
index c55a3e2..5587dcf 100644 (file)
@@ -40,6 +40,7 @@
 - (void)setBoundsSize:(NSSize)boundsSize;
 - (void)setDoubleValue:(double)doubleValue;
 - (void)setPresentationValue:(double)presentationValue;
+- (BOOL)shouldUsePresentationValue;
 - (void)setUsePresentationValue:(BOOL)usePresentationValue;
 - (void)setKnobProportion:(CGFloat)proportion;
 - (void)setKnobStyle:(NSScrollerKnobStyle)knobStyle;