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

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

Issue 1210803002: Add isMultiColumnContainer() for convenience and readability. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/layout/LayoutMultiColumnFlowThread.cpp
diff --git a/Source/core/layout/LayoutMultiColumnFlowThread.cpp b/Source/core/layout/LayoutMultiColumnFlowThread.cpp
index 423cde52e9e5ac21432e0831966b1b1ad43c20b4..1920f4ebd5175cbcdc2ae89e139e801bdef49a2e 100644
--- a/Source/core/layout/LayoutMultiColumnFlowThread.cpp
+++ b/Source/core/layout/LayoutMultiColumnFlowThread.cpp
@@ -73,6 +73,13 @@ LayoutMultiColumnSet* LayoutMultiColumnFlowThread::lastMultiColumnSet() const
return nullptr;
}
+static inline bool isMultiColumnContainer(const LayoutObject& object)
+{
+ if (!object.isLayoutBlockFlow())
+ return false;
+ return toLayoutBlockFlow(object).multiColumnFlowThread();
+}
+
// Find the next layout object that has the multicol container in its containing block chain, skipping nested multicol containers.
static LayoutObject* nextInPreOrderAfterChildrenSkippingOutOfFlow(LayoutMultiColumnFlowThread* flowThread, LayoutObject* descendant)
{
@@ -95,7 +102,7 @@ static LayoutObject* nextInPreOrderAfterChildrenSkippingOutOfFlow(LayoutMultiCol
#if ENABLE(ASSERT)
// Make sure that we didn't stumble into an inner multicol container.
for (LayoutObject* walker = object->parent(); walker && walker != flowThread; walker = walker->parent())
- ASSERT(!walker->isLayoutBlockFlow() || !toLayoutBlockFlow(walker)->multiColumnFlowThread());
+ ASSERT(!isMultiColumnContainer(*walker));
#endif
return object;
}
@@ -120,7 +127,7 @@ static LayoutObject* previousInPreOrderSkippingOutOfFlow(LayoutMultiColumnFlowTh
for (ancestor = object->parent(); ; ancestor = ancestor->parent()) {
if (ancestor == flowThread)
return object;
- if (ancestor->isLayoutBlockFlow() && toLayoutBlockFlow(ancestor)->multiColumnFlowThread()) {
+ if (isMultiColumnContainer(*ancestor)) {
// We're inside an inner multicol container. We have no business there.
break;
}
@@ -137,7 +144,7 @@ static LayoutObject* previousInPreOrderSkippingOutOfFlow(LayoutMultiColumnFlowTh
#if ENABLE(ASSERT)
// Make sure that we didn't stumble into an inner multicol container.
for (LayoutObject* walker = object->parent(); walker && walker != flowThread; walker = walker->parent())
- ASSERT(!walker->isLayoutBlockFlow() || !toLayoutBlockFlow(walker)->multiColumnFlowThread());
+ ASSERT(!isMultiColumnContainer(*walker));
#endif
return object;
}
« 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