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

Unified Diff: Source/core/rendering/RenderBlock.cpp

Issue 255433003: RenderBlock::isSelfCollapsingBlock() should early exit on a relayout boundary (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: add test Created 6 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
« no previous file with comments | « LayoutTests/fast/overflow/overflow-dirty-relayout-boundary-no-crash-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderBlock.cpp
diff --git a/Source/core/rendering/RenderBlock.cpp b/Source/core/rendering/RenderBlock.cpp
index c16e862944c449e0bab1cdab689d03818ecd1e1c..322199952c24243828c4b7d809deb475136a03da 100644
--- a/Source/core/rendering/RenderBlock.cpp
+++ b/Source/core/rendering/RenderBlock.cpp
@@ -1178,11 +1178,6 @@ void RenderBlock::removeChild(RenderObject* oldChild)
bool RenderBlock::isSelfCollapsingBlock() const
{
- // 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"));
-
// 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,
@@ -1191,9 +1186,18 @@ bool RenderBlock::isSelfCollapsingBlock() const
// (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 (createsBlockFormattingContext())
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()
« no previous file with comments | « LayoutTests/fast/overflow/overflow-dirty-relayout-boundary-no-crash-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698