Child not placed correctly when beforeChild (table part)
[WebKit.git] / Source / WebCore / rendering / RenderTableSection.cpp
index dc44094..af32d5b 100644 (file)
@@ -98,8 +98,10 @@ 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 && isAfterContent(lastChild()))
-        beforeChild = lastChild();
+    if (!beforeChild) {
+        if (RenderObject* afterContentRenderer = findAfterContentRenderer())
+            beforeChild = anonymousContainer(afterContentRenderer);
+    }
 
     if (!child->isTableRow()) {
         RenderObject* last = beforeChild;