Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(782)

Unified Diff: third_party/WebKit/Source/core/layout/LayoutBox.cpp

Issue 1551573002: Clear box from percentage descendants when it is split off from the ancestor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBlock.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/layout/LayoutBox.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutBox.cpp b/third_party/WebKit/Source/core/layout/LayoutBox.cpp
index fb82a7c0afc2369dcb56c705915c16ed387d0d39..060a7b55bdb7c8a9bc330b6607d1987a45e84944 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBox.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBox.cpp
@@ -4670,6 +4670,23 @@ static void markBoxForRelayoutAfterSplit(LayoutBox* box)
box->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(LayoutInvalidationReason::AnonymousBlockChange);
}
+static bool collapseIfWillBecomeLoneAnonymousBlock(LayoutBox* child)
+{
+ if (!child->isAnonymousBlock())
+ return false;
+ LayoutBlock* childBlock = toLayoutBlock(child);
+ if (childBlock->beingDestroyed())
+ return false;
+ // We're splitting from our previousSibling().
mstensho (USE GERRIT) 2016/01/21 19:12:33 It's not lone if it has a previousSibling(). Pleas
rhogan 2016/01/24 12:31:37 No, but it's about to split from the previousSibli
mstensho (USE GERRIT) 2016/01/25 09:17:07 That's making an assumption about what the caller
+ if (child->nextSibling() || childBlock->continuation())
+ return false;
+ LayoutBlock* parent = child->containingBlock();
+ if (parent->isRubyBase() || parent->isRubyRun())
+ return false;
+ LayoutBlock::collapseAnonymousBlockChild(parent, childBlock);
+ return true;
+}
+
LayoutObject* LayoutBox::splitAnonymousBoxesAroundChild(LayoutObject* beforeChild)
{
bool didSplitParentAnonymousBoxes = false;
@@ -4694,9 +4711,17 @@ LayoutObject* LayoutBox::splitAnonymousBoxesAroundChild(LayoutObject* beforeChil
markBoxForRelayoutAfterSplit(boxToSplit);
markBoxForRelayoutAfterSplit(postBox);
+ // Splitting the box means the left side of the container chain will lose any percent height descendants
+ // below |postBox| in the right hand side.
+ if (LayoutBlock::hasPercentHeightContainerMap())
+ LayoutBlock::clearPercentHeightDescendantsFrom(postBox);
+
beforeChild = postBox;
} else {
- beforeChild = boxToSplit;
+ // If a lone anonymous block is now unnecessary collapse it away - this will make beforeChild's current
+ // grandparent its parent so no need to set it before looping.
mstensho (USE GERRIT) 2016/01/21 19:12:33 Thanks for explaining!
+ if (!collapseIfWillBecomeLoneAnonymousBlock(boxToSplit))
+ beforeChild = boxToSplit;
}
}
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBlock.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698