Index: Source/core/rendering/RenderBlock.cpp |
diff --git a/Source/core/rendering/RenderBlock.cpp b/Source/core/rendering/RenderBlock.cpp |
index a95ad9ee2a5fb8d4cc81f71a43687feab0881aa4..e12eb65c34c70b4ac03cf0e4e739bd6dd15669cc 100644 |
--- a/Source/core/rendering/RenderBlock.cpp |
+++ b/Source/core/rendering/RenderBlock.cpp |
@@ -331,6 +331,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()) { |
@@ -1080,6 +1083,26 @@ static bool canMergeContiguousAnonymousBlocks(RenderObject* oldChild, RenderObje |
&& prev->isAnonymousColumnSpanBlock() == next->isAnonymousColumnSpanBlock(); |
} |
+void RenderBlock::removeAnonymousWrappersIfRequired() |
esprehn
2014/05/27 20:05:03
Should this method be in RenderBlockFlow instead?
|
+{ |
+ Vector<RenderBox*> blocksToRemove; |
esprehn
2014/05/27 20:05:03
Add inline capacity, I'd go with 8 or 16.
|
+ RenderBox* child = firstChildBox(); |
+ while (child) { |
+ // There are still block children in the container, so any anonymous wrappers are still needed. |
+ if (!child->isAnonymousBlock() && !child->isFloatingOrOutOfFlowPositioned()) |
+ return; |
+ // We can't remove anonymous wrappers if they contain continuations as this means there are block children present. |
+ if (child->isRenderBlock() && toRenderBlock(child)->continuation()) |
+ return; |
+ if (child->isAnonymousBlock()) |
+ blocksToRemove.append(child); |
+ child = child->nextSiblingBox(); |
esprehn
2014/05/27 20:05:03
This should be a for() loop now.
|
+ } |
+ |
+ for (unsigned i = 0; i < blocksToRemove.size(); i++) |
esprehn
2014/05/27 20:05:03
size_t
|
+ collapseAnonymousBlockChild(this, toRenderBlock(blocksToRemove[i])); |
+} |
+ |
void RenderBlock::collapseAnonymousBlockChild(RenderBlock* parent, RenderBlock* child) |
{ |
// It's possible that this block's destruction may have been triggered by the |