REGRESSION: Horizontal scrollbar thumbs leave artifacts over page content when scroll...
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 5 Feb 2011 02:18:39 +0000 (02:18 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 5 Feb 2011 02:18:39 +0000 (02:18 +0000)
<rdar://problem/8962457>

Reviewed by Sam Weinig and Beth Dakin.

* platform/ScrollView.cpp:
(WebCore::ScrollView::scrollContents):
Subtract scrollbars from the scroll view rect if overlay scrollers are enabled.

* platform/ScrollableArea.cpp:
(WebCore::ScrollableArea::setScrollOffsetFromAnimation):
Make sure to invalidate both scrollbars if overlay scrollers are enabled.

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

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

index ecab65ea104f9c6086cec13540409f3434ef217d..7aa4341c1b82148d835785a0fc959299c824aa4e 100644 (file)
@@ -1,3 +1,18 @@
+2011-02-04  Anders Carlsson  <andersca@apple.com>
+
+        Reviewed by Sam Weinig and Beth Dakin.
+
+        REGRESSION: Horizontal scrollbar thumbs leave artifacts over page content when scrolling vertically
+        <rdar://problem/8962457>
+
+        * platform/ScrollView.cpp:
+        (WebCore::ScrollView::scrollContents):
+        Subtract scrollbars from the scroll view rect if overlay scrollers are enabled.
+        
+        * platform/ScrollableArea.cpp:
+        (WebCore::ScrollableArea::setScrollOffsetFromAnimation):
+        Make sure to invalidate both scrollbars if overlay scrollers are enabled.
+
 2011-02-04  Adam Barth  <abarth@webkit.org>
 
         Reviewed by Eric Seidel.
index e3d6b1cd85a721d480fbf684b00fae3804553c21..382fef94b6fe230e87558f0f7ec81bf0ace3b453 100644 (file)
@@ -594,6 +594,14 @@ void ScrollView::scrollContents(const IntSize& scrollDelta)
     // with the clip rect every time to keep it smooth.
     IntRect clipRect = windowClipRect();
     IntRect scrollViewRect = convertToContainingWindow(IntRect(0, 0, visibleWidth(), visibleHeight()));
+    if (ScrollbarTheme::nativeTheme()->usesOverlayScrollbars()) {
+        int verticalScrollbarWidth = verticalScrollbar() ? verticalScrollbar()->width() : 0;
+        int horizontalScrollbarHeight = horizontalScrollbar() ? horizontalScrollbar()->height() : 0;
+
+        scrollViewRect.setWidth(scrollViewRect.width() - verticalScrollbarWidth);
+        scrollViewRect.setHeight(scrollViewRect.height() - horizontalScrollbarHeight);
+    }
+    
     IntRect updateRect = clipRect;
     updateRect.intersect(scrollViewRect);
 
index 1dad741988c1e50f9a8fe5e753e1121d87d96cc7..03c47eea76a2e8a67393252692f6e5e9d4f586a9 100644 (file)
@@ -35,6 +35,7 @@
 #include "FloatPoint.h"
 #include "PlatformWheelEvent.h"
 #include "ScrollAnimator.h"
+#include "ScrollbarTheme.h"
 #include <wtf/PassOwnPtr.h>
 
 namespace WebCore {
@@ -127,11 +128,19 @@ void ScrollableArea::setScrollOffsetFromAnimation(const IntPoint& offset)
     // Tell the derived class to scroll its contents.
     setScrollOffset(offset);
 
+    bool hasOverlayScrollbars = ScrollbarTheme::nativeTheme()->usesOverlayScrollbars();
+
     // Tell the scrollbars to update their thumb postions.
-    if (Scrollbar* horizontalScrollbar = this->horizontalScrollbar())
+    if (Scrollbar* horizontalScrollbar = this->horizontalScrollbar()) {
         horizontalScrollbar->offsetDidChange();
-    if (Scrollbar* verticalScrollbar = this->verticalScrollbar())
+        if (hasOverlayScrollbars)
+            horizontalScrollbar->invalidate();
+    }
+    if (Scrollbar* verticalScrollbar = this->verticalScrollbar()) {
         verticalScrollbar->offsetDidChange();
+        if (hasOverlayScrollbars)
+            verticalScrollbar->invalidate();
+    }
 }
 
 void ScrollableArea::willStartLiveResize()