Title: [96070] trunk
Revision
96070
Author
simon.fra...@apple.com
Date
2011-09-26 22:50:02 -0700 (Mon, 26 Sep 2011)

Log Message

Pixel result shows that compositing/iframes/repaint-after-losing-scrollbars.html is failing
https://bugs.webkit.org/show_bug.cgi?id=67858

Reviewed by Darin Adler.

When non-overlay scrollbars are hidden on a composited iframe, nothing invalidated
the scrollbar areas or the scroll corner, so the scrollbars appear to remain.

Fix by invalidating the scrollbars and scroll corner when they are removed. Invalidation
on scrollbar creation appears to happen via updating the scrollbar style.

Tested by compositing/iframes/repaint-after-losing-scrollbars.html which no longer shows
stale scrollbars when run manually, even though the green squares are missing from the
pixel result (bug 67878).

* page/FrameView.cpp:
(WebCore::FrameView::updateScrollCorner): Pass the corner rect into invalidateScrollCorner().
* platform/ScrollView.cpp:
(WebCore::ScrollView::setHasHorizontalScrollbar): Invalidate the scrollbar area if hiding it.
(WebCore::ScrollView::setHasVerticalScrollbar): Ditto.
(WebCore::ScrollView::updateScrollbars): In the case where both scrollbars are going away,
compute the scroll corner rect while we still have scrollbars, and then invalidate it
explicitly. (updateScrollCorner() doesn't, because it doesn't have access to the old corner
rect.)
* platform/ScrollableArea.cpp:
(WebCore::ScrollableArea::invalidateScrollCorner): Pass the rect in, because we can't
compute it in the case where the scrollbars are going away.
* platform/ScrollableArea.h: Pass in a rect to invalidateScrollCorner(), which matches
invalidateScrollbar().
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::destroyRootLayer): Pass the corner rect into invalidateScrollCorner().
* rendering/RenderScrollbarPart.cpp: Ditto.
(WebCore::RenderScrollbarPart::imageChanged): Ditto.

Modified Paths

Diff

Modified: trunk/LayoutTests/compositing/iframes/repaint-after-losing-scrollbars-expected.png


(Binary files differ)

Modified: trunk/Source/WebCore/ChangeLog (96069 => 96070)


--- trunk/Source/WebCore/ChangeLog	2011-09-27 05:12:24 UTC (rev 96069)
+++ trunk/Source/WebCore/ChangeLog	2011-09-27 05:50:02 UTC (rev 96070)
@@ -1,5 +1,41 @@
 2011-09-09  Simon Fraser  <simon.fra...@apple.com>
 
+        Pixel result shows that compositing/iframes/repaint-after-losing-scrollbars.html is failing
+        https://bugs.webkit.org/show_bug.cgi?id=67858
+
+        Reviewed by Darin Adler.
+        
+        When non-overlay scrollbars are hidden on a composited iframe, nothing invalidated
+        the scrollbar areas or the scroll corner, so the scrollbars appear to remain.
+        
+        Fix by invalidating the scrollbars and scroll corner when they are removed. Invalidation
+        on scrollbar creation appears to happen via updating the scrollbar style.
+
+        Tested by compositing/iframes/repaint-after-losing-scrollbars.html which no longer shows
+        stale scrollbars when run manually, even though the green squares are missing from the
+        pixel result (bug 67878).
+
+        * page/FrameView.cpp:
+        (WebCore::FrameView::updateScrollCorner): Pass the corner rect into invalidateScrollCorner().
+        * platform/ScrollView.cpp:
+        (WebCore::ScrollView::setHasHorizontalScrollbar): Invalidate the scrollbar area if hiding it.
+        (WebCore::ScrollView::setHasVerticalScrollbar): Ditto.
+        (WebCore::ScrollView::updateScrollbars): In the case where both scrollbars are going away,
+        compute the scroll corner rect while we still have scrollbars, and then invalidate it
+        explicitly. (updateScrollCorner() doesn't, because it doesn't have access to the old corner
+        rect.)
+        * platform/ScrollableArea.cpp:
+        (WebCore::ScrollableArea::invalidateScrollCorner): Pass the rect in, because we can't
+        compute it in the case where the scrollbars are going away.
+        * platform/ScrollableArea.h: Pass in a rect to invalidateScrollCorner(), which matches
+        invalidateScrollbar().
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::destroyRootLayer): Pass the corner rect into invalidateScrollCorner().
+        * rendering/RenderScrollbarPart.cpp: Ditto.
+        (WebCore::RenderScrollbarPart::imageChanged): Ditto.
+
+2011-09-09  Simon Fraser  <simon.fra...@apple.com>
+
         Translucent scrollbars on composited layers render incorrectly
         https://bugs.webkit.org/show_bug.cgi?id=58515
 

Modified: trunk/Source/WebCore/page/FrameView.cpp (96069 => 96070)


--- trunk/Source/WebCore/page/FrameView.cpp	2011-09-27 05:12:24 UTC (rev 96069)
+++ trunk/Source/WebCore/page/FrameView.cpp	2011-09-27 05:50:02 UTC (rev 96070)
@@ -2467,8 +2467,9 @@
 {
     RenderObject* renderer = 0;
     RefPtr<RenderStyle> cornerStyle;
+    IntRect cornerRect = scrollCornerRect();
     
-    if (!scrollCornerRect().isEmpty()) {
+    if (!cornerRect.isEmpty()) {
         // Try the <body> element first as a scroll corner source.
         Document* doc = m_frame->document();
         Element* body = doc ? doc->body() : 0;
@@ -2497,7 +2498,7 @@
         if (!m_scrollCorner)
             m_scrollCorner = new (renderer->renderArena()) RenderScrollbarPart(renderer->document());
         m_scrollCorner->setStyle(cornerStyle.release());
-        invalidateScrollCorner();
+        invalidateScrollCorner(cornerRect);
     } else if (m_scrollCorner) {
         m_scrollCorner->destroy();
         m_scrollCorner = 0;

Modified: trunk/Source/WebCore/platform/ScrollView.cpp (96069 => 96070)


--- trunk/Source/WebCore/platform/ScrollView.cpp	2011-09-27 05:12:24 UTC (rev 96069)
+++ trunk/Source/WebCore/platform/ScrollView.cpp	2011-09-27 05:50:02 UTC (rev 96070)
@@ -95,6 +95,7 @@
         didAddHorizontalScrollbar(m_horizontalScrollbar.get());
         m_horizontalScrollbar->styleChanged();
     } else if (!hasBar && m_horizontalScrollbar) {
+        m_horizontalScrollbar->invalidate();
         willRemoveHorizontalScrollbar(m_horizontalScrollbar.get());
         removeChild(m_horizontalScrollbar.get());
         m_horizontalScrollbar = 0;
@@ -113,6 +114,7 @@
         didAddVerticalScrollbar(m_verticalScrollbar.get());
         m_verticalScrollbar->styleChanged();
     } else if (!hasBar && m_verticalScrollbar) {
+        m_verticalScrollbar->invalidate();
         willRemoveVerticalScrollbar(m_verticalScrollbar.get());
         removeChild(m_verticalScrollbar.get());
         m_verticalScrollbar = 0;
@@ -447,6 +449,8 @@
         m_inUpdateScrollbars = false;
     }
 
+    IntRect oldScrollCornerRect = scrollCornerRect();
+
     bool hasHorizontalScrollbar = m_horizontalScrollbar;
     bool hasVerticalScrollbar = m_verticalScrollbar;
     
@@ -573,6 +577,8 @@
         frameRectsChanged();
         positionScrollbarLayers();
         updateScrollCorner();
+        if (!m_horizontalScrollbar && !m_verticalScrollbar)
+            invalidateScrollCornerRect(oldScrollCornerRect);
     }
 
     IntPoint scrollPoint = adjustScrollPositionWithinRange(IntPoint(desiredOffset)) + IntSize(m_scrollOrigin.x(), m_scrollOrigin.y());

Modified: trunk/Source/WebCore/platform/ScrollableArea.cpp (96069 => 96070)


--- trunk/Source/WebCore/platform/ScrollableArea.cpp	2011-09-27 05:12:24 UTC (rev 96069)
+++ trunk/Source/WebCore/platform/ScrollableArea.cpp	2011-09-27 05:50:02 UTC (rev 96070)
@@ -274,7 +274,7 @@
     invalidateScrollbarRect(scrollbar, rect);
 }
 
-void ScrollableArea::invalidateScrollCorner()
+void ScrollableArea::invalidateScrollCorner(const IntRect& rect)
 {
 #if USE(ACCELERATED_COMPOSITING)
     if (GraphicsLayer* graphicsLayer = layerForScrollCorner()) {
@@ -282,7 +282,7 @@
         return;
     }
 #endif
-    invalidateScrollCornerRect(scrollCornerRect());
+    invalidateScrollCornerRect(rect);
 }
 
 bool ScrollableArea::hasLayerForHorizontalScrollbar() const

Modified: trunk/Source/WebCore/platform/ScrollableArea.h (96069 => 96070)


--- trunk/Source/WebCore/platform/ScrollableArea.h	2011-09-27 05:12:24 UTC (rev 96069)
+++ trunk/Source/WebCore/platform/ScrollableArea.h	2011-09-27 05:50:02 UTC (rev 96070)
@@ -89,7 +89,7 @@
     void invalidateScrollbar(Scrollbar*, const IntRect&);
     virtual bool isScrollCornerVisible() const = 0;
     virtual IntRect scrollCornerRect() const = 0;
-    void invalidateScrollCorner();
+    void invalidateScrollCorner(const IntRect&);
     virtual void getTickmarks(Vector<IntRect>&) const { }
 
     // This function should be overriden by subclasses to perform the actual

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (96069 => 96070)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2011-09-27 05:12:24 UTC (rev 96069)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2011-09-27 05:50:02 UTC (rev 96070)
@@ -1786,7 +1786,7 @@
 
     if (m_layerForScrollCorner) {
         m_layerForScrollCorner = nullptr;
-        m_renderView->frameView()->invalidateScrollCorner();
+        m_renderView->frameView()->invalidateScrollCorner(m_renderView->frameView()->scrollCornerRect());
     }
 
     if (m_overflowControlsHostLayer) {

Modified: trunk/Source/WebCore/rendering/RenderScrollbarPart.cpp (96069 => 96070)


--- trunk/Source/WebCore/rendering/RenderScrollbarPart.cpp	2011-09-27 05:12:24 UTC (rev 96069)
+++ trunk/Source/WebCore/rendering/RenderScrollbarPart.cpp	2011-09-27 05:50:02 UTC (rev 96070)
@@ -150,7 +150,7 @@
     else {
         if (FrameView* frameView = view()->frameView()) {
             if (frameView->isFrameViewScrollCorner(this)) {
-                frameView->invalidateScrollCorner();
+                frameView->invalidateScrollCorner(frameView->scrollCornerRect());
                 return;
             }
         }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to