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

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

Issue 1766223002: Clear floats even when they are not tracked by a previous sibling (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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/LayoutTests/fast/block/float/block-with-negative-margin-clears-float-expected.txt ('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/LayoutBlockFlow.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp b/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp
index 1bb6ccc5e24e3f6c3e8277a3d157f84a2d503d13..3192e662416adbfc9f1c27afc2194feaf437ab72 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp
@@ -901,19 +901,21 @@ void LayoutBlockFlow::rebuildFloatsFromIntruding()
// may have shifted to avoid floats, and any objects whose floats cannot interact with objects
// outside it (i.e. objects that create a new block formatting context).
LayoutBlockFlow* parentBlockFlow = toLayoutBlockFlow(parent());
- bool parentHasFloats = false;
+ bool siblingFloatMayIntrude = false;
LayoutObject* prev = previousSibling();
while (prev && (!prev->isBox() || !prev->isLayoutBlock() || toLayoutBlock(prev)->avoidsFloats() || toLayoutBlock(prev)->createsNewFormattingContext())) {
if (prev->isFloating())
- parentHasFloats = true;
+ siblingFloatMayIntrude = true;
prev = prev->previousSibling();
}
// First add in floats from the parent. Self-collapsing blocks let their parent track any floats that intrude into
- // them (as opposed to floats they contain themselves) so check for those here too.
+ // them (as opposed to floats they contain themselves) so check for those here too. If margin collapsing has moved
+ // us up past the top a previous sibling then we need to check for floats from the parent too.
LayoutUnit logicalTopOffset = logicalTop();
- bool parentHasIntrudingFloats = !parentHasFloats && (!prev || toLayoutBlockFlow(prev)->isSelfCollapsingBlock()) && parentBlockFlow->lowestFloatLogicalBottom() > logicalTopOffset;
- if (parentHasFloats || parentHasIntrudingFloats)
+ bool parentFloatsMayIntrude = !siblingFloatMayIntrude && (!prev || toLayoutBlockFlow(prev)->isSelfCollapsingBlock() || toLayoutBlock(prev)->logicalTop() > logicalTopOffset)
+ && parentBlockFlow->lowestFloatLogicalBottom() > logicalTopOffset;
+ if (siblingFloatMayIntrude || parentFloatsMayIntrude)
addIntrudingFloats(parentBlockFlow, parentBlockFlow->logicalLeftOffsetForContent(), logicalTopOffset);
// Add overhanging floats from the previous LayoutBlockFlow, but only if it has a float that intrudes into our space.
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/block/float/block-with-negative-margin-clears-float-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698