[RenderTreeBuilder] Move RenderMultiColumnFlow::resolveMovedChild to RenderTreeBuilder.
authorzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 31 Jan 2018 16:45:30 +0000 (16:45 +0000)
committerzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 31 Jan 2018 16:45:30 +0000 (16:45 +0000)
https://bugs.webkit.org/show_bug.cgi?id=182315
<rdar://problem/37048160>

Reviewed by Antti Koivisto.

resolveMovedChild() is only called from RenderTreeBuilder.

No change in functionality.

* rendering/RenderFragmentedFlow.h:
* rendering/RenderMultiColumnFlow.cpp:
(WebCore::RenderMultiColumnFlow::resolveMovedChild const): Deleted.
* rendering/RenderMultiColumnFlow.h:
* rendering/updating/RenderTreeBuilder.cpp:
(WebCore::RenderTreeBuilder::resolveMovedChildForMultiColumnFlow):
* rendering/updating/RenderTreeBuilder.h:
* rendering/updating/RenderTreeBuilderBlockFlow.cpp:
(WebCore::RenderTreeBuilder::BlockFlow::insertChild):
* rendering/updating/RenderTreeBuilderInline.cpp:
(WebCore::RenderTreeBuilder::Inline::insertChild):
* rendering/updating/RenderTreeBuilderMultiColumn.cpp:
(WebCore::RenderTreeBuilder::MultiColumn::resolveMovedChild):
* rendering/updating/RenderTreeBuilderMultiColumn.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@227903 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderFragmentedFlow.h
Source/WebCore/rendering/RenderMultiColumnFlow.cpp
Source/WebCore/rendering/RenderMultiColumnFlow.h
Source/WebCore/rendering/updating/RenderTreeBuilder.cpp
Source/WebCore/rendering/updating/RenderTreeBuilder.h
Source/WebCore/rendering/updating/RenderTreeBuilderBlockFlow.cpp
Source/WebCore/rendering/updating/RenderTreeBuilderInline.cpp
Source/WebCore/rendering/updating/RenderTreeBuilderMultiColumn.cpp
Source/WebCore/rendering/updating/RenderTreeBuilderMultiColumn.h

index 2091239..c90ee2e 100644 (file)
@@ -1,3 +1,30 @@
+2018-01-31  Zalan Bujtas  <zalan@apple.com>
+
+        [RenderTreeBuilder] Move RenderMultiColumnFlow::resolveMovedChild to RenderTreeBuilder.
+        https://bugs.webkit.org/show_bug.cgi?id=182315
+        <rdar://problem/37048160>
+
+        Reviewed by Antti Koivisto.
+
+        resolveMovedChild() is only called from RenderTreeBuilder.
+
+        No change in functionality.
+
+        * rendering/RenderFragmentedFlow.h:
+        * rendering/RenderMultiColumnFlow.cpp:
+        (WebCore::RenderMultiColumnFlow::resolveMovedChild const): Deleted.
+        * rendering/RenderMultiColumnFlow.h:
+        * rendering/updating/RenderTreeBuilder.cpp:
+        (WebCore::RenderTreeBuilder::resolveMovedChildForMultiColumnFlow):
+        * rendering/updating/RenderTreeBuilder.h:
+        * rendering/updating/RenderTreeBuilderBlockFlow.cpp:
+        (WebCore::RenderTreeBuilder::BlockFlow::insertChild):
+        * rendering/updating/RenderTreeBuilderInline.cpp:
+        (WebCore::RenderTreeBuilder::Inline::insertChild):
+        * rendering/updating/RenderTreeBuilderMultiColumn.cpp:
+        (WebCore::RenderTreeBuilder::MultiColumn::resolveMovedChild):
+        * rendering/updating/RenderTreeBuilderMultiColumn.h:
+
 2018-01-31  Philippe Normand  <pnormand@igalia.com>
 
         [GStreamer] Silent WebAudio buffers support
index d699423..cdd43cc 100644 (file)
@@ -86,10 +86,6 @@ public:
 
     virtual bool singleFragmentHasUniformLogicalHeight() const { return true; }
     
-    // Some renderers (column spanners) are moved out of the flow thread to live among column
-    // sets. If |child| is such a renderer, resolve it to the placeholder that lives at the original
-    // location in the tree.
-    virtual RenderObject* resolveMovedChild(RenderObject* child) const { return child; }
     // Called when a descendant of the flow thread has been inserted.
     virtual void fragmentedFlowDescendantInserted(RenderObject&) { }
     // Called when a sibling or descendant of the flow thread is about to be removed.
index fd6e7a4..d67cf57 100644 (file)
@@ -167,31 +167,6 @@ void RenderMultiColumnFlow::willBeRemovedFromTree()
     RenderFragmentedFlow::willBeRemovedFromTree();
 }
 
-RenderObject* RenderMultiColumnFlow::resolveMovedChild(RenderObject* child) const
-{
-    if (!child)
-        return nullptr;
-
-    if (child->style().columnSpan() != ColumnSpanAll || !is<RenderBox>(*child)) {
-        // We only need to resolve for column spanners.
-        return child;
-    }
-    // The renderer for the actual DOM node that establishes a spanner is moved from its original
-    // location in the render tree to becoming a sibling of the column sets. In other words, it's
-    // moved out from the flow thread (and becomes a sibling of it). When we for instance want to
-    // create and insert a renderer for the sibling node immediately preceding the spanner, we need
-    // to map that spanner renderer to the spanner's placeholder, which is where the new inserted
-    // renderer belongs.
-    if (RenderMultiColumnSpannerPlaceholder* placeholder = findColumnSpannerPlaceholder(downcast<RenderBox>(child)))
-        return placeholder;
-
-    // This is an invalid spanner, or its placeholder hasn't been created yet. This happens when
-    // moving an entire subtree into the flow thread, when we are processing the insertion of this
-    // spanner's preceding sibling, and we obviously haven't got as far as processing this spanner
-    // yet.
-    return child;
-}
-
 bool RenderMultiColumnFlow::isColumnSpanningDescendant(const RenderBox& descendantBox) const
 {
     return descendantBox.style().columnSpan() == ColumnSpanAll;
index 7b4b104..bd6bf50 100644 (file)
@@ -108,7 +108,6 @@ private:
     const char* renderName() const override;
     void addFragmentToThread(RenderFragmentContainer*) override;
     void willBeRemovedFromTree() override;
-    RenderObject* resolveMovedChild(RenderObject* child) const override;
     void fragmentedFlowDescendantInserted(RenderObject&) override;
     void fragmentedFlowRelativeWillBeRemoved(RenderObject&) override;
     void fragmentedFlowDescendantBoxLaidOut(RenderBox*) override;
index 97f5011..89d604c 100644 (file)
@@ -388,4 +388,9 @@ void RenderTreeBuilder::updateAfterDescendants(RenderElement& renderer)
         multiColumnBuilder().updateAfterDescendants(downcast<RenderBlockFlow>(renderer));
 }
 
+RenderObject* RenderTreeBuilder::resolveMovedChildForMultiColumnFlow(RenderFragmentedFlow& enclosingFragmentedFlow, RenderObject* beforeChild)
+{
+    return multiColumnBuilder().resolveMovedChild(enclosingFragmentedFlow, beforeChild);
+}
+
 }
index b036627..4c2758d 100644 (file)
@@ -76,6 +76,7 @@ public:
     RenderObject* splitAnonymousBoxesAroundChild(RenderBox& parent, RenderObject* beforeChild);
     void moveRubyChildren(RenderRubyBase& from, RenderRubyBase& to);
     void childFlowStateChangesAndAffectsParentBlock(RenderElement& child);
+    RenderObject* resolveMovedChildForMultiColumnFlow(RenderFragmentedFlow& enclosingFragmentedFlow, RenderObject* beforeChild);
 
 private:
     class FirstLetter;
index 4502c0f..52e7adc 100644 (file)
@@ -41,7 +41,7 @@ void RenderTreeBuilder::BlockFlow::insertChild(RenderBlockFlow& parent, RenderPt
         return m_builder.insertChild(*parent.multiColumnFlow(), WTFMove(child), beforeChild);
     auto* beforeChildOrPlaceholder = beforeChild;
     if (auto* containingFragmentedFlow = parent.enclosingFragmentedFlow())
-        beforeChildOrPlaceholder = containingFragmentedFlow->resolveMovedChild(beforeChild);
+        beforeChildOrPlaceholder = m_builder.resolveMovedChildForMultiColumnFlow(*containingFragmentedFlow, beforeChild);
     m_builder.insertChildToRenderBlock(parent, WTFMove(child), beforeChildOrPlaceholder);
 }
 
index 412d649..a3016d4 100644 (file)
@@ -106,7 +106,7 @@ void RenderTreeBuilder::Inline::insertChild(RenderInline& parent, RenderPtr<Rend
 {
     auto* beforeChildOrPlaceholder = beforeChild;
     if (auto* fragmentedFlow = parent.enclosingFragmentedFlow())
-        beforeChildOrPlaceholder = fragmentedFlow->resolveMovedChild(beforeChild);
+        beforeChildOrPlaceholder = m_builder.resolveMovedChildForMultiColumnFlow(*fragmentedFlow, beforeChild);
     if (parent.continuation()) {
         insertChildToContinuation(parent, WTFMove(child), beforeChildOrPlaceholder);
         return;
index 1e4fc81..52c2414 100644 (file)
@@ -139,4 +139,36 @@ void RenderTreeBuilder::MultiColumn::destroyFragmentedFlow(RenderBlockFlow& flow
         m_builder.insertChild(*parentAndSpanner.first, WTFMove(parentAndSpanner.second));
 }
 
+
+RenderObject* RenderTreeBuilder::MultiColumn::resolveMovedChild(RenderFragmentedFlow& enclosingFragmentedFlow, RenderObject* beforeChild)
+{
+    if (!beforeChild)
+        return nullptr;
+
+    if (!is<RenderBox>(*beforeChild))
+        return beforeChild;
+
+    if (!is<RenderMultiColumnFlow>(enclosingFragmentedFlow))
+        return beforeChild;
+
+    // We only need to resolve for column spanners.
+    if (beforeChild->style().columnSpan() != ColumnSpanAll)
+        return beforeChild;
+
+    // The renderer for the actual DOM node that establishes a spanner is moved from its original
+    // location in the render tree to becoming a sibling of the column sets. In other words, it's
+    // moved out from the flow thread (and becomes a sibling of it). When we for instance want to
+    // create and insert a renderer for the sibling node immediately preceding the spanner, we need
+    // to map that spanner renderer to the spanner's placeholder, which is where the new inserted
+    // renderer belongs.
+    if (auto* placeholder = downcast<RenderMultiColumnFlow>(enclosingFragmentedFlow).findColumnSpannerPlaceholder(downcast<RenderBox>(beforeChild)))
+        return placeholder;
+
+    // This is an invalid spanner, or its placeholder hasn't been created yet. This happens when
+    // moving an entire subtree into the flow thread, when we are processing the insertion of this
+    // spanner's preceding sibling, and we obviously haven't got as far as processing this spanner
+    // yet.
+    return beforeChild;
+}
+
 }
index c00f98b..6dd4508 100644 (file)
@@ -36,6 +36,10 @@ public:
     MultiColumn(RenderTreeBuilder&);
 
     void updateAfterDescendants(RenderBlockFlow&);
+    // Some renderers (column spanners) are moved out of the flow thread to live among column
+    // sets. If |child| is such a renderer, resolve it to the placeholder that lives at the original
+    // location in the tree.
+    RenderObject* resolveMovedChild(RenderFragmentedFlow& enclosingFragmentedFlow, RenderObject* beforeChild);
 
 private:
     void createFragmentedFlow(RenderBlockFlow&);