Index: Source/core/rendering/RenderBox.cpp |
diff --git a/Source/core/rendering/RenderBox.cpp b/Source/core/rendering/RenderBox.cpp |
index 05e083c2d1c08572ad0cde799d086cd39cd547cb..17d70e2db950bf2b44a6ff63f1cb199197b76292 100644 |
--- a/Source/core/rendering/RenderBox.cpp |
+++ b/Source/core/rendering/RenderBox.cpp |
@@ -3760,7 +3760,10 @@ static bool isReplacedElement(Node* node) |
bool RenderBox::avoidsFloats() const |
{ |
- return isReplaced() || isReplacedElement(node()) || hasOverflowClip() || isHR() || isLegend() || isWritingModeRoot() || isFlexItemIncludingDeprecated(); |
+ // CSS2.1: "The border box of a table, a block-level replaced element, or an element in the normal flow that establishes a new block formatting |
+ // context .. must not overlap the margin box of any floats in the same block formatting context." |
+ // FIXME: The inclusion of horizontal rule and legend elements here isn't covered by any spec. |
+ return isReplaced() || isReplacedElement(node()) || isHR() || isLegend() || isTable() || (!isFloatingOrOutOfFlowPositioned() && createsBlockFormattingContext()); |
} |
PaintInvalidationReason RenderBox::paintInvalidationReason(const RenderLayerModelObject& paintInvalidationContainer, |
@@ -3879,6 +3882,12 @@ void RenderBox::invalidatePaintRectClippedByOldAndNewBounds(const RenderLayerMod |
invalidatePaintUsingContainer(&paintInvalidationContainer, rectClippedByNewBounds, PaintInvalidationIncremental); |
} |
+bool RenderBox::createsBlockFormattingContext() const |
+{ |
+ return isInlineBlockOrInlineTable() || isFloatingOrOutOfFlowPositioned() || hasOverflowClip() || isFlexItemIncludingDeprecated() |
+ || style()->specifiesColumns() || isRenderFlowThread() || isTableCell() || isTableCaption() || isFieldset() || isWritingModeRoot() || isDocumentElement() || style()->columnSpan(); |
+} |
+ |
void RenderBox::markForPaginationRelayoutIfNeeded(SubtreeLayoutScope& layoutScope) |
{ |
ASSERT(!needsLayout()); |