Index: Source/WebCore/rendering/RenderBlock.cpp |
=================================================================== |
--- Source/WebCore/rendering/RenderBlock.cpp (revision 107332) |
+++ Source/WebCore/rendering/RenderBlock.cpp (working copy) |
@@ -1019,6 +1019,18 @@ |
&& prev->isAnonymousColumnSpanBlock() == next->isAnonymousColumnSpanBlock(); |
} |
+void RenderBlock::collapseAnonymousBoxChild(RenderBlock* parent, RenderObject* child) |
+{ |
+ parent->setNeedsLayoutAndPrefWidthsRecalc(); |
+ parent->setChildrenInline(child->childrenInline()); |
+ RenderBlock* anonBlock = toRenderBlock(parent->children()->removeChildNode(parent, child, child->hasLayer())); |
+ anonBlock->moveAllChildrenTo(parent, child->hasLayer()); |
+ // Delete the now-empty block's lines and nuke it. |
+ if (!parent->documentBeingDestroyed()) |
+ anonBlock->deleteLineBoxTree(); |
+ anonBlock->destroy(); |
+} |
+ |
void RenderBlock::removeChild(RenderObject* oldChild) |
{ |
// If this child is a block, and if our previous and next siblings are |
@@ -1075,13 +1087,17 @@ |
// The removal has knocked us down to containing only a single anonymous |
// box. We can go ahead and pull the content right back up into our |
// box. |
- setNeedsLayoutAndPrefWidthsRecalc(); |
- setChildrenInline(child->childrenInline()); |
- RenderBlock* anonBlock = toRenderBlock(children()->removeChildNode(this, child, child->hasLayer())); |
- anonBlock->moveAllChildrenTo(this, child->hasLayer()); |
- // Delete the now-empty block's lines and nuke it. |
- anonBlock->deleteLineBoxTree(); |
- anonBlock->destroy(); |
+ collapseAnonymousBoxChild(this, child); |
+ } else if ((prev && prev->isAnonymousBlock()) || (next && next->isAnonymousBlock())) { |
+ // It's possible that the removal has knocked us down to a single anonymous |
+ // block with pseudo-style element siblings (e.g. first-letter). If these |
+ // are floating, then we need to pull the content up also. |
+ RenderBlock* anonBlock = toRenderBlock((prev && prev->isAnonymousBlock()) ? prev : next); |
+ if ((anonBlock->previousSibling() || anonBlock->nextSibling()) |
+ && (!anonBlock->previousSibling() || (anonBlock->previousSibling()->style()->styleType() != NOPSEUDO && anonBlock->previousSibling()->isFloating())) |
+ && (!anonBlock->nextSibling() || (anonBlock->nextSibling()->style()->styleType() != NOPSEUDO && anonBlock->nextSibling()->isFloating()))) { |
+ collapseAnonymousBoxChild(this, anonBlock); |
+ } |
} |
if (!firstChild() && !documentBeingDestroyed()) { |