Child not placed correctly when beforeChild (table part)
[WebKit.git] / Source / WebCore / rendering / RenderTable.cpp
index fc44605..dee57d8 100644 (file)
@@ -107,8 +107,10 @@ 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 && isAfterContent(lastChild()))
-        beforeChild = lastChild();
+    if (!beforeChild) {
+        if (RenderObject* afterContentRenderer = findAfterContentRenderer())
+            beforeChild = anonymousContainer(afterContentRenderer);
+    }
 
     bool wrapInAnonymousSection = !child->isPositioned();