Fix by Mitz Pettel, reviewed by Darin, landed by ap.
authorap <ap@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 26 Jan 2006 12:06:08 +0000 (12:06 +0000)
committerap <ap@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 26 Jan 2006 12:06:08 +0000 (12:06 +0000)
        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6388
          REGRESSION: Incomplete repaint when dragging the map on Google maps

        * manual-tests/bugzilla-6388.html: Added.
        * rendering/render_layer.cpp:
        (WebCore::RenderLayer::computeRepaintRects): Cache the object's absolute position
        before update.
        (WebCore::RenderLayer::updateLayerPositions): Use the cached position to determine if
        the object moved. If it did, do a full repaint.
        * rendering/render_layer.h:

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

WebCore/ChangeLog
WebCore/manual-tests/bugzilla-6388.html [new file with mode: 0644]
WebCore/rendering/render_layer.cpp
WebCore/rendering/render_layer.h

index 9aa1c9e87fba42a22ecd527b2d74d385f1fe49f4..656fd5b1b25137c4f44f05f5d3debea33cfd066c 100644 (file)
@@ -1,3 +1,18 @@
+2006-01-26  Mitz Pettel  <opendarwin.org@mitzpettel.com>
+
+        Reviewed by Darin, landed by ap.
+        
+        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6388
+          REGRESSION: Incomplete repaint when dragging the map on Google maps
+
+        * manual-tests/bugzilla-6388.html: Added.
+        * rendering/render_layer.cpp:
+        (WebCore::RenderLayer::computeRepaintRects): Cache the object's absolute position
+        before update.
+        (WebCore::RenderLayer::updateLayerPositions): Use the cached position to determine if
+        the object moved. If it did, do a full repaint.
+        * rendering/render_layer.h:
+
 2006-01-26  Eric Seidel  <eseidel@apple.com>
 
         Fixes xcode project to better notice when generated files change.
diff --git a/WebCore/manual-tests/bugzilla-6388.html b/WebCore/manual-tests/bugzilla-6388.html
new file mode 100644 (file)
index 0000000..668f8fa
--- /dev/null
@@ -0,0 +1,31 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+        "http://www.w3.org/TR/html4/strict.dtd">
+<html lang="en">
+<head>
+</head>
+<body>
+<p><b>BUG ID:</b> <a href="http://bugzilla.opendarwin.org/show_bug.cgi?id=6388">Bugzilla bug 6388</a> REGRESSION: Incomplete repaint when dragging the map on Google maps</p>
+
+<p id="test" style="background-color:skyblue; padding:3px;"><b>STEPS TO TEST:</b> 
+Click the Test button below.
+</p>
+
+<p id="success" style="background-color:palegreen; padding:3px;"><b>TEST PASS:</b> 
+The blue square will change to green.
+</p>
+
+<p id="failure" style="background-color:#FF3300; padding:3px;"><b>TEST FAIL:</b>  
+The blue square will NOT change to green.
+</p>
+
+<div style="width: 100px; height: 100px; overflow: hidden; position: relative">
+    <div id="outside" style="position:absolute; width: 0; height: 0;">
+        <div style="width: 200px; height: 100px; position: absolute; background: green;">
+            <div style="width: 100px; height: 100px; background: blue;"></div>
+        </div>
+    </div>
+</div>
+<br>
+<button onclick="document.getElementById('outside').style.left = '-100px'">Test</button>
+</body>
+</html>
index d1c712602b46bdc00d987a48e17d23c2d17be593..506e2d55469e3ccb3fc167f5c76a12e4aa54a430 100644 (file)
@@ -161,8 +161,10 @@ RenderLayer::~RenderLayer()
 void RenderLayer::computeRepaintRects()
 {
     // FIXME: Child object could override visibility.
-    if (m_object->style()->visibility() == VISIBLE)
+    if (m_object->style()->visibility() == VISIBLE) {
         m_object->getAbsoluteRepaintRectIncludingFloats(m_repaintRect, m_fullRepaintRect);
+        m_object->absolutePosition(m_repaintX, m_repaintY);
+    }
     for (RenderLayer* child = firstChild(); child; child = child->nextSibling())
         child->computeRepaintRects();
 }
@@ -188,8 +190,22 @@ void RenderLayer::updateLayerPositions(bool doFullRepaint, bool checkForRepaint)
     }
 
     // FIXME: Child object could override visibility.
-    if (checkForRepaint && (m_object->style()->visibility() == VISIBLE))
-        m_object->repaintAfterLayoutIfNeeded(m_repaintRect, m_fullRepaintRect);
+    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;
+                m_object->getAbsoluteRepaintRectIncludingFloats(newRect, newFullRect);
+                if (newRect != m_repaintRect)
+                    c->repaintViewRectangle(newFullRect);
+            }
+        }
+    }
     
     for (RenderLayer* child = firstChild(); child; child = child->nextSibling())
         child->updateLayerPositions(doFullRepaint, checkForRepaint);
index a749800b387d1c53a0b076500944dec09cf40840..af9c952f4ad7227825858bc7b5a48a3b71762024 100644 (file)
@@ -352,6 +352,8 @@ protected:
 
     IntRect m_repaintRect; // Cached repaint rects. Used by layout.
     IntRect m_fullRepaintRect;
+    int m_repaintX;
+    int m_repaintY;
 
     // Our current relative position offset.
     int m_relX;