We don't need to always repaint overlay scrollbars if they're in layers
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 27 Jan 2012 00:31:29 +0000 (00:31 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 27 Jan 2012 00:31:29 +0000 (00:31 +0000)
https://bugs.webkit.org/show_bug.cgi?id=77159

Reviewed by Beth Dakin.

If a scrollable area has overlay scrollbars we'll always invalidate both scrollbars, regardless of
whether both scroll offsets actually change since they're translucent and we want to draw the new page
contents underneath.

However, if the scrollbars are painted into GraphicsLayers they'll be composited by the GPU, and so we don't
need to repaint them unless the corresponding scroll offset actually changes (which is handled in Scrollbar::updateThumb).

* platform/ScrollableArea.cpp:
(WebCore::ScrollableArea::setScrollOffsetFromAnimation):

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

Source/WebCore/ChangeLog
Source/WebCore/platform/ScrollableArea.cpp

index 44caf9432874448b808cde64ab6fe66dd8dd4689..47cd87cc9515abe0af3aeee9f2f0ce476edacbcd 100644 (file)
@@ -1,3 +1,20 @@
+2012-01-26  Anders Carlsson  <andersca@apple.com>
+
+        We don't need to always repaint overlay scrollbars if they're in layers
+        https://bugs.webkit.org/show_bug.cgi?id=77159
+
+        Reviewed by Beth Dakin.
+
+        If a scrollable area has overlay scrollbars we'll always invalidate both scrollbars, regardless of
+        whether both scroll offsets actually change since they're translucent and we want to draw the new page
+        contents underneath.
+        
+        However, if the scrollbars are painted into GraphicsLayers they'll be composited by the GPU, and so we don't
+        need to repaint them unless the corresponding scroll offset actually changes (which is handled in Scrollbar::updateThumb).
+
+        * platform/ScrollableArea.cpp:
+        (WebCore::ScrollableArea::setScrollOffsetFromAnimation):
+
 2012-01-26  Joshua Bell  <jsbell@chromium.org>
 
         IndexedDB: WebCore::IDBKey objects are leaked
index 374092eb2e92ede9b3a1b010a219f01f54593898..99b9babc3469f2252f509aeb43881d3ee8b7256d 100644 (file)
@@ -181,7 +181,7 @@ void ScrollableArea::setScrollOffsetFromAnimation(const IntPoint& offset)
     // Tell the scrollbars to update their thumb postions.
     if (Scrollbar* horizontalScrollbar = this->horizontalScrollbar()) {
         horizontalScrollbar->offsetDidChange();
-        if (horizontalScrollbar->isOverlayScrollbar()) {
+        if (horizontalScrollbar->isOverlayScrollbar() && !hasLayerForHorizontalScrollbar()) {
             if (!verticalScrollbar)
                 horizontalScrollbar->invalidate();
             else {
@@ -195,7 +195,7 @@ void ScrollableArea::setScrollOffsetFromAnimation(const IntPoint& offset)
     }
     if (verticalScrollbar) {
         verticalScrollbar->offsetDidChange();
-        if (verticalScrollbar->isOverlayScrollbar())
+        if (verticalScrollbar->isOverlayScrollbar() && !hasLayerForVerticalScrollbar())
             verticalScrollbar->invalidate();
     }
 }