<rdar://problem/10196497> first-letter after list marker not updated correctly
authormitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 29 Sep 2011 04:12:42 +0000 (04:12 +0000)
committermitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 29 Sep 2011 04:12:42 +0000 (04:12 +0000)
Reviewed by Simon Fraser.

Source/WebCore:

Test: fast/dynamic/first-letter-after-list-marker.html

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::updateFirstLetter): Improved the logic for continuing past list markers
when trying to locate a first letter to update.

LayoutTests:

* fast/dynamic/first-letter-after-list-marker-expected.png: Added.
* fast/dynamic/first-letter-after-list-marker-expected.txt: Added.
* fast/dynamic/first-letter-after-list-marker.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/fast/dynamic/first-letter-after-list-marker-expected.png [new file with mode: 0644]
LayoutTests/fast/dynamic/first-letter-after-list-marker-expected.txt [new file with mode: 0644]
LayoutTests/fast/dynamic/first-letter-after-list-marker.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderBlock.cpp

index cabdf04b4fc11a56550b7a7d3feed222f1c271f5..431ef2283e3bc3e70a264578ce13a64265974814 100644 (file)
@@ -1,3 +1,13 @@
+2011-09-28  Dan Bernstein  <mitz@apple.com>
+
+        <rdar://problem/10196497> first-letter after list marker not updated correctly
+
+        Reviewed by Simon Fraser.
+
+        * fast/dynamic/first-letter-after-list-marker-expected.png: Added.
+        * fast/dynamic/first-letter-after-list-marker-expected.txt: Added.
+        * fast/dynamic/first-letter-after-list-marker.html: Added.
+
 2011-09-28  Hayato Ito  <hayato@chromium.org>
 
         Add a test for accesskey in regard to iframes.
diff --git a/LayoutTests/fast/dynamic/first-letter-after-list-marker-expected.png b/LayoutTests/fast/dynamic/first-letter-after-list-marker-expected.png
new file mode 100644 (file)
index 0000000..c20fa2e
Binary files /dev/null and b/LayoutTests/fast/dynamic/first-letter-after-list-marker-expected.png differ
diff --git a/LayoutTests/fast/dynamic/first-letter-after-list-marker-expected.txt b/LayoutTests/fast/dynamic/first-letter-after-list-marker-expected.txt
new file mode 100644 (file)
index 0000000..97c63e8
--- /dev/null
@@ -0,0 +1,12 @@
+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 784x492
+      RenderBlock {UL} at (0,0) size 784x100
+        RenderListItem {LI} at (40,0) size 744x100
+          RenderListMarker at (-61,0) size 29x100: bullet
+          RenderInline (generated) at (0,0) size 100x100 [color=#008000]
+            RenderText {#text} at (0,0) size 100x100
+              text run at (0,0) width 100: "a"
+          RenderText {#text} at (0,0) size 0x0
diff --git a/LayoutTests/fast/dynamic/first-letter-after-list-marker.html b/LayoutTests/fast/dynamic/first-letter-after-list-marker.html
new file mode 100644 (file)
index 0000000..d68b44d
--- /dev/null
@@ -0,0 +1,11 @@
+<style>
+    li:first-letter { color: red; }
+    li.green:first-letter { color: green; }
+</style>
+<ul style="font-family: ahem; font-size: 100px; -webkit-font-smoothing: none;">
+    <li id="target">a</li>
+</ul>
+<script>
+    document.body.offsetTop;
+    document.getElementById("target").className = "green";
+</script>
index 727af8ac96ed1a275f1677cfe3e9457ef18214ea..af671c960d59818ffe222edcde5f4ee3f62e7bdc 100644 (file)
@@ -1,3 +1,15 @@
+2011-09-28  Dan Bernstein  <mitz@apple.com>
+
+        <rdar://problem/10196497> first-letter after list marker not updated correctly
+
+        Reviewed by Simon Fraser.
+
+        Test: fast/dynamic/first-letter-after-list-marker.html
+
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::updateFirstLetter): Improved the logic for continuing past list markers
+        when trying to locate a first letter to update.
+
 2011-09-28  Kent Tamura  <tkent@chromium.org>
 
         REGRESSION(r93858): Can't type anything into input elements when maxlength is greater than 2^31
index 630db57a4d4812aab7a2ba2ea9c165e32a19ccba..465154ccb8abe141e89ada331e02e30ac34e0381 100644 (file)
@@ -5480,21 +5480,23 @@ void RenderBlock::updateFirstLetter()
 
     // Drill into inlines looking for our first text child.
     RenderObject* currChild = firstLetterBlock->firstChild();
-    while (currChild && ((!currChild->isReplaced() && !currChild->isRenderButton() && !currChild->isMenuList()) || currChild->isFloatingOrPositioned()) && !currChild->isText()) {
-        if (currChild->isFloatingOrPositioned()) {
+    while (currChild) {
+        if (currChild->isText())
+            break;
+        if (currChild->isListMarker())
+            currChild = currChild->nextSibling();
+        else if (currChild->isFloatingOrPositioned()) {
             if (currChild->style()->styleType() == FIRST_LETTER) {
                 currChild = currChild->firstChild();
                 break;
-            } 
+            }
             currChild = currChild->nextSibling();
-        } else
+        } else if (currChild->isReplaced() || currChild->isRenderButton() || currChild->isMenuList())
+            break;
+        else
             currChild = currChild->firstChild();
     }
 
-    // Get list markers out of the way.
-    while (currChild && currChild->isListMarker())
-        currChild = currChild->nextSibling();
-
     if (!currChild)
         return;