Title: [185431] trunk/Source/WebCore
Revision
185431
Author
[email protected]
Date
2015-06-10 14:53:42 -0700 (Wed, 10 Jun 2015)

Log Message

Overriding the overlay scrollbar style on WKView doesn't take effect immediately
https://bugs.webkit.org/show_bug.cgi?id=145855
-and corresponding-
rdar://problem/20948706

Reviewed by Simon Fraser.

Since we opt into layer-per-part scrollbars in order to move the knob on the 
secondary thread, AppKit is creating its own layers for the knob and track. To 
invalidate them, we need to call into the ScrollbarPainter’s setNeedsDisplay.

New virtual function on ScrollAnimator to call into ScrollbarPainter’s 
setNeedsDispay.
* platform/ScrollAnimator.h:

Call the new function when setting the overlay style.
* platform/ScrollableArea.cpp:
(WebCore::ScrollableArea::setScrollbarOverlayStyle):

Add setNeedsDisplay to the list of ScrollbarPainter methods.
* platform/mac/NSScrollerImpDetails.h:

Implement invalidateScrollbarPartLayers.
* platform/mac/ScrollAnimatorMac.h:
* platform/mac/ScrollAnimatorMac.mm:
(WebCore::ScrollAnimatorMac::invalidateScrollbarPartLayers):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (185430 => 185431)


--- trunk/Source/WebCore/ChangeLog	2015-06-10 21:30:23 UTC (rev 185430)
+++ trunk/Source/WebCore/ChangeLog	2015-06-10 21:53:42 UTC (rev 185431)
@@ -1,3 +1,32 @@
+2015-06-10  Beth Dakin  <[email protected]>
+
+        Overriding the overlay scrollbar style on WKView doesn't take effect immediately
+        https://bugs.webkit.org/show_bug.cgi?id=145855
+        -and corresponding-
+        rdar://problem/20948706
+
+        Reviewed by Simon Fraser.
+
+        Since we opt into layer-per-part scrollbars in order to move the knob on the 
+        secondary thread, AppKit is creating its own layers for the knob and track. To 
+        invalidate them, we need to call into the ScrollbarPainter’s setNeedsDisplay.
+
+        New virtual function on ScrollAnimator to call into ScrollbarPainter’s 
+        setNeedsDispay.
+        * platform/ScrollAnimator.h:
+
+        Call the new function when setting the overlay style.
+        * platform/ScrollableArea.cpp:
+        (WebCore::ScrollableArea::setScrollbarOverlayStyle):
+
+        Add setNeedsDisplay to the list of ScrollbarPainter methods.
+        * platform/mac/NSScrollerImpDetails.h:
+
+        Implement invalidateScrollbarPartLayers.
+        * platform/mac/ScrollAnimatorMac.h:
+        * platform/mac/ScrollAnimatorMac.mm:
+        (WebCore::ScrollAnimatorMac::invalidateScrollbarPartLayers):
+
 2015-06-10  Matt Rajca  <[email protected]>
 
         MediaRemoteControls should be marked JSGenerateToJSObject.

Modified: trunk/Source/WebCore/platform/ScrollAnimator.h (185430 => 185431)


--- trunk/Source/WebCore/platform/ScrollAnimator.h	2015-06-10 21:30:23 UTC (rev 185430)
+++ trunk/Source/WebCore/platform/ScrollAnimator.h	2015-06-10 21:53:42 UTC (rev 185431)
@@ -110,6 +110,8 @@
     virtual void didAddHorizontalScrollbar(Scrollbar*) { }
     virtual void willRemoveHorizontalScrollbar(Scrollbar*) { }
 
+    virtual void invalidateScrollbarPartLayers(Scrollbar*) { }
+
     virtual void verticalScrollbarLayerDidChange() { }
     virtual void horizontalScrollbarLayerDidChange() { }
 

Modified: trunk/Source/WebCore/platform/ScrollableArea.cpp (185430 => 185431)


--- trunk/Source/WebCore/platform/ScrollableArea.cpp	2015-06-10 21:30:23 UTC (rev 185430)
+++ trunk/Source/WebCore/platform/ScrollableArea.cpp	2015-06-10 21:53:42 UTC (rev 185431)
@@ -341,11 +341,15 @@
     if (horizontalScrollbar()) {
         ScrollbarTheme::theme()->updateScrollbarOverlayStyle(horizontalScrollbar());
         horizontalScrollbar()->invalidate();
+        if (ScrollAnimator* scrollAnimator = existingScrollAnimator())
+            scrollAnimator->invalidateScrollbarPartLayers(horizontalScrollbar());
     }
     
     if (verticalScrollbar()) {
         ScrollbarTheme::theme()->updateScrollbarOverlayStyle(verticalScrollbar());
         verticalScrollbar()->invalidate();
+        if (ScrollAnimator* scrollAnimator = existingScrollAnimator())
+            scrollAnimator->invalidateScrollbarPartLayers(verticalScrollbar());
     }
 }
 

Modified: trunk/Source/WebCore/platform/mac/NSScrollerImpDetails.h (185430 => 185431)


--- trunk/Source/WebCore/platform/mac/NSScrollerImpDetails.h	2015-06-10 21:30:23 UTC (rev 185430)
+++ trunk/Source/WebCore/platform/mac/NSScrollerImpDetails.h	2015-06-10 21:53:42 UTC (rev 185431)
@@ -62,6 +62,9 @@
 - (void)drawKnob;
 - (void)mouseEnteredScroller;
 - (void)mouseExitedScroller;
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
+- (void)setNeedsDisplay:(BOOL)flag;
+#endif
 @end
 
 @interface NSObject (ScrollbarPainterController)

Modified: trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.h (185430 => 185431)


--- trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.h	2015-06-10 21:30:23 UTC (rev 185430)
+++ trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.h	2015-06-10 21:53:42 UTC (rev 185431)
@@ -115,6 +115,8 @@
     virtual void didAddHorizontalScrollbar(Scrollbar*);
     virtual void willRemoveHorizontalScrollbar(Scrollbar*);
 
+    void invalidateScrollbarPartLayers(Scrollbar*) override;
+
     virtual void verticalScrollbarLayerDidChange();
     virtual void horizontalScrollbarLayerDidChange();
 

Modified: trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm (185430 => 185431)


--- trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm	2015-06-10 21:30:23 UTC (rev 185430)
+++ trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm	2015-06-10 21:53:42 UTC (rev 185431)
@@ -1011,6 +1011,18 @@
     [m_scrollbarPainterController setHorizontalScrollerImp:nil];
 }
 
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
+void ScrollAnimatorMac::invalidateScrollbarPartLayers(Scrollbar* scrollbar)
+{
+    ScrollbarPainter painter = scrollbarPainterForScrollbar(scrollbar);
+    [painter setNeedsDisplay:YES];
+}
+#else
+void ScrollAnimatorMac::invalidateScrollbarPartLayers(Scrollbar*)
+{
+}
+#endif
+
 void ScrollAnimatorMac::verticalScrollbarLayerDidChange()
 {
     GraphicsLayer* layer = m_scrollableArea.layerForVerticalScrollbar();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to