:before content rendering issues with list markers and run-ins.
authorinferno@chromium.org <inferno@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 9 Sep 2011 16:23:53 +0000 (16:23 +0000)
committerinferno@chromium.org <inferno@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 9 Sep 2011 16:23:53 +0000 (16:23 +0000)
https://bugs.webkit.org/show_bug.cgi?id=67735

Source/WebCore:

1) Remove the isAnonymous checks for run-in detection since the
run-in can belong to a node.
2) When the parent has block children, then the list marker will
be enclosed in an anonymous block. In that case, for going to the
next list marker, we need to traverse one level up. We don't need
this check when searching for generated run-in (loop 2), since we
know parent will have inline children, so the list marker wont be
enclosed in an anonymous block.

Reviewed by Dave Hyatt.

Tests: fast/lists/list-marker-before-content-table.html
       fast/runin/runin-generated-before-content.html

* rendering/RenderObjectChildList.cpp:
(WebCore::RenderObjectChildList::beforePseudoElementRenderer):

LayoutTests:

Reviewed by Dave Hyatt.

* fast/lists/list-marker-before-content-table-expected.png: Added.
* fast/lists/list-marker-before-content-table-expected.txt: Added.
* fast/lists/list-marker-before-content-table.html: Added.
* fast/runin/runin-generated-before-content-expected.png: Added.
* fast/runin/runin-generated-before-content-expected.txt: Added.
* fast/runin/runin-generated-before-content.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/fast/lists/list-marker-before-content-table-expected.png [new file with mode: 0644]
LayoutTests/fast/lists/list-marker-before-content-table-expected.txt [new file with mode: 0644]
LayoutTests/fast/lists/list-marker-before-content-table.html [new file with mode: 0644]
LayoutTests/fast/runin/runin-generated-before-content-expected.png [new file with mode: 0644]
LayoutTests/fast/runin/runin-generated-before-content-expected.txt [new file with mode: 0644]
LayoutTests/fast/runin/runin-generated-before-content.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderObjectChildList.cpp

index b035b02..b6cae80 100644 (file)
@@ -1,3 +1,17 @@
+2011-09-08  Abhishek Arya  <inferno@chromium.org>
+
+        :before content rendering issues with list markers and run-ins.
+        https://bugs.webkit.org/show_bug.cgi?id=67735
+
+        Reviewed by Dave Hyatt.
+
+        * fast/lists/list-marker-before-content-table-expected.png: Added.
+        * fast/lists/list-marker-before-content-table-expected.txt: Added.
+        * fast/lists/list-marker-before-content-table.html: Added.
+        * fast/runin/runin-generated-before-content-expected.png: Added.
+        * fast/runin/runin-generated-before-content-expected.txt: Added.
+        * fast/runin/runin-generated-before-content.html: Added.
+
 2011-09-09  Nate Chapin  <japhet@chromium.org>
 
         Chromium leopard css3 baselines, and new mac gpu baselines.
diff --git a/LayoutTests/fast/lists/list-marker-before-content-table-expected.png b/LayoutTests/fast/lists/list-marker-before-content-table-expected.png
new file mode 100644 (file)
index 0000000..4f64ead
Binary files /dev/null and b/LayoutTests/fast/lists/list-marker-before-content-table-expected.png differ
diff --git a/LayoutTests/fast/lists/list-marker-before-content-table-expected.txt b/LayoutTests/fast/lists/list-marker-before-content-table-expected.txt
new file mode 100644 (file)
index 0000000..71bff78
--- /dev/null
@@ -0,0 +1,18 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x160
+  RenderBlock {HTML} at (0,0) size 800x160
+    RenderBody {BODY} at (8,32) size 784x96
+      RenderBlock {UL} at (0,0) size 784x96
+        RenderListItem {LI} at (40,0) size 744x96 [color=#008000]
+          RenderBlock (anonymous) at (0,0) size 744x32
+            RenderListMarker at (-25,0) size 11x32: bullet
+          RenderTable at (0,32) size 128x32
+            RenderTableSection (anonymous) at (0,0) size 128x32
+              RenderTableRow (anonymous) at (0,0) size 128x32 [color=#0000FF]
+                RenderTableCell (anonymous) at (0,0) size 128x32 [r=0 c=0 rs=1 cs=1]
+                  RenderText at (0,0) size 128x32
+                    text run at (0,0) width 128: "ABCD"
+          RenderBlock (anonymous) at (0,64) size 744x32
+            RenderText {#text} at (0,0) size 128x32
+              text run at (0,0) width 128: "EFGH"
diff --git a/LayoutTests/fast/lists/list-marker-before-content-table.html b/LayoutTests/fast/lists/list-marker-before-content-table.html
new file mode 100644 (file)
index 0000000..d47a9dd
--- /dev/null
@@ -0,0 +1,20 @@
+<!DOCTYPE html>\r
+<!-- You should only one blue textbox between the green list maker and green textbox -->\r
+<html>\r
+<body style="font: 1em/1 Ahem, sans-serif;">\r
+<style>\r
+li:before {\r
+    display: table-row;\r
+    content: "ABCD";\r
+    color: blue;\r
+}\r
+</style>\r
+<ul>              \r
+<li style="color: green">EFGH</li>\r
+</ul>\r
+<script>\r
+    document.body.offsetTop;\r
+    document.body.style.fontSize = "200%";\r
+</script>\r
+</body>\r
+</html>\r
diff --git a/LayoutTests/fast/runin/runin-generated-before-content-expected.png b/LayoutTests/fast/runin/runin-generated-before-content-expected.png
new file mode 100644 (file)
index 0000000..011d746
Binary files /dev/null and b/LayoutTests/fast/runin/runin-generated-before-content-expected.png differ
diff --git a/LayoutTests/fast/runin/runin-generated-before-content-expected.txt b/LayoutTests/fast/runin/runin-generated-before-content-expected.txt
new file mode 100644 (file)
index 0000000..6903716
--- /dev/null
@@ -0,0 +1,14 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x48
+  RenderBlock {HTML} at (0,0) size 800x48
+    RenderBody {BODY} at (8,8) size 784x32
+      RenderBlock {DIV} at (0,0) size 784x32 [color=#008000]
+        RenderInline (run-in) {DIV} at (0,0) size 128x32 [color=#FFA500]
+          RenderText {#text} at (0,0) size 128x32
+            text run at (0,0) width 128: "ABCD"
+        RenderInline (generated) at (0,0) size 128x32 [color=#0000FF]
+          RenderText at (128,0) size 128x32
+            text run at (128,0) width 128: "EFGH"
+        RenderText {#text} at (256,0) size 128x32
+          text run at (256,0) width 128: "IJKL"
diff --git a/LayoutTests/fast/runin/runin-generated-before-content.html b/LayoutTests/fast/runin/runin-generated-before-content.html
new file mode 100644 (file)
index 0000000..8279fb5
--- /dev/null
@@ -0,0 +1,17 @@
+<!DOCTYPE html>\r
+<!-- You should see only one blue textbox between the orange and green textbox. -->\r
+<html>\r
+<body style="font: 1em/1 Ahem, sans-serif;">\r
+<style>\r
+#test::before {\r
+    content: "EFGH";\r
+    color: blue;\r
+}\r
+</style>                          \r
+<div style="display: run-in; color: orange">ABCD</div><div id="test" style="color: green">IJKL</div>\r
+<script>\r
+    document.body.offsetTop;\r
+    document.body.style.fontSize = "200%";\r
+</script>\r
+</body>\r
+</html>\r
index 76c3a93..ec18649 100644 (file)
@@ -1,3 +1,25 @@
+2011-09-08  Abhishek Arya  <inferno@chromium.org>
+
+        :before content rendering issues with list markers and run-ins.
+        https://bugs.webkit.org/show_bug.cgi?id=67735
+
+        1) Remove the isAnonymous checks for run-in detection since the
+        run-in can belong to a node.
+        2) When the parent has block children, then the list marker will
+        be enclosed in an anonymous block. In that case, for going to the
+        next list marker, we need to traverse one level up. We don't need
+        this check when searching for generated run-in (loop 2), since we
+        know parent will have inline children, so the list marker wont be
+        enclosed in an anonymous block.
+
+        Reviewed by Dave Hyatt.
+
+        Tests: fast/lists/list-marker-before-content-table.html
+               fast/runin/runin-generated-before-content.html
+
+        * rendering/RenderObjectChildList.cpp:
+        (WebCore::RenderObjectChildList::beforePseudoElementRenderer):
+
 2011-09-09  Pavel Podivilov  <podivilov@chromium.org>
 
         Web Inspector: introduce JavaScriptSourceFrame class.
index f7d19fc..0de3d3d 100644 (file)
@@ -299,7 +299,12 @@ RenderObject* RenderObjectChildList::beforePseudoElementRenderer(const RenderObj
     do {
         // Skip list markers and generated run-ins
         first = first->firstChild();
-        while (first && (first->isListMarker() || (first->isRenderInline() && first->isRunIn() && first->isAnonymous())))
+        while (first && first->isListMarker()) {
+            if (first->parent() != owner && first->parent()->isAnonymousBlock())
+                first = first->parent();
+            first = first->nextSibling();
+        }
+        while (first && first->isRenderInline() && first->isRunIn())
             first = first->nextSibling();
     } while (first && first->isAnonymous() && first->style()->styleType() == NOPSEUDO);
 
@@ -321,7 +326,7 @@ RenderObject* RenderObjectChildList::beforePseudoElementRenderer(const RenderObj
         // We still need to skip any list markers that could exist before the run-in.
         while (first && first->isListMarker())
             first = first->nextSibling();
-        if (first && first->style()->styleType() == BEFORE && first->isRenderInline() && first->isRunIn() && first->isAnonymous())
+        if (first && first->style()->styleType() == BEFORE && first->isRenderInline() && first->isRunIn())
             return first;
     }
     return 0;