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

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

Issue 1966223002: Helper for interesting things to do when a block becomes a float or out-of-flow. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixup! Helper for interesting things to do when a block becomes a float or out-of-flow. Created 4 years, 7 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/Source/core/layout/LayoutBlockFlow.h ('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 88c43f48f85fbb14c72f6dabe2e01682b9829ea4..b7a96fee67f056314b7d2dc3be9b9583436495dd 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp
@@ -2372,7 +2372,27 @@ void LayoutBlockFlow::moveAllChildrenIncludingFloatsTo(LayoutBlock* toBlock, boo
toBlockFlow->m_floatingObjects->add(floatingObject.unsafeClone());
}
}
+}
+
+void LayoutBlockFlow::childBecameFloatingOrOutOfFlow(LayoutBox* child)
+{
+ makeChildrenInlineIfPossible();
+ // Reparent the child to an adjacent anonymous block if one is available.
+ LayoutObject* prev = child->previousSibling();
+ if (prev && prev->isAnonymousBlock() && prev->isLayoutBlockFlow()) {
+ LayoutBlockFlow* newContainer = toLayoutBlockFlow(prev);
+ moveChildTo(newContainer, child, nullptr, false);
+ // The anonymous block we've moved to may now be adjacent to former siblings of ours
+ // that it can contain also.
+ newContainer->reparentSubsequentFloatingOrOutOfFlowSiblings();
+ return;
+ }
+ LayoutObject* next = child->nextSibling();
+ if (next && next->isAnonymousBlock() && next->isLayoutBlockFlow()) {
+ LayoutBlockFlow* newContainer = toLayoutBlockFlow(next);
+ moveChildTo(newContainer, child, newContainer->firstChild(), false);
+ }
}
void LayoutBlockFlow::invalidatePaintForOverhangingFloats(bool paintAllDescendants)
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBlockFlow.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698