Reviewed by Haytt.
authorthatcher <thatcher@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 20 Apr 2006 02:51:48 +0000 (02:51 +0000)
committerthatcher <thatcher@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 20 Apr 2006 02:51:48 +0000 (02:51 +0000)
        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6770
          REGRESSION: Incomplete repaint when block with clipping grows

        * manual-tests/repaint-resized-overflow.html: Added.
        * rendering/RenderLayer.cpp:
        (WebCore::RenderLayer::RenderLayer):
        (WebCore::RenderLayer::computeRepaintRects): Set the m_repaintOverflowOnResize
        flag to true if our object itself needs layout or if we're an overflow
        and have a normal child that needs layout, in which case if we end up
        resizing it will be because of the child, and that child might have not repainted
        itself correctly during its own layout.
        (WebCore::RenderLayer::updateLayerPositions): Do a full repaint if
        m_repaintOverflowOnResize is set and we resized but didn't move.
        * rendering/RenderLayer.h:

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

WebCore/ChangeLog
WebCore/manual-tests/repaint-resized-overflow.html [new file with mode: 0644]
WebCore/rendering/RenderLayer.cpp
WebCore/rendering/RenderLayer.h

index 03a2b87b0b17b98b3c09695ec4d2c11892b8097b..e70f359ef1f67d5c6c7be24be4a564e29e0877dc 100644 (file)
@@ -1,3 +1,22 @@
+2006-04-19  Mitz Pettel  <opendarwin.org@mitzpettel.com>
+
+        Reviewed by Haytt.
+
+        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6770
+          REGRESSION: Incomplete repaint when block with clipping grows
+
+        * manual-tests/repaint-resized-overflow.html: Added.
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::RenderLayer):
+        (WebCore::RenderLayer::computeRepaintRects): Set the m_repaintOverflowOnResize
+        flag to true if our object itself needs layout or if we're an overflow
+        and have a normal child that needs layout, in which case if we end up
+        resizing it will be because of the child, and that child might have not repainted
+        itself correctly during its own layout.
+        (WebCore::RenderLayer::updateLayerPositions): Do a full repaint if
+        m_repaintOverflowOnResize is set and we resized but didn't move.
+        * rendering/RenderLayer.h:
+
 2006-04-19  Mitz Pettel  <opendarwin.org@mitzpettel.com>
 
         Reviewed by Hyatt.
diff --git a/WebCore/manual-tests/repaint-resized-overflow.html b/WebCore/manual-tests/repaint-resized-overflow.html
new file mode 100644 (file)
index 0000000..7b85102
--- /dev/null
@@ -0,0 +1,36 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+        "http://www.w3.org/TR/html4/strict.dtd">
+<html lang="en">
+<head>
+<script>
+    function test()
+    {
+        document.getElementById("t").style.height='100px';
+    }
+</script>
+</head>
+<body onload="setTimeout(test, 0);">
+<p><b>BUG ID:</b> <a href="http://bugzilla.opendarwin.org/show_bug.cgi?id=6770">Bugzilla bug 6770</a> REGRESSION: Incomplete repaint when block with clipping grows</p>
+
+<p id="test" style="background-color:skyblue; padding:3px;"><b>STEPS TO TEST:</b> 
+Do not resize the window, hide it, scroll, or switch to a different tab. If you do, reload
+the test before proceeding.
+</p>
+
+<p id="success" style="background-color:palegreen; padding:3px;"><b>TEST PASS:</b> 
+There should be a white square with a blue border below, and no line running through
+the middle of the square.
+</p>
+
+<p id="failure" style="background-color:#FF3300; padding:3px;"><b>TEST FAIL:</b>  
+The white square will have a blue border and a blue horizontal line running through its middle.
+</p>
+
+<div style="overflow: hidden;">
+    <div id="s" style="border: 4px solid blue; width: 100px;">
+        <div id="t" style="width: 10px; height: 48px; margin-left: 120px;"></div>
+    </div>
+</div>
+
+</body>
+</html>
index 35bef88a028f7e3d06385fe1784fbc68a2d74f6e..7315b6325156f226303abb726a417948e7d52305 100644 (file)
@@ -138,6 +138,7 @@ m_overflowListDirty(true),
 m_isOverflowOnly(shouldBeOverflowOnly()),
 m_usedTransparency(false),
 m_inOverflowRelayout(false),
+m_repaintOverflowOnResize(false),
 m_marquee(0)
 {
 }
@@ -161,6 +162,7 @@ void RenderLayer::computeRepaintRects()
 {
     // FIXME: Child object could override visibility.
     if (m_object->style()->visibility() == VISIBLE) {
+        m_repaintOverflowOnResize = m_object->selfNeedsLayout() || m_object->hasOverflowClip() && m_object->normalChildNeedsLayout();
         m_object->getAbsoluteRepaintRectIncludingFloats(m_repaintRect, m_fullRepaintRect);
         m_object->absolutePosition(m_repaintX, m_repaintY);
     }
@@ -190,18 +192,20 @@ void RenderLayer::updateLayerPositions(bool doFullRepaint, bool checkForRepaint)
 
     // FIXME: Child object could override visibility.
     if (checkForRepaint && (m_object->style()->visibility() == VISIBLE)) {
-        int x, y;
-        m_object->absolutePosition(x, y);
-        if (x == m_repaintX && y == m_repaintY)
-            m_object->repaintAfterLayoutIfNeeded(m_repaintRect, m_fullRepaintRect);
-        else {
-            RenderCanvas *c = m_object->canvas();
-            if (c && !c->printingMode()) {
-                c->repaintViewRectangle(m_fullRepaintRect);
-                IntRect newRect, newFullRect;
+        RenderCanvas *c = m_object->canvas();
+        if (c && !c->printingMode()) {
+            int x, y;
+            m_object->absolutePosition(x, y);
+            IntRect newRect, newFullRect;
+            bool didMove = x != m_repaintX || y != m_repaintY;
+            if (!didMove && !m_repaintOverflowOnResize)
+                m_object->repaintAfterLayoutIfNeeded(m_repaintRect, m_fullRepaintRect);
+            else {
                 m_object->getAbsoluteRepaintRectIncludingFloats(newRect, newFullRect);
-                if (newRect != m_repaintRect)
+                if (didMove || newRect != m_repaintRect) {
+                    c->repaintViewRectangle(m_fullRepaintRect);
                     c->repaintViewRectangle(newFullRect);
+                }
             }
         }
     }
index b04ce0309925a138a42be0d8b7ac2d29f8a45b4f..21d2bcc32fb48b342555eae305fad39af30d619d 100644 (file)
@@ -397,6 +397,7 @@ protected:
                                  // we ended up painting this layer or any descendants (and therefore need to
                                  // blend).
     bool m_inOverflowRelayout : 1;
+    bool m_repaintOverflowOnResize : 1;
 
     Marquee* m_marquee; // Used by layers with overflow:marquee
 };