Source/WebCore: Not use anonymousContainer on beforeChild calculation
authorinferno@chromium.org <inferno@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 21 Sep 2011 22:05:07 +0000 (22:05 +0000)
committerinferno@chromium.org <inferno@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 21 Sep 2011 22:05:07 +0000 (22:05 +0000)
and let later code handle it. Fix style update on block-level
anonymous objects.
https://bugs.webkit.org/show_bug.cgi?id=67656

Reviewed by David Hyatt.

Test: fast/table/quote-text-around-iframe.html

* rendering/RenderTable.cpp:
(WebCore::RenderTable::addChild):
* rendering/RenderTableCell.cpp:
(WebCore::RenderTableCell::styleDidChange):
* rendering/RenderTableRow.cpp:
(WebCore::RenderTableRow::addChild):
* rendering/RenderObject.cpp:
(WebCore::RenderObject::propagateStyleToAnonymousChildren):

LayoutTests: Not use anonymousContainer on beforeChild calculation
and let later code handle it.
https://bugs.webkit.org/show_bug.cgi?id=67656

Reviewed by David Hyatt.

* fast/table/quote-text-around-iframe.html: Added.
* fast/table/table-row-style-not-updated-with-after-content-expected.txt:
* platform/mac/fast/table/quote-text-around-iframe-expected.png: Added.
* platform/mac/fast/table/quote-text-around-iframe-expected.txt: Added.
and lot of style propagation rebaselines.

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

19 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/table/quote-text-around-iframe.html [new file with mode: 0644]
LayoutTests/fast/table/table-cell-before-after-content-around-table-block-expected.txt
LayoutTests/fast/table/table-cell-before-after-content-around-table-expected.txt
LayoutTests/fast/table/table-row-before-after-content-around-block-expected.txt
LayoutTests/fast/table/table-row-before-after-content-around-table-expected.txt
LayoutTests/fast/table/table-row-style-not-updated-with-after-content-expected.txt
LayoutTests/platform/mac/fast/css-generated-content/table-cell-before-content-expected.txt
LayoutTests/platform/mac/fast/table/quote-text-around-iframe-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/fast/table/quote-text-around-iframe-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/fast/table/table-cell-after-child-in-block-expected.txt
LayoutTests/platform/mac/fast/table/table-cell-before-child-in-block-expected.txt
LayoutTests/platform/mac/fast/table/table-row-after-child-in-block-expected.txt
LayoutTests/platform/mac/fast/table/table-row-before-child-in-block-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderObject.cpp
Source/WebCore/rendering/RenderTable.cpp
Source/WebCore/rendering/RenderTableRow.cpp
Source/WebCore/rendering/RenderTableSection.cpp

index d44e6a8..c090725 100644 (file)
@@ -1,3 +1,17 @@
+2011-09-21  Abhishek Arya  <inferno@chromium.org>
+
+        Not use anonymousContainer on beforeChild calculation
+        and let later code handle it.
+        https://bugs.webkit.org/show_bug.cgi?id=67656
+
+        Reviewed by David Hyatt.
+
+        * fast/table/quote-text-around-iframe.html: Added.
+        * fast/table/table-row-style-not-updated-with-after-content-expected.txt:
+        * platform/mac/fast/table/quote-text-around-iframe-expected.png: Added.
+        * platform/mac/fast/table/quote-text-around-iframe-expected.txt: Added.
+        and lot of style propagation rebaselines.
+
 2011-09-21  David Hyatt  <hyatt@apple.com>
 
         https://bugs.webkit.org/show_bug.cgi?id=68562
diff --git a/LayoutTests/fast/table/quote-text-around-iframe.html b/LayoutTests/fast/table/quote-text-around-iframe.html
new file mode 100644 (file)
index 0000000..a80c4a6
--- /dev/null
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<!-- You should see Quote followed by A, followed by iframe, followed by B and ending in Quote -->
+<body>
+<q style="display: table-row;">
+A<iframe></iframe>B
+</q>
+<script>
+    document.body.offsetTop;
+       document.body.style.zoom = "200%";
+</script>
+</body>
+</html>
\ No newline at end of file
index 160e6d5..d3adb1b 100644 (file)
@@ -4,18 +4,18 @@ layer at (0,0) size 800x64
   RenderBlock {HTML} at (0,0) size 800x64
     RenderBody {BODY} at (8,8) size 784x48 [color=#0000FF]
       RenderBlock {DIV} at (0,0) size 784x48
-        RenderTable at (0,0) size 64x16 [color=#000000]
+        RenderTable at (0,0) size 64x16
           RenderTableSection (anonymous) at (0,0) size 64x16
             RenderTableRow (anonymous) at (0,0) size 64x16
-              RenderTableCell (anonymous) at (0,0) size 64x16 [color=#0000FF] [r=0 c=0 rs=1 cs=1]
+              RenderTableCell (anonymous) at (0,0) size 64x16 [r=0 c=0 rs=1 cs=1]
                 RenderText at (0,0) size 64x16
                   text run at (0,0) width 64: "ABCD"
         RenderBlock {DIV} at (0,16) size 784x16
           RenderText {#text} at (0,0) size 64x16
             text run at (0,0) width 64: "1234"
-        RenderTable at (0,32) size 64x16 [color=#000000]
+        RenderTable at (0,32) size 64x16
           RenderTableSection (anonymous) at (0,0) size 64x16
             RenderTableRow (anonymous) at (0,0) size 64x16
-              RenderTableCell (anonymous) at (0,0) size 64x16 [color=#0000FF] [r=0 c=0 rs=1 cs=1]
+              RenderTableCell (anonymous) at (0,0) size 64x16 [r=0 c=0 rs=1 cs=1]
                 RenderText at (0,0) size 64x16
                   text run at (0,0) width 64: "EFGH"
index 455a554..00d457a 100644 (file)
@@ -4,10 +4,10 @@ layer at (0,0) size 800x64
   RenderBlock {HTML} at (0,0) size 800x64
     RenderBody {BODY} at (8,8) size 784x48 [color=#0000FF]
       RenderBlock {DIV} at (0,0) size 784x48
-        RenderTable at (0,0) size 64x16 [color=#000000]
+        RenderTable at (0,0) size 64x16
           RenderTableSection (anonymous) at (0,0) size 64x16
             RenderTableRow (anonymous) at (0,0) size 64x16
-              RenderTableCell (anonymous) at (0,0) size 64x16 [color=#0000FF] [r=0 c=0 rs=1 cs=1]
+              RenderTableCell (anonymous) at (0,0) size 64x16 [r=0 c=0 rs=1 cs=1]
                 RenderText at (0,0) size 64x16
                   text run at (0,0) width 64: "ABCD"
         RenderTable {DIV} at (0,16) size 64x16
@@ -16,9 +16,9 @@ layer at (0,0) size 800x64
               RenderTableCell (anonymous) at (0,0) size 64x16 [r=0 c=0 rs=1 cs=1]
                 RenderText {#text} at (0,0) size 64x16
                   text run at (0,0) width 64: "1234"
-        RenderTable at (0,32) size 64x16 [color=#000000]
+        RenderTable at (0,32) size 64x16
           RenderTableSection (anonymous) at (0,0) size 64x16
             RenderTableRow (anonymous) at (0,0) size 64x16
-              RenderTableCell (anonymous) at (0,0) size 64x16 [color=#0000FF] [r=0 c=0 rs=1 cs=1]
+              RenderTableCell (anonymous) at (0,0) size 64x16 [r=0 c=0 rs=1 cs=1]
                 RenderText at (0,0) size 64x16
                   text run at (0,0) width 64: "EFGH"
index 2207597..d3adb1b 100644 (file)
@@ -4,18 +4,18 @@ layer at (0,0) size 800x64
   RenderBlock {HTML} at (0,0) size 800x64
     RenderBody {BODY} at (8,8) size 784x48 [color=#0000FF]
       RenderBlock {DIV} at (0,0) size 784x48
-        RenderTable at (0,0) size 64x16 [color=#000000]
+        RenderTable at (0,0) size 64x16
           RenderTableSection (anonymous) at (0,0) size 64x16
-            RenderTableRow (anonymous) at (0,0) size 64x16 [color=#0000FF]
+            RenderTableRow (anonymous) at (0,0) size 64x16
               RenderTableCell (anonymous) at (0,0) size 64x16 [r=0 c=0 rs=1 cs=1]
                 RenderText at (0,0) size 64x16
                   text run at (0,0) width 64: "ABCD"
         RenderBlock {DIV} at (0,16) size 784x16
           RenderText {#text} at (0,0) size 64x16
             text run at (0,0) width 64: "1234"
-        RenderTable at (0,32) size 64x16 [color=#000000]
+        RenderTable at (0,32) size 64x16
           RenderTableSection (anonymous) at (0,0) size 64x16
-            RenderTableRow (anonymous) at (0,0) size 64x16 [color=#0000FF]
+            RenderTableRow (anonymous) at (0,0) size 64x16
               RenderTableCell (anonymous) at (0,0) size 64x16 [r=0 c=0 rs=1 cs=1]
                 RenderText at (0,0) size 64x16
                   text run at (0,0) width 64: "EFGH"
index d6f631a..00d457a 100644 (file)
@@ -4,9 +4,9 @@ layer at (0,0) size 800x64
   RenderBlock {HTML} at (0,0) size 800x64
     RenderBody {BODY} at (8,8) size 784x48 [color=#0000FF]
       RenderBlock {DIV} at (0,0) size 784x48
-        RenderTable at (0,0) size 64x16 [color=#000000]
+        RenderTable at (0,0) size 64x16
           RenderTableSection (anonymous) at (0,0) size 64x16
-            RenderTableRow (anonymous) at (0,0) size 64x16 [color=#0000FF]
+            RenderTableRow (anonymous) at (0,0) size 64x16
               RenderTableCell (anonymous) at (0,0) size 64x16 [r=0 c=0 rs=1 cs=1]
                 RenderText at (0,0) size 64x16
                   text run at (0,0) width 64: "ABCD"
@@ -16,9 +16,9 @@ layer at (0,0) size 800x64
               RenderTableCell (anonymous) at (0,0) size 64x16 [r=0 c=0 rs=1 cs=1]
                 RenderText {#text} at (0,0) size 64x16
                   text run at (0,0) width 64: "1234"
-        RenderTable at (0,32) size 64x16 [color=#000000]
+        RenderTable at (0,32) size 64x16
           RenderTableSection (anonymous) at (0,0) size 64x16
-            RenderTableRow (anonymous) at (0,0) size 64x16 [color=#0000FF]
+            RenderTableRow (anonymous) at (0,0) size 64x16
               RenderTableCell (anonymous) at (0,0) size 64x16 [r=0 c=0 rs=1 cs=1]
                 RenderText at (0,0) size 64x16
                   text run at (0,0) width 64: "EFGH"
index dfb95dd..fa08efc 100644 (file)
@@ -7,13 +7,14 @@ layer at (0,0) size 800x600
         RenderTableSection (anonymous) at (0,0) size 512x256
           RenderTableRow {DIV} at (0,0) size 512x256 [color=#0000FF]
             RenderTableCell (anonymous) at (0,0) size 512x256 [r=0 c=0 rs=1 cs=1]
-              RenderBlock (anonymous) at (0,0) size 512x128
-                RenderText {#text} at (0,0) size 512x128
-                  text run at (0,0) width 512: "ABCD"
-              RenderTable at (0,128) size 512x128
-                RenderTableSection (anonymous) at (0,0) size 512x128
-                  RenderTableRow (anonymous) at (0,0) size 512x128 [color=#FFFF00]
+              RenderTable at (0,0) size 512x256
+                RenderTableSection (anonymous) at (0,0) size 512x256
+                  RenderTableRow (anonymous) at (0,0) size 512x128
                     RenderTableCell (anonymous) at (0,0) size 512x128 [r=0 c=0 rs=1 cs=1]
+                      RenderText {#text} at (0,0) size 512x128
+                        text run at (0,0) width 512: "ABCD"
+                  RenderTableRow (anonymous) at (0,128) size 512x128 [color=#FFFF00]
+                    RenderTableCell (anonymous) at (0,128) size 512x128 [r=1 c=0 rs=1 cs=1]
                       RenderText at (0,0) size 512x128
                         text run at (0,0) width 512: "4578"
       RenderBlock {DIV} at (0,256) size 784x128 [color=#008000]
index 5de8a6e..8db045a 100644 (file)
@@ -4,15 +4,15 @@ layer at (0,0) size 800x34
   RenderBlock {HTML} at (0,0) size 800x34
     RenderBody {BODY} at (8,8) size 784x18 [color=#0000FF]
       RenderBlock {DIV} at (0,0) size 784x18
-        RenderTable at (0,0) size 282x18 [color=#000000]
+        RenderTable at (0,0) size 282x18
           RenderTableSection (anonymous) at (0,0) size 282x18
             RenderTableRow (anonymous) at (0,0) size 282x18
-              RenderTableCell (anonymous) at (0,0) size 203x18 [color=#0000FF] [r=0 c=0 rs=1 cs=1]
+              RenderTableCell (anonymous) at (0,0) size 203x18 [r=0 c=0 rs=1 cs=1]
                 RenderText at (0,0) size 203x18
                   text run at (0,0) width 203: "You should just see a single line"
-              RenderTableCell {DIV} at (203,0) size 4x18 [color=#0000FF] [r=0 c=1 rs=1 cs=1]
+              RenderTableCell {DIV} at (203,0) size 4x18 [r=0 c=1 rs=1 cs=1]
                 RenderText {#text} at (0,0) size 4x18
                   text run at (0,0) width 4: " "
-              RenderTableCell (anonymous) at (207,0) size 75x18 [color=#0000FF] [r=0 c=2 rs=1 cs=1]
+              RenderTableCell (anonymous) at (207,0) size 75x18 [r=0 c=2 rs=1 cs=1]
                 RenderText at (0,0) size 75x18
                   text run at (0,0) width 75: "of blue text."
diff --git a/LayoutTests/platform/mac/fast/table/quote-text-around-iframe-expected.png b/LayoutTests/platform/mac/fast/table/quote-text-around-iframe-expected.png
new file mode 100644 (file)
index 0000000..02daed9
Binary files /dev/null and b/LayoutTests/platform/mac/fast/table/quote-text-around-iframe-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/table/quote-text-around-iframe-expected.txt b/LayoutTests/platform/mac/fast/table/quote-text-around-iframe-expected.txt
new file mode 100644 (file)
index 0000000..8b5d1f3
--- /dev/null
@@ -0,0 +1,25 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x198
+  RenderBlock {HTML} at (0,0) size 800x198
+    RenderBody {BODY} at (16,16) size 768x166
+      RenderTable at (0,0) size 394x166
+        RenderTableSection (anonymous) at (0,0) size 394x166
+          RenderTableRow {Q} at (0,0) size 394x166
+            RenderTableCell (anonymous) at (0,0) size 394x166 [r=0 c=0 rs=1 cs=1]
+              RenderInline (generated) at (0,0) size 13x37
+                RenderQuote at (0,129) size 13x37
+                  text run at (0,129) width 13: "\""
+              RenderText {#text} at (13,129) size 31x37
+                text run at (13,129) width 31: " A"
+              RenderPartObject {IFRAME} at (44,0) size 308x158 [border: (4px inset #000000)]
+                layer at (0,0) size 300x150
+                  RenderView at (0,0) size 300x150
+                layer at (0,0) size 300x150
+                  RenderBlock {HTML} at (0,0) size 300x150
+                    RenderBody {BODY} at (8,8) size 284x134
+              RenderText {#text} at (352,129) size 29x37
+                text run at (352,129) width 29: "B "
+              RenderInline (generated) at (0,0) size 13x37
+                RenderQuote at (381,129) size 13x37
+                  text run at (381,129) width 13: "\""
index 640157c..065618d 100644 (file)
@@ -7,9 +7,9 @@ layer at (0,0) size 800x600
         RenderBlock {DIV} at (19,19) size 746x18
           RenderText {#text} at (0,0) size 77x18
             text run at (0,0) width 77: "CONTENT"
-        RenderTable at (19,37) size 90x56 [color=#000000]
+        RenderTable at (19,37) size 90x56
           RenderTableSection (anonymous) at (0,0) size 90x56
             RenderTableRow (anonymous) at (0,0) size 90x56
-              RenderTableCell (anonymous) at (0,0) size 90x56 [color=#FF0000] [border: (3px solid #0000FF)] [r=0 c=0 rs=1 cs=1]
+              RenderTableCell (anonymous) at (0,0) size 90x56 [border: (3px solid #0000FF)] [r=0 c=0 rs=1 cs=1]
                 RenderText at (19,19) size 52x18
                   text run at (19,19) width 52: "AFTER"
index e188ce4..4e91bb4 100644 (file)
@@ -4,10 +4,10 @@ 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 784x112 [color=#FF0000] [border: (3px solid #008000)]
-        RenderTable at (19,19) size 101x56 [color=#000000]
+        RenderTable at (19,19) size 101x56
           RenderTableSection (anonymous) at (0,0) size 101x56
             RenderTableRow (anonymous) at (0,0) size 101x56
-              RenderTableCell (anonymous) at (0,0) size 101x56 [color=#FF0000] [border: (3px solid #0000FF)] [r=0 c=0 rs=1 cs=1]
+              RenderTableCell (anonymous) at (0,0) size 101x56 [border: (3px solid #0000FF)] [r=0 c=0 rs=1 cs=1]
                 RenderText at (19,19) size 63x18
                   text run at (19,19) width 63: "BEFORE"
         RenderBlock {DIV} at (19,75) size 746x18
index 9d2f4a5..ece90d7 100644 (file)
@@ -7,9 +7,9 @@ layer at (0,0) size 800x600
         RenderBlock {DIV} at (19,19) size 746x18
           RenderText {#text} at (0,0) size 77x18
             text run at (0,0) width 77: "CONTENT"
-        RenderTable at (19,37) size 52x18 [color=#000000]
+        RenderTable at (19,37) size 52x18
           RenderTableSection (anonymous) at (0,0) size 52x18
-            RenderTableRow (anonymous) at (0,0) size 52x18 [color=#FF0000] [border: (3px solid #0000FF)]
+            RenderTableRow (anonymous) at (0,0) size 52x18 [border: (3px solid #0000FF)]
               RenderTableCell (anonymous) at (0,0) size 52x18 [r=0 c=0 rs=1 cs=1]
                 RenderText at (0,0) size 52x18
                   text run at (0,0) width 52: "AFTER"
index 7ac56b8..d269c13 100644 (file)
@@ -4,9 +4,9 @@ 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 784x74 [color=#FF0000] [border: (3px solid #008000)]
-        RenderTable at (19,19) size 63x18 [color=#000000]
+        RenderTable at (19,19) size 63x18
           RenderTableSection (anonymous) at (0,0) size 63x18
-            RenderTableRow (anonymous) at (0,0) size 63x18 [color=#FF0000] [border: (3px solid #0000FF)]
+            RenderTableRow (anonymous) at (0,0) size 63x18 [border: (3px solid #0000FF)]
               RenderTableCell (anonymous) at (0,0) size 63x18 [r=0 c=0 rs=1 cs=1]
                 RenderText at (0,0) size 63x18
                   text run at (0,0) width 63: "BEFORE"
index 30c6a3b..61dd180 100644 (file)
@@ -1,3 +1,23 @@
+2011-09-21  Abhishek Arya  <inferno@chromium.org>
+
+        Not use anonymousContainer on beforeChild calculation
+        and let later code handle it. Fix style update on block-level
+        anonymous objects.
+        https://bugs.webkit.org/show_bug.cgi?id=67656
+
+        Reviewed by David Hyatt.
+
+        Test: fast/table/quote-text-around-iframe.html
+
+        * rendering/RenderTable.cpp:
+        (WebCore::RenderTable::addChild):
+        * rendering/RenderTableCell.cpp:
+        (WebCore::RenderTableCell::styleDidChange):
+        * rendering/RenderTableRow.cpp:
+        (WebCore::RenderTableRow::addChild):
+        * rendering/RenderObject.cpp:
+        (WebCore::RenderObject::propagateStyleToAnonymousChildren):
+
 2011-09-21  David Hyatt  <hyatt@apple.com>
 
         https://bugs.webkit.org/show_bug.cgi?id=68562
index cc259c1..be4fad8 100644 (file)
@@ -1888,17 +1888,26 @@ void RenderObject::propagateStyleToAnonymousChildren(bool blockChildrenOnly)
 {
     // FIXME: We could save this call when the change only affected non-inherited properties.
     for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
-        if (blockChildrenOnly ? child->isAnonymousBlock() : child->isAnonymous() && !child->isBeforeOrAfterContent()) {
-            RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyle(style());
-            if (style()->specifiesColumns()) {
-                if (child->style()->specifiesColumns())
-                    newStyle->inheritColumnPropertiesFrom(style());
-                if (child->style()->columnSpan())
-                    newStyle->setColumnSpan(true);
-            }
-            newStyle->setDisplay(blockChildrenOnly ? BLOCK : child->style()->display());
-            child->setStyle(newStyle.release());
+        if (!child->isAnonymous() || child->style()->styleType() != NOPSEUDO)
+            continue;
+
+        if (blockChildrenOnly && !child->isRenderBlock())
+            continue;
+
+#if ENABLE(FULLSCREEN_API)
+        if (child->isRenderFullScreen() || child->isRenderFullScreenPlaceholder())
+            continue;
+#endif
+
+        RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyle(style());
+        if (style()->specifiesColumns()) {
+            if (child->style()->specifiesColumns())
+                newStyle->inheritColumnPropertiesFrom(style());
+            if (child->style()->columnSpan())
+                newStyle->setColumnSpan(true);
         }
+        newStyle->setDisplay(child->style()->display());
+        child->setStyle(newStyle.release());
     }
 }
 
index dee57d8..3c29a48 100644 (file)
@@ -107,10 +107,8 @@ static inline void resetSectionPointerIfNotBefore(RenderTableSection*& ptr, Rend
 void RenderTable::addChild(RenderObject* child, RenderObject* beforeChild)
 {
     // Make sure we don't append things after :after-generated content if we have it.
-    if (!beforeChild) {
-        if (RenderObject* afterContentRenderer = findAfterContentRenderer())
-            beforeChild = anonymousContainer(afterContentRenderer);
-    }
+    if (!beforeChild)
+        beforeChild = findAfterContentRenderer();
 
     bool wrapInAnonymousSection = !child->isPositioned();
 
index 082eef4..e8b6272 100644 (file)
@@ -83,10 +83,8 @@ void RenderTableRow::styleDidChange(StyleDifference diff, const RenderStyle* old
 void RenderTableRow::addChild(RenderObject* child, RenderObject* beforeChild)
 {
     // Make sure we don't append things after :after-generated content if we have it.
-    if (!beforeChild) {
-        if (RenderObject* afterContentRenderer = findAfterContentRenderer())
-            beforeChild = anonymousContainer(afterContentRenderer);
-    }
+    if (!beforeChild)
+        beforeChild = findAfterContentRenderer();
 
     if (!child->isTableCell()) {
         RenderObject* last = beforeChild;
index af32d5b..0badb82 100644 (file)
@@ -98,10 +98,8 @@ void RenderTableSection::willBeDestroyed()
 void RenderTableSection::addChild(RenderObject* child, RenderObject* beforeChild)
 {
     // Make sure we don't append things after :after-generated content if we have it.
-    if (!beforeChild) {
-        if (RenderObject* afterContentRenderer = findAfterContentRenderer())
-            beforeChild = anonymousContainer(afterContentRenderer);
-    }
+    if (!beforeChild)
+        beforeChild = findAfterContentRenderer();
 
     if (!child->isTableRow()) {
         RenderObject* last = beforeChild;