Index: Source/core/rendering/RenderBlock.cpp |
diff --git a/Source/core/rendering/RenderBlock.cpp b/Source/core/rendering/RenderBlock.cpp |
index 25c4d2a6ee51a933700af5e15b0dabfed9b9ada1..e7d0a624cd4f50502d71b566e11060620fd78bd5 100644 |
--- a/Source/core/rendering/RenderBlock.cpp |
+++ b/Source/core/rendering/RenderBlock.cpp |
@@ -328,6 +328,9 @@ void RenderBlock::styleDidChange(StyleDifference diff, const RenderStyle* oldSty |
{ |
RenderBox::styleDidChange(diff, oldStyle); |
+ if (isFloatingOrOutOfFlowPositioned() && oldStyle && !oldStyle->isFloating() && !oldStyle->hasOutOfFlowPosition() && parent() && parent()->isRenderBlockFlow()) |
+ toRenderBlock(parent())->removeAnonymousWrappersIfRequired(); |
+ |
RenderStyle* newStyle = style(); |
if (!isAnonymousBlock()) { |
@@ -1077,6 +1080,21 @@ static bool canMergeContiguousAnonymousBlocks(RenderObject* oldChild, RenderObje |
&& prev->isAnonymousColumnSpanBlock() == next->isAnonymousColumnSpanBlock(); |
} |
+void RenderBlock::removeAnonymousWrappersIfRequired() |
+{ |
+ RenderBox* child = firstChildBox(); |
+ while (child && (child->isAnonymousBlock() || child->isFloatingOrOutOfFlowPositioned())) { |
+ RenderBox* next = child->nextSiblingBox(); |
+ // A continuation means the wrappers are still required. |
+ if (next && next->isRenderBlock() && toRenderBlock(next)->continuation()) |
+ return; |
+ if (child->isAnonymousBlock()) |
+ collapseAnonymousBlockChild(this, toRenderBlock(child)); |
+ // |child| may have been destroyed. |
+ child = next; |
+ } |
+} |
+ |
void RenderBlock::collapseAnonymousBlockChild(RenderBlock* parent, RenderBlock* child) |
{ |
// It's possible that this block's destruction may have been triggered by the |