Reviewed by Darin.
authordarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 3 Apr 2006 16:28:38 +0000 (16:28 +0000)
committerdarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 3 Apr 2006 16:28:38 +0000 (16:28 +0000)
        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=8032
          REGRESSION: Focus ring not completely redrawn after a Delete changes its size

        * rendering/RenderObject.cpp:
        (WebCore::RenderObject::repaintAfterLayoutIfNeeded): When an element changes size, the
        delta rectangles that need to be invalidated must be inflated by the outline size to ensure
        that the previous outline is erased, and the space where the new outline is to be drawn is
        also invalidated. This behaviour is identical to the behaviour of borders that was fixed in
        bug 6301.
        * manual-tests/outline-repaint-glitch.html: Added. Manual testcase.
        This is just an outline version of border-repaint-glitch.html

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

WebCore/ChangeLog
WebCore/manual-tests/outline-repaint-glitch.html [new file with mode: 0644]
WebCore/rendering/RenderObject.cpp

index 8c0dbde9bd69b6b2f9f71a118cdee73f3a2960d3..794e25ed4d07e9a5bb328a4e943b48c1b4b25545 100644 (file)
@@ -1,3 +1,19 @@
+2006-04-02  Graham Dennis  <Graham.Dennis@gmail.com>
+
+        Reviewed by Darin.
+
+        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=8032
+          REGRESSION: Focus ring not completely redrawn after a Delete changes its size
+
+        * rendering/RenderObject.cpp:
+        (WebCore::RenderObject::repaintAfterLayoutIfNeeded): When an element changes size, the
+        delta rectangles that need to be invalidated must be inflated by the outline size to ensure
+        that the previous outline is erased, and the space where the new outline is to be drawn is
+        also invalidated. This behaviour is identical to the behaviour of borders that was fixed in
+        bug 6301.
+        * manual-tests/outline-repaint-glitch.html: Added. Manual testcase.
+        This is just an outline version of border-repaint-glitch.html
+
 2006-04-02  Trey Matteson  <trey@usa.net>
 
         Reviewed by Maciej.
diff --git a/WebCore/manual-tests/outline-repaint-glitch.html b/WebCore/manual-tests/outline-repaint-glitch.html
new file mode 100644 (file)
index 0000000..c91384a
--- /dev/null
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+        "http://www.w3.org/TR/html4/strict.dtd">
+<html lang="en">
+<head>
+<style type="text/css">
+    div.test { width: 200px; height: 120px; border: 1px solid blue; padding: 10px; }
+</style>
+</head>
+<body>
+<p><b>BUG ID:</b> <a href="http://bugzilla.opendarwin.org/show_bug.cgi?id=8032">Bugzilla bug 8032</a> REGRESSION: Focus ring not completely redrawn after a Delete changes its size</p>
+
+<p> Note that this bug (and the test) are just outline versions of <a href="http://bugzilla.opendarwin.org/show_bug.cgi?id=6301">Bugzilla bug 6301</a> and test <a href="border-repaint-glitch.html">border-repaint-glitch.html</a>
+
+<p id="test" style="background-color:skyblue; padding:3px;"><b>STEPS TO TEST:</b> 
+Click each Test button once.
+</p>
+
+<p id="success" style="background-color:palegreen; padding:3px;"><b>TEST PASS:</b> 
+The boxes will resize, maintaining their solid red rectangular outlines.
+</p>
+
+<p id="failure" style="background-color:#FF3300; padding:3px;"><b>TEST FAIL:</b>  
+The boxes will resize, but the outlines will break. The first box will be missing
+small segments from either side of its bottom outline. The second box will have
+small red horizontal segments protruding inwards from both sides of the outline,
+where the bottom outline was before.
+</p>
+
+<div class="test">
+    <button onclick="document.getElementById('a').style.height = '40px'">Test</button>
+    <div style="background: teal; padding: 0; outline: solid red 4px;">
+        <div id="a" style="height: 60px; margin: 10px; background:silver;"></div>
+    </div>
+</div>
+<br>
+<div class="test">
+    <button onclick="document.getElementById('b').style.height = '60px'">Test</button>
+    <div style="background: teal; padding: 0; outline: solid red 4px;">
+        <div id="b" style="height: 40px; margin: 10px; background:silver;"></div>
+    </div>
+</div>
+
+</body>
+</html>
index 3be6ec6e67eac80826e0af7ef8b518e9b31c1107..2ce34dbb2b94df01a89ecd92363a19d4e28c18fc 100644 (file)
@@ -1440,18 +1440,19 @@ bool RenderObject::repaintAfterLayoutIfNeeded(const IntRect& oldBounds, const In
 
     // We didn't move, but we did change size.  Invalidate the delta, which will consist of possibly 
     // two rectangles (but typically only one).
+    int ow = style() ? style()->outlineSize() : 0;
     int width = abs(newBounds.width() - oldBounds.width());
     if (width)
-        c->repaintViewRectangle(IntRect(kMin(newBounds.x() + newBounds.width(), oldBounds.x() + oldBounds.width()) - borderRight(),
+        c->repaintViewRectangle(IntRect(kMin(newBounds.x() + newBounds.width(), oldBounds.x() + oldBounds.width()) - borderRight() - ow,
             newBounds.y(),
-            width + borderRight(),
+            width + borderRight() + ow,
             kMax(newBounds.height(), oldBounds.height())));
     int height = abs(newBounds.height() - oldBounds.height());
     if (height)
         c->repaintViewRectangle(IntRect(newBounds.x(),
-            kMin(newBounds.bottom(), oldBounds.bottom()) - borderBottom(),
+            kMin(newBounds.bottom(), oldBounds.bottom()) - borderBottom() - ow,
             kMax(newBounds.width(), oldBounds.width()),
-            height + borderBottom()));
+            height + borderBottom() + ow));
     return false;
 }