<rdar://problem/9282486> REGRESSION (r81992): Facebook photo tags can get cut off...
authormitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 18 Apr 2011 19:18:33 +0000 (19:18 +0000)
committermitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 18 Apr 2011 19:18:33 +0000 (19:18 +0000)
https://bugs.webkit.org/show_bug.cgi?id=58500

Reviewed by Eric Seidel.

Source/WebCore:

Test: fast/repaint/text-in-relative-positioned-inline.html

* rendering/RenderText.cpp:
(WebCore::RenderText::clippedOverflowRectForRepaint): Use the container’s repaint rect, not
the containing block’s. This matters when the containing block is outside the RenderText’s
enclosing layer, as is the case here.

LayoutTests:

* fast/repaint/text-in-relative-positioned-inline-expected.checksum: Added.
* fast/repaint/text-in-relative-positioned-inline-expected.png: Added.
* fast/repaint/text-in-relative-positioned-inline-expected.txt: Added.
* fast/repaint/text-in-relative-positioned-inline.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/fast/repaint/text-in-relative-positioned-inline-expected.checksum [new file with mode: 0644]
LayoutTests/fast/repaint/text-in-relative-positioned-inline-expected.png [new file with mode: 0644]
LayoutTests/fast/repaint/text-in-relative-positioned-inline-expected.txt [new file with mode: 0644]
LayoutTests/fast/repaint/text-in-relative-positioned-inline.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderText.cpp

index f3e93a3..42985c9 100644 (file)
@@ -1,3 +1,15 @@
+2011-04-18  Dan Bernstein  <mitz@apple.com>
+
+        Reviewed by Eric Seidel.
+
+        <rdar://problem/9282486> REGRESSION (r81992): Facebook photo tags can get cut off when moving the mouse.
+        https://bugs.webkit.org/show_bug.cgi?id=58500
+
+        * fast/repaint/text-in-relative-positioned-inline-expected.checksum: Added.
+        * fast/repaint/text-in-relative-positioned-inline-expected.png: Added.
+        * fast/repaint/text-in-relative-positioned-inline-expected.txt: Added.
+        * fast/repaint/text-in-relative-positioned-inline.html: Added.
+
 2011-04-18  Chang Shu  <cshu@webkit.org>
 
         Reviewed by Eric Seidel.
diff --git a/LayoutTests/fast/repaint/text-in-relative-positioned-inline-expected.checksum b/LayoutTests/fast/repaint/text-in-relative-positioned-inline-expected.checksum
new file mode 100644 (file)
index 0000000..6614064
--- /dev/null
@@ -0,0 +1 @@
+1aeada751c874a94380f1bd6f941bdf0
\ No newline at end of file
diff --git a/LayoutTests/fast/repaint/text-in-relative-positioned-inline-expected.png b/LayoutTests/fast/repaint/text-in-relative-positioned-inline-expected.png
new file mode 100644 (file)
index 0000000..2bc9bae
Binary files /dev/null and b/LayoutTests/fast/repaint/text-in-relative-positioned-inline-expected.png differ
diff --git a/LayoutTests/fast/repaint/text-in-relative-positioned-inline-expected.txt b/LayoutTests/fast/repaint/text-in-relative-positioned-inline-expected.txt
new file mode 100644 (file)
index 0000000..c233f07
--- /dev/null
@@ -0,0 +1,8 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderBlock {DIV} at (100,0) size 684x100
+        RenderText {#text} at (0,0) size 0x0
+      RenderBlock {DIV} at (0,0) size 100x100 [bgcolor=#008000]
diff --git a/LayoutTests/fast/repaint/text-in-relative-positioned-inline.html b/LayoutTests/fast/repaint/text-in-relative-positioned-inline.html
new file mode 100644 (file)
index 0000000..94093f5
--- /dev/null
@@ -0,0 +1,15 @@
+<head>
+    <script src="resources/repaint.js"></script>
+    <script>
+        function repaintTest()
+        {
+            document.getElementById("target").style.display = "none";
+        }
+    </script>
+</head>
+<body onload="runRepaintTest()">
+    <div style="margin-left: 100px; font: 100px ahem; -webkit-font-smoothing: none; height: 100px;">
+        <span id="target" style="position: relative; left: -100px; color: red;">ab</span>
+    </div>
+    <div style="width: 100px; height: 100px; background-color: green; margin-top: -100px;"></div>
+</body>
index 8b65948..03c1fdb 100644 (file)
@@ -1,3 +1,17 @@
+2011-04-18  Dan Bernstein  <mitz@apple.com>
+
+        Reviewed by Eric Seidel.
+
+        <rdar://problem/9282486> REGRESSION (r81992): Facebook photo tags can get cut off when moving the mouse.
+        https://bugs.webkit.org/show_bug.cgi?id=58500
+
+        Test: fast/repaint/text-in-relative-positioned-inline.html
+
+        * rendering/RenderText.cpp:
+        (WebCore::RenderText::clippedOverflowRectForRepaint): Use the container’s repaint rect, not
+        the containing block’s. This matters when the containing block is outside the RenderText’s
+        enclosing layer, as is the case here.
+
 2011-04-15  Stephen White  <senorblanco@chromium.org>
 
         Reviewed by Kenneth Russell.
index 234b825..b35820a 100644 (file)
@@ -1330,13 +1330,13 @@ IntRect RenderText::linesVisualOverflowBoundingBox() const
 
 IntRect RenderText::clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer)
 {
-    RenderObject* cb = containingBlock();
-    // The containing block may be an ancestor of repaintContainer, but we need to do a repaintContainer-relative repaint.
-    if (repaintContainer && repaintContainer != cb) {
-        if (!cb->isDescendantOf(repaintContainer))
-            return repaintContainer->clippedOverflowRectForRepaint(repaintContainer);
-    }
-    return cb->clippedOverflowRectForRepaint(repaintContainer);
+    bool repaintContainerSkipped;
+    RenderObject* container = this->container(repaintContainer, &repaintContainerSkipped);
+    // The container may be an ancestor of repaintContainer, but we need to do a repaintContainer-relative repaint.
+    if (repaintContainerSkipped)
+        return repaintContainer->clippedOverflowRectForRepaint(repaintContainer);
+
+    return container->clippedOverflowRectForRepaint(repaintContainer);
 }
 
 IntRect RenderText::selectionRectForRepaint(RenderBoxModelObject* repaintContainer, bool clipToVisibleContent)