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() |