Chromium Code Reviews| Index: Source/core/rendering/RenderBlock.cpp |
| diff --git a/Source/core/rendering/RenderBlock.cpp b/Source/core/rendering/RenderBlock.cpp |
| index 6aab05d6c31015630e53d81b0bf4053e74ad7be2..f4aa9a52970e67d42ea15e0e33bca61816d0ee06 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()) |
|
esprehn
2014/05/19 20:54:58
You don't need these nested parens, it's all &&
|
| + toRenderBlock(parent())->removeAnonymousWrappersIfRequired(); |
| + |
| RenderStyle* newStyle = style(); |
| if (!isAnonymousBlock()) { |
| @@ -1052,6 +1055,21 @@ static bool canMergeContiguousAnonymousBlocks(RenderObject* oldChild, RenderObje |
| && prev->isAnonymousColumnSpanBlock() == next->isAnonymousColumnSpanBlock(); |
| } |
| +void RenderBlock::removeAnonymousWrappersIfRequired() |
| +{ |
| + RenderBlock* child = toRenderBlock(firstChildBox()); |
|
esprehn
2014/05/19 20:54:58
How do you know this cast is safe?
|
| + while (child && (child->isAnonymousBlock() || child->isFloatingOrOutOfFlowPositioned())) { |
| + RenderBlock* next = toRenderBlock(child->nextSiblingBox()); |
|
esprehn
2014/05/19 20:54:58
ditto
|
| + // A continuation means the wrappers are still required. |
| + if (next && next->continuation()) |
| + return; |
| + if (child->isAnonymousBlock()) |
| + collapseAnonymousBlockChild(this, 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 |