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

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

Issue 1933153002: Move self-collapse checking to LayoutBlockFlow and cache it completely. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: The winbots had a point. How do you like this, then, winbots? bool bitfields would probably look ev… Created 4 years, 8 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
Index: third_party/WebKit/Source/core/layout/LayoutBlock.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutBlock.cpp b/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
index 375d4a4277ba5116d997db3195fd9481a189da6f..a3f657d18a227fc6664fde0f584770e73d53250a 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
@@ -117,7 +117,7 @@ LayoutBlock::LayoutBlock(ContainerNode* node)
, m_hasMarkupTruncation(false)
, m_widthAvailableToChildrenChanged(false)
, m_heightAvailableToChildrenChanged(false)
- , m_hasOnlySelfCollapsingChildren(false)
+ , m_isSelfCollapsing(false)
, m_descendantsWithFloatsMarkedForLayout(false)
, m_hasPositionedObjects(false)
, m_hasPercentHeightDescendants(false)
@@ -747,68 +747,6 @@ void LayoutBlock::removeChild(LayoutObject* oldChild)
}
}
-bool LayoutBlock::isSelfCollapsingBlock() const
-{
- // We are not self-collapsing if we
- // (a) have a non-zero height according to layout (an optimization to avoid wasting time)
- // (b) are a table,
- // (c) have border/padding,
- // (d) have a min-height
- // (e) have specified that one of our margins can't collapse using a CSS extension
- // (f) establish a new block formatting context.
-
- // The early exit must be done before we check for clean layout.
- // We should be able to give a quick answer if the box is a relayout boundary.
- // Being a relayout boundary implies a block formatting context, and also
- // our internal layout shouldn't affect our container in any way.
- if (createsNewFormattingContext())
- return false;
-
- // Placeholder elements are not laid out until the dimensions of their parent text control are known, so they
- // don't get layout until their parent has had layout - this is unique in the layout tree and means
- // when we call isSelfCollapsingBlock on them we find that they still need layout.
- ASSERT(!needsLayout() || (node() && node()->isElementNode() && toElement(node())->shadowPseudoId() == "-webkit-input-placeholder"));
-
- if (logicalHeight() > 0
- || isTable() || borderAndPaddingLogicalHeight()
- || style()->logicalMinHeight().isPositive()
- || style()->marginBeforeCollapse() == MarginCollapseSeparate || style()->marginAfterCollapse() == MarginCollapseSeparate)
- return false;
-
- Length logicalHeightLength = style()->logicalHeight();
- bool hasAutoHeight = logicalHeightLength.isAuto();
- if (logicalHeightLength.hasPercent() && !document().inQuirksMode()) {
- hasAutoHeight = true;
- for (LayoutBlock* cb = containingBlock(); !cb->isLayoutView(); cb = cb->containingBlock()) {
- if (cb->style()->logicalHeight().isFixed() || cb->isTableCell())
- hasAutoHeight = false;
- }
- }
-
- // If the height is 0 or auto, then whether or not we are a self-collapsing block depends
- // on whether we have content that is all self-collapsing or not.
- // TODO(alancutter): Make this work correctly for calc lengths.
- if (hasAutoHeight || ((logicalHeightLength.isFixed() || logicalHeightLength.hasPercent()) && logicalHeightLength.isZero())) {
- // If the block has inline children, see if we generated any line boxes. If we have any
- // line boxes, then we can't be self-collapsing, since we have content.
- if (childrenInline())
- return !firstLineBox();
-
- // Whether or not we collapse is dependent on whether all our normal flow children
- // are also self-collapsing.
- if (m_hasOnlySelfCollapsingChildren)
- return true;
- for (LayoutBox* child = firstChildBox(); child; child = child->nextSiblingBox()) {
- if (child->isFloatingOrOutOfFlowPositioned())
- continue;
- if (!child->isSelfCollapsingBlock())
- return false;
- }
- return true;
- }
- return false;
-}
-
void LayoutBlock::startDelayUpdateScrollInfo()
{
if (gDelayUpdateScrollInfo == 0) {
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBlock.h ('k') | third_party/WebKit/Source/core/layout/LayoutBlockFlow.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698