<rdar://problem/10208291> first-letter in generated before content with display:...
authormitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 30 Sep 2011 21:36:57 +0000 (21:36 +0000)
committermitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 30 Sep 2011 21:36:57 +0000 (21:36 +0000)
Reviewed by Sam Weinig.

Source/WebCore:

Test: fast/css-generated-content/first-letter-in-nested-before.html

* rendering/RenderObjectChildList.cpp:
(WebCore::RenderObjectChildList::updateBeforeAfterContent): Preserve the style type of anonymous
containers around the generated content when updating their style. This preserves the first-letter-ness
of the inline wrapping the first letter, which allows updateFirstLetter() to identify it later.

LayoutTests:

* fast/css-generated-content/first-letter-in-nested-before-expected.png: Added.
* fast/css-generated-content/first-letter-in-nested-before-expected.txt: Added.
* fast/css-generated-content/first-letter-in-nested-before.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/fast/css-generated-content/first-letter-in-nested-before-expected.png [new file with mode: 0644]
LayoutTests/fast/css-generated-content/first-letter-in-nested-before-expected.txt [new file with mode: 0644]
LayoutTests/fast/css-generated-content/first-letter-in-nested-before.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderObjectChildList.cpp
Source/WebCore/rendering/RenderView.cpp

index 7c76356..5bfd34f 100644 (file)
@@ -1,3 +1,13 @@
+2011-09-30  Dan Bernstein  <mitz@apple.com>
+
+        <rdar://problem/10208291> first-letter in generated before content with display: table is not updated
+
+        Reviewed by Sam Weinig.
+
+        * fast/css-generated-content/first-letter-in-nested-before-expected.png: Added.
+        * fast/css-generated-content/first-letter-in-nested-before-expected.txt: Added.
+        * fast/css-generated-content/first-letter-in-nested-before.html: Added.
+
 2011-09-30  David Hyatt  <hyatt@apple.com>
 
         https://bugs.webkit.org/show_bug.cgi?id=69167
diff --git a/LayoutTests/fast/css-generated-content/first-letter-in-nested-before-expected.png b/LayoutTests/fast/css-generated-content/first-letter-in-nested-before-expected.png
new file mode 100644 (file)
index 0000000..6835cd5
Binary files /dev/null and b/LayoutTests/fast/css-generated-content/first-letter-in-nested-before-expected.png differ
diff --git a/LayoutTests/fast/css-generated-content/first-letter-in-nested-before-expected.txt b/LayoutTests/fast/css-generated-content/first-letter-in-nested-before-expected.txt
new file mode 100644 (file)
index 0000000..7b01704
--- /dev/null
@@ -0,0 +1,17 @@
+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 (0,0) size 784x100 [color=#FF0000]
+        RenderText {#text} at (0,0) size 100x100
+          text run at (0,0) width 100: "A"
+      RenderBlock {DIV} at (0,0) size 784x100 [color=#008000]
+        RenderTable at (0,0) size 100x100
+          RenderTableSection (anonymous) at (0,0) size 100x100
+            RenderTableRow (anonymous) at (0,0) size 100x100
+              RenderTableCell (anonymous) at (0,0) size 100x100 [r=0 c=0 rs=1 cs=1]
+                RenderInline (generated) at (0,0) size 100x100
+                  RenderText at (0,0) size 100x100
+                    text run at (0,0) width 100: "A"
+                RenderText at (0,0) size 0x0
diff --git a/LayoutTests/fast/css-generated-content/first-letter-in-nested-before.html b/LayoutTests/fast/css-generated-content/first-letter-in-nested-before.html
new file mode 100644 (file)
index 0000000..6c3624b
--- /dev/null
@@ -0,0 +1,13 @@
+<style>
+    #target { color: green; margin-top: -100px; }
+    #target:before { display: table; content: "A"; }
+    #target:first-letter { font-size: 200%; }
+</style>
+<body style="font-family: ahem; -webkit-font-smoothing: none;">
+    <div style="font-size: 100px; color: red;">A</div>
+    <div id="target"></div>
+    <script>
+        document.body.offsetTop;
+        document.getElementById("target").style.fontSize = "50px";
+    </script>
+</body>
index f771ed6..814ed07 100644 (file)
@@ -1,3 +1,16 @@
+2011-09-30  Dan Bernstein  <mitz@apple.com>
+
+        <rdar://problem/10208291> first-letter in generated before content with display: table is not updated
+
+        Reviewed by Sam Weinig.
+
+        Test: fast/css-generated-content/first-letter-in-nested-before.html
+
+        * rendering/RenderObjectChildList.cpp:
+        (WebCore::RenderObjectChildList::updateBeforeAfterContent): Preserve the style type of anonymous
+        containers around the generated content when updating their style. This preserves the first-letter-ness
+        of the inline wrapping the first letter, which allows updateFirstLetter() to identify it later.
+
 2011-09-30  Cary Clark  <caryclark@google.com>
 
         Inset focus ring (Skia on Mac)
index 04f8f70..0e68f9c 100644 (file)
@@ -434,6 +434,7 @@ void RenderObjectChildList::updateBeforeAfterContent(RenderObject* owner, Pseudo
                     RefPtr<RenderStyle> newStyle = RenderStyle::create();
                     newStyle->inheritFrom(pseudoElementStyle);
                     newStyle->setDisplay(curr->style()->display());
+                    newStyle->setStyleType(curr->style()->styleType());
                     curr->setStyle(newStyle);
                     curr = curr->parent();
                 }
index 1fefac4..775b15d 100644 (file)
@@ -142,6 +142,10 @@ void RenderView::layout()
     ASSERT(m_layoutState == &state);
     m_layoutState = 0;
     setNeedsLayout(false);
+#if !ASSERT_DISABLED
+    for (RenderObject* renderer = this; renderer; renderer = renderer->nextInPreOrder())
+        ASSERT(!renderer->needsLayout());
+#endif
 }
 
 void RenderView::mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool fixed, bool useTransforms, TransformState& transformState, bool* wasFixed) const