Commit 8f566488 authored by robhogan's avatar robhogan Committed by Commit bot

Clear box from percentage descendants when it is split off from the ancestor

Ensure that ancestors that no longer need to track percentage descendants
after the split have them removed from their tracking lists.

BUG=568387

Review URL: https://codereview.chromium.org/1551573002

Cr-Commit-Position: refs/heads/master@{#371791}
parent e5f57304
<!DOCTYPE html>
<p>PASS if no crash or assertion failure.</p>
<div style="display:table-row-group;">
<div></div>
<div id="splitter" style="display:none;"></div>
<div style="display:inline-block; width:75px; height:50%; background:blue;"></div>
</div>
<script>
if (window.testRunner)
testRunner.dumpAsText();
document.body.offsetTop;
document.getElementById("splitter").style.display = "table-row";
</script>
...@@ -4374,12 +4374,11 @@ static void markBoxForRelayoutAfterSplit(LayoutBox* box) ...@@ -4374,12 +4374,11 @@ static void markBoxForRelayoutAfterSplit(LayoutBox* box)
LayoutObject* LayoutBox::splitAnonymousBoxesAroundChild(LayoutObject* beforeChild) LayoutObject* LayoutBox::splitAnonymousBoxesAroundChild(LayoutObject* beforeChild)
{ {
bool didSplitParentAnonymousBoxes = false; LayoutBox* boxAtTopOfNewBranch = nullptr;
while (beforeChild->parent() != this) { while (beforeChild->parent() != this) {
LayoutBox* boxToSplit = toLayoutBox(beforeChild->parent()); LayoutBox* boxToSplit = toLayoutBox(beforeChild->parent());
if (boxToSplit->slowFirstChild() != beforeChild && boxToSplit->isAnonymous()) { if (boxToSplit->slowFirstChild() != beforeChild && boxToSplit->isAnonymous()) {
didSplitParentAnonymousBoxes = true;
// We have to split the parent box into two boxes and move children // We have to split the parent box into two boxes and move children
// from |beforeChild| to end into the new post box. // from |beforeChild| to end into the new post box.
...@@ -4395,6 +4394,7 @@ LayoutObject* LayoutBox::splitAnonymousBoxesAroundChild(LayoutObject* beforeChil ...@@ -4395,6 +4394,7 @@ LayoutObject* LayoutBox::splitAnonymousBoxesAroundChild(LayoutObject* beforeChil
markBoxForRelayoutAfterSplit(boxToSplit); markBoxForRelayoutAfterSplit(boxToSplit);
markBoxForRelayoutAfterSplit(postBox); markBoxForRelayoutAfterSplit(postBox);
boxAtTopOfNewBranch = postBox;
beforeChild = postBox; beforeChild = postBox;
} else { } else {
...@@ -4402,8 +4402,12 @@ LayoutObject* LayoutBox::splitAnonymousBoxesAroundChild(LayoutObject* beforeChil ...@@ -4402,8 +4402,12 @@ LayoutObject* LayoutBox::splitAnonymousBoxesAroundChild(LayoutObject* beforeChil
} }
} }
if (didSplitParentAnonymousBoxes) // Splitting the box means the left side of the container chain will lose any percent height descendants
// below |boxAtTopOfNewBranch| on the right hand side.
if (boxAtTopOfNewBranch) {
boxAtTopOfNewBranch->clearPercentHeightDescendants();
markBoxForRelayoutAfterSplit(this); markBoxForRelayoutAfterSplit(this);
}
ASSERT(beforeChild->parent() == this); ASSERT(beforeChild->parent() == this);
return beforeChild; return beforeChild;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment