Index: Source/core/rendering/RenderMultiColumnFlowThread.cpp |
diff --git a/Source/core/rendering/RenderMultiColumnFlowThread.cpp b/Source/core/rendering/RenderMultiColumnFlowThread.cpp |
index 070408cc3577962fc0ead4cc1e8607ea7d67f068..f3c82752e5841afbb8e8b84a0c9f0080058fd714 100644 |
--- a/Source/core/rendering/RenderMultiColumnFlowThread.cpp |
+++ b/Source/core/rendering/RenderMultiColumnFlowThread.cpp |
@@ -73,6 +73,56 @@ RenderMultiColumnSet* RenderMultiColumnFlowThread::lastMultiColumnSet() const |
return 0; |
} |
+static RenderObject* firstRendererInSet(RenderMultiColumnSet* multicolSet) |
+{ |
+ RenderBox* sibling = multicolSet->previousSiblingMultiColumnBox(); |
+ if (!sibling) |
+ return multicolSet->flowThread()->firstChild(); |
+ // Adjacent column content sets should not occur. We would have no way of figuring out what each |
+ // of them contains then. |
+ ASSERT(sibling->isRenderMultiColumnSpannerPlaceholder()); |
Julien - ping for review
2015/01/22 10:23:08
Note that this ASSERT is already covered by the to
mstensho (USE GERRIT)
2015/01/22 10:39:57
Yeah, since I want to explain that adjacent sets i
|
+ return toRenderMultiColumnSpannerPlaceholder(sibling)->rendererInFlowThread()->nextInPreOrderAfterChildren(multicolSet->flowThread()); |
+} |
+ |
+static RenderObject* lastRendererInSet(RenderMultiColumnSet* multicolSet) |
+{ |
+ RenderBox* sibling = multicolSet->nextSiblingMultiColumnBox(); |
+ if (!sibling) |
+ return 0; |
Julien - ping for review
2015/01/22 10:23:08
Shouldn't this return multicolSet->flowThread()->l
mstensho (USE GERRIT)
2015/01/22 10:39:57
I could use *lastLeafChild()*. The only caller of
Julien - ping for review
2015/01/22 11:45:44
Let's add a comment about this in the code to docu
mstensho (USE GERRIT)
2015/01/22 11:53:39
Done.
|
+ // Adjacent column content sets should not occur. We would have no way of figuring out what each |
+ // of them contains then. |
+ ASSERT(sibling->isRenderMultiColumnSpannerPlaceholder()); |
+ return toRenderMultiColumnSpannerPlaceholder(sibling)->rendererInFlowThread()->previousInPreOrder(multicolSet->flowThread()); |
+} |
+ |
+RenderMultiColumnSet* RenderMultiColumnFlowThread::findSetRendering(RenderObject* renderer) const |
+{ |
+ ASSERT(!containingColumnSpannerPlaceholder(renderer)); // should not be used for spanners or content inside them. |
+ ASSERT(renderer != this && renderer->isDescendantOf(this)); |
Julien - ping for review
2015/01/22 10:23:08
It's better to split && into different ASSERTs. Th
mstensho (USE GERRIT)
2015/01/22 10:39:57
Indeed.
Done.
|
+ RenderMultiColumnSet* multicolSet = firstMultiColumnSet(); |
+ if (!multicolSet) |
+ return 0; |
+ if (!multicolSet->nextSiblingMultiColumnSet()) |
+ return multicolSet; |
+ |
+ // This is potentially SLOW! But luckily very uncommon. You would have to dynamically insert a |
+ // spanner into the middle of column contents to need this. |
+ for (; multicolSet; multicolSet = multicolSet->nextSiblingMultiColumnSet()) { |
+ RenderObject* firstRenderer = firstRendererInSet(multicolSet); |
+ RenderObject* lastRenderer = lastRendererInSet(multicolSet); |
+ ASSERT(firstRenderer); |
+ |
+ for (RenderObject* walker = firstRenderer; walker; walker = walker->nextInPreOrder(this)) { |
+ if (walker == renderer) |
+ return multicolSet; |
+ if (walker == lastRenderer) |
+ break; |
+ } |
+ } |
+ |
+ return 0; |
+} |
+ |
RenderMultiColumnSpannerPlaceholder* RenderMultiColumnFlowThread::containingColumnSpannerPlaceholder(const RenderObject* descendant) const |
{ |
ASSERT(descendant->isDescendantOf(this)); |