Chromium Code Reviews| Index: Source/core/rendering/RenderBlock.cpp |
| diff --git a/Source/core/rendering/RenderBlock.cpp b/Source/core/rendering/RenderBlock.cpp |
| index 6032af9af5a0375b784178fdb93eec83740789cf..9c4f14519a50bc2d8bf0bdd74475ed490ec03905 100644 |
| --- a/Source/core/rendering/RenderBlock.cpp |
| +++ b/Source/core/rendering/RenderBlock.cpp |
| @@ -110,6 +110,8 @@ static DelayedUpdateScrollInfoSet* gDelayedUpdateScrollInfoSet = 0; |
| static bool gColumnFlowSplitEnabled = true; |
| +static bool s_noLongerAffectsParentBlock = false; |
|
esprehn
2014/05/06 18:55:44
This should be a member of RenderBlock like the ot
|
| + |
| // This class helps dispatching the 'overflow' event on layout change. overflow can be set on RenderBoxes, yet the existing code |
| // only works on RenderBlocks. If this changes, this class should be shared with other RenderBoxes. |
| class OverflowEventDispatcher { |
| @@ -308,6 +310,10 @@ void RenderBlock::styleWillChange(StyleDifference diff, const RenderStyle& newSt |
| } |
| } |
| + s_noLongerAffectsParentBlock = !isFloatingOrOutOfFlowPositioned() |
|
Julien - ping for review
2014/05/07 01:38:46
RenderObject has a static boolean called s_affects
|
| + && (newStyle.isFloating() || newStyle.hasOutOfFlowPosition()) |
| + && parent() && parent()->isRenderBlockFlow(); |
| + |
| RenderBox::styleWillChange(diff, newStyle); |
| } |
| @@ -329,6 +335,9 @@ void RenderBlock::styleDidChange(StyleDifference diff, const RenderStyle* oldSty |
| { |
| RenderBox::styleDidChange(diff, oldStyle); |
| + if (s_noLongerAffectsParentBlock) |
|
ojan
2014/05/06 18:43:02
Why do you need the static? Can't you do the check
|
| + toRenderBlock(parent())->removeAnonymousWrappersIfRequired(); |
| + |
| RenderStyle* newStyle = style(); |
| if (!isAnonymousBlock()) { |
| @@ -1052,6 +1061,31 @@ static bool canMergeContiguousAnonymousBlocks(RenderObject* oldChild, RenderObje |
| && prev->isAnonymousColumnSpanBlock() == next->isAnonymousColumnSpanBlock(); |
| } |
| +bool RenderBlock::canRemoveAnonymousWrappers() |
| +{ |
| + for (RenderObject* child = firstChild(); child; child = child->nextSibling()) { |
|
Julien - ping for review
2014/05/07 01:38:46
You seem to care only about blocks so we should pr
|
| + if (!child->isAnonymousBlock() && !child->isFloatingOrOutOfFlowPositioned()) |
| + return false; |
| + if (child->isRenderBlock() && toRenderBlock(child)->continuation()) |
| + return false; |
| + } |
| + return true; |
| +} |
| + |
| +void RenderBlock::removeAnonymousWrappersIfRequired() |
| +{ |
| + if (!canRemoveAnonymousWrappers()) |
| + return; |
| + |
| + RenderObject* child = firstChild(); |
| + while (child) { |
|
Julien - ping for review
2014/05/07 01:38:46
Same comment about walking boxes (ideally blocks b
|
| + RenderObject* next = child->nextSibling(); |
| + if (child->isAnonymousBlock()) |
| + collapseAnonymousBlockChild(this, toRenderBlock(child)); |
| + child = next; |
|
Julien - ping for review
2014/05/07 01:38:46
I would put a comment here as this is important:
|
| + } |
| +} |
| + |
| void RenderBlock::collapseAnonymousBlockChild(RenderBlock* parent, RenderBlock* child) |
| { |
| // It's possible that this block's destruction may have been triggered by the |