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

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

Issue 1476773002: Document early bail in contentWasLaidOut() better. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 | « no previous file | 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/LayoutMultiColumnFlowThread.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutMultiColumnFlowThread.cpp b/third_party/WebKit/Source/core/layout/LayoutMultiColumnFlowThread.cpp
index fc7e68b10ea14441ebadd74d365f89ff1cb85ac4..043e3e5247e4532eb6f11bee69f109c3320ec3f6 100644
--- a/third_party/WebKit/Source/core/layout/LayoutMultiColumnFlowThread.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutMultiColumnFlowThread.cpp
@@ -918,8 +918,17 @@ void LayoutMultiColumnFlowThread::contentWasLaidOut(LayoutUnit logicalTopInFlowT
// Check if we need another fragmentainer group. If we've run out of columns in the last
// fragmentainer group (column row), we need to insert another fragmentainer group to hold more
// columns.
- if (!multiColumnBlockFlow()->isInsideFlowThread())
- return; // Early bail. We're not nested, so waste no more time on this.
+
+ // First figure out if there's any chance that we're nested at all. If we can be sure that
+ // we're not, bail early. This code is run very often, and since locating a containing flow
+ // thread has some cost (depending on tree depth), avoid calling enclosingFlowThread() right
+ // away. This test may give some false positives (hence the "mayBe"), if we're in an
+ // out-of-flow subtree and have an outer multicol container that doesn't affect us, but that's
+ // okay. We'll discover that further down the road when trying to locate our enclosing flow
+ // thread for real.
+ bool mayBeNested = multiColumnBlockFlow()->isInsideFlowThread();
+ if (!mayBeNested)
+ return;
if (!isInInitialLayoutPass()) {
// We only insert additional fragmentainer groups in the initial layout pass. We only want
// to balance columns in the last fragmentainer group (if we need to balance at all), so we
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698