Title: [96138] trunk
Revision
96138
Author
simon.fra...@apple.com
Date
2011-09-27 12:00:56 -0700 (Tue, 27 Sep 2011)

Log Message

https://bugs.webkit.org/show_bug.cgi?id=67858

Roll r96070 back in now that the crash has been fixed in r96130.

Source/WebCore:

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.

LayoutTests:

* compositing/iframes/repaint-after-losing-scrollbars-expected.png:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (96137 => 96138)


--- trunk/LayoutTests/ChangeLog	2011-09-27 18:44:15 UTC (rev 96137)
+++ trunk/LayoutTests/ChangeLog	2011-09-27 19:00:56 UTC (rev 96138)
@@ -1,3 +1,11 @@
+2011-09-27  Simon Fraser  <simon.fra...@apple.com>
+
+        https://bugs.webkit.org/show_bug.cgi?id=67858
+
+        Roll r96070 back in now that the crash has been fixed in r96130.
+
+        * compositing/iframes/repaint-after-losing-scrollbars-expected.png:
+
 2011-09-27  Kaustubh Atrawalkar  <kaust...@motorola.com>
 
         Autofocus on readonly inputs does not focus the element.

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


(Binary files differ)

Modified: trunk/Source/WebCore/ChangeLog (96137 => 96138)


--- trunk/Source/WebCore/ChangeLog	2011-09-27 18:44:15 UTC (rev 96137)
+++ trunk/Source/WebCore/ChangeLog	2011-09-27 19:00:56 UTC (rev 96138)
@@ -1,3 +1,40 @@
+2011-09-27  Simon Fraser  <simon.fra...@apple.com>
+
+        https://bugs.webkit.org/show_bug.cgi?id=67858
+
+        Roll r96070 back in now that the crash has been fixed in r96130.
+
+        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-27  Mihai Parparita  <mih...@chromium.org>
 
         Fix Chromium Mac build after r96130.

Modified: trunk/Source/WebCore/page/FrameView.cpp (96137 => 96138)


--- trunk/Source/WebCore/page/FrameView.cpp	2011-09-27 18:44:15 UTC (rev 96137)
+++ trunk/Source/WebCore/page/FrameView.cpp	2011-09-27 19:00:56 UTC (rev 96138)
@@ -2477,8 +2477,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;
@@ -2507,7 +2508,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 (96137 => 96138)


--- trunk/Source/WebCore/platform/ScrollView.cpp	2011-09-27 18:44:15 UTC (rev 96137)
+++ trunk/Source/WebCore/platform/ScrollView.cpp	2011-09-27 19:00:56 UTC (rev 96138)
@@ -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 (96137 => 96138)


--- trunk/Source/WebCore/platform/ScrollableArea.cpp	2011-09-27 18:44:15 UTC (rev 96137)
+++ trunk/Source/WebCore/platform/ScrollableArea.cpp	2011-09-27 19:00:56 UTC (rev 96138)
@@ -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 (96137 => 96138)


--- trunk/Source/WebCore/platform/ScrollableArea.h	2011-09-27 18:44:15 UTC (rev 96137)
+++ trunk/Source/WebCore/platform/ScrollableArea.h	2011-09-27 19:00:56 UTC (rev 96138)
@@ -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 (96137 => 96138)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2011-09-27 18:44:15 UTC (rev 96137)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2011-09-27 19:00:56 UTC (rev 96138)
@@ -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 (96137 => 96138)


--- trunk/Source/WebCore/rendering/RenderScrollbarPart.cpp	2011-09-27 18:44:15 UTC (rev 96137)
+++ trunk/Source/WebCore/rendering/RenderScrollbarPart.cpp	2011-09-27 19:00:56 UTC (rev 96138)
@@ -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