[RenderTreeBuilder] Move RenderBlock/RenderInline::addChildIgnoringContinuation(...
authorzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 16 Feb 2018 21:42:39 +0000 (21:42 +0000)
committerzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 16 Feb 2018 21:42:39 +0000 (21:42 +0000)
https://bugs.webkit.org/show_bug.cgi?id=182876
<rdar://problem/37607604>

Reviewed by Antti Koivisto.

No change in functionality.

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::addChildIgnoringContinuation): Deleted.
* rendering/RenderBlock.h:
* rendering/RenderElement.cpp:
(WebCore::RenderElement::addChildIgnoringContinuation): Deleted.
* rendering/RenderElement.h:
* rendering/RenderInline.cpp:
(WebCore::RenderInline::addChildIgnoringContinuation): Deleted.
* rendering/RenderInline.h:
* rendering/updating/RenderTreeBuilder.cpp:
(WebCore::RenderTreeBuilder::insertChildIgnoringContinuation):
(WebCore::RenderTreeBuilder::insertChildToRenderBlockIgnoringContinuation): Deleted.
(WebCore::RenderTreeBuilder::insertChildToRenderInlineIgnoringContinuation): Deleted.
* rendering/updating/RenderTreeBuilder.h:
* rendering/updating/RenderTreeBuilderBlock.cpp:
(WebCore::RenderTreeBuilder::Block::insertChildToContinuation):
* rendering/updating/RenderTreeBuilderInline.cpp:
(WebCore::RenderTreeBuilder::Inline::insertChildToContinuation):
(WebCore::RenderTreeBuilder::Inline::splitInlines):

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

Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderBlock.cpp
Source/WebCore/rendering/RenderBlock.h
Source/WebCore/rendering/RenderElement.cpp
Source/WebCore/rendering/RenderElement.h
Source/WebCore/rendering/RenderInline.cpp
Source/WebCore/rendering/RenderInline.h
Source/WebCore/rendering/updating/RenderTreeBuilder.cpp
Source/WebCore/rendering/updating/RenderTreeBuilder.h
Source/WebCore/rendering/updating/RenderTreeBuilderBlock.cpp
Source/WebCore/rendering/updating/RenderTreeBuilderInline.cpp

index 10029ea..8b13635 100644 (file)
@@ -1,3 +1,33 @@
+2018-02-16  Zalan Bujtas  <zalan@apple.com>
+
+        [RenderTreeBuilder] Move RenderBlock/RenderInline::addChildIgnoringContinuation() to RenderTreeBuilder
+        https://bugs.webkit.org/show_bug.cgi?id=182876
+        <rdar://problem/37607604>
+
+        Reviewed by Antti Koivisto.
+
+        No change in functionality.
+
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::addChildIgnoringContinuation): Deleted.
+        * rendering/RenderBlock.h:
+        * rendering/RenderElement.cpp:
+        (WebCore::RenderElement::addChildIgnoringContinuation): Deleted.
+        * rendering/RenderElement.h:
+        * rendering/RenderInline.cpp:
+        (WebCore::RenderInline::addChildIgnoringContinuation): Deleted.
+        * rendering/RenderInline.h:
+        * rendering/updating/RenderTreeBuilder.cpp:
+        (WebCore::RenderTreeBuilder::insertChildIgnoringContinuation):
+        (WebCore::RenderTreeBuilder::insertChildToRenderBlockIgnoringContinuation): Deleted.
+        (WebCore::RenderTreeBuilder::insertChildToRenderInlineIgnoringContinuation): Deleted.
+        * rendering/updating/RenderTreeBuilder.h:
+        * rendering/updating/RenderTreeBuilderBlock.cpp:
+        (WebCore::RenderTreeBuilder::Block::insertChildToContinuation):
+        * rendering/updating/RenderTreeBuilderInline.cpp:
+        (WebCore::RenderTreeBuilder::Inline::insertChildToContinuation):
+        (WebCore::RenderTreeBuilder::Inline::splitInlines):
+
 2018-02-16  Basuke Suzuki  <Basuke.Suzuki@sony.com>
 
         [Curl] Unify logic of ResourceHandleCurlDelegate into ResourceHandle
index 0095476..1b3b469 100644 (file)
@@ -466,11 +466,6 @@ RenderPtr<RenderBlock> RenderBlock::clone() const
     return cloneBlock;
 }
 
-void RenderBlock::addChildIgnoringContinuation(RenderTreeBuilder& builder, RenderPtr<RenderObject> newChild, RenderObject* beforeChild)
-{
-    builder.insertChildToRenderBlockIgnoringContinuation(*this, WTFMove(newChild), beforeChild);
-}
-
 void RenderBlock::deleteLines()
 {
     if (AXObjectCache* cache = document().existingAXObjectCache())
index 5332937..7de1d99 100644 (file)
@@ -391,7 +391,6 @@ public:
     
     void adjustBorderBoxRectForPainting(LayoutRect&) override;
     LayoutRect paintRectToClipOutFromBorder(const LayoutRect&) override;
-    void addChildIgnoringContinuation(RenderTreeBuilder&, RenderPtr<RenderObject> newChild, RenderObject* beforeChild) override;
     bool isInlineBlockOrInlineTable() const final { return isInline() && isReplaced(); }
     // FIXME-BLOCKFLOW: Remove virtualizaion when all callers have moved to RenderBlockFlow
     virtual void moveAllChildrenIncludingFloatsTo(RenderTreeBuilder& builder, RenderBlock& toBlock, RenderBoxModelObject::NormalizeAfterInsertion normalizeAfterInsertion) { moveAllChildrenTo(builder, &toBlock, normalizeAfterInsertion); }
index b4d0114..1021008 100644 (file)
@@ -473,11 +473,6 @@ void RenderElement::didInsertChild(RenderObject& child, RenderObject*)
     SVGRenderSupport::childAdded(*this, child);
 }
 
-void RenderElement::addChildIgnoringContinuation(RenderTreeBuilder& builder, RenderPtr<RenderObject> newChild, RenderObject* beforeChild)
-{
-    builder.insertChild(*this, WTFMove(newChild), beforeChild);
-}
-
 void RenderElement::removeAndDestroyChild(RenderTreeBuilder& builder, RenderObject& oldChild)
 {
     if (is<RenderElement>(oldChild)) {
index 0c3335d..11a96f4 100644 (file)
@@ -87,7 +87,6 @@ public:
     bool isRenderInline() const;
 
     virtual bool isChildAllowed(const RenderObject&, const RenderStyle&) const { return true; }
-    virtual void addChildIgnoringContinuation(RenderTreeBuilder&, RenderPtr<RenderObject> newChild, RenderObject* beforeChild = nullptr);
     void removeAndDestroyChild(RenderTreeBuilder&, RenderObject&);
     void didInsertChild(RenderObject& child, RenderObject* beforeChild);
 
index a4a152e..254a8e8 100644 (file)
@@ -255,11 +255,6 @@ LayoutRect RenderInline::localCaretRect(InlineBox* inlineBox, unsigned, LayoutUn
     return caretRect;
 }
 
-void RenderInline::addChildIgnoringContinuation(RenderTreeBuilder& builder, RenderPtr<RenderObject> newChild, RenderObject* beforeChild)
-{
-    builder.insertChildToRenderInlineIgnoringContinuation(*this, WTFMove(newChild), beforeChild);
-}
-
 void RenderInline::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
 {
     m_lineBoxes.paint(this, paintInfo, paintOffset);
index 58db963..a332340 100644 (file)
@@ -92,8 +92,6 @@ public:
 
     bool hitTestCulledInline(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset);
 
-    void addChildIgnoringContinuation(RenderTreeBuilder&, RenderPtr<RenderObject> newChild, RenderObject* beforeChild = nullptr) final;
-
 protected:
     void willBeDestroyed(RenderTreeBuilder&) override;
 
index adb4d77..329a8ea 100644 (file)
@@ -258,6 +258,21 @@ void RenderTreeBuilder::insertChild(RenderElement& parent, RenderPtr<RenderObjec
     insertChildToRenderElement(parent, WTFMove(child), beforeChild);
 }
 
+void RenderTreeBuilder::insertChildIgnoringContinuation(RenderElement& parent, RenderPtr<RenderObject> child, RenderObject* beforeChild)
+{
+    if (is<RenderInline>(parent)) {
+        inlineBuilder().insertChildIgnoringContinuation(downcast<RenderInline>(parent), WTFMove(child), beforeChild);
+        return;
+    }
+
+    if (is<RenderBlock>(parent)) {
+        blockBuilder().insertChildIgnoringContinuation(downcast<RenderBlock>(parent), WTFMove(child), beforeChild);
+        return;
+    }
+
+    insertChild(parent, WTFMove(child), beforeChild);
+}
+
 RenderPtr<RenderObject> RenderTreeBuilder::takeChild(RenderElement& parent, RenderObject& child)
 {
     if (is<RenderRubyAsInline>(parent))
@@ -325,11 +340,6 @@ void RenderTreeBuilder::insertChildToRenderElement(RenderElement& parent, Render
     parent.didInsertChild(newChild, beforeChild);
 }
 
-void RenderTreeBuilder::insertChildToRenderBlockIgnoringContinuation(RenderBlock& parent, RenderPtr<RenderObject> child, RenderObject* beforeChild)
-{
-    blockBuilder().insertChildIgnoringContinuation(parent, WTFMove(child), beforeChild);
-}
-
 void RenderTreeBuilder::makeChildrenNonInline(RenderBlock& parent, RenderObject* insertionPoint)
 {
     // makeChildrenNonInline takes a block whose children are *all* inline and it
@@ -515,11 +525,6 @@ void RenderTreeBuilder::removeFromParentAndDestroyCleaningUpAnonymousWrappers(Re
     // WARNING: child is deleted here.
 }
 
-void RenderTreeBuilder::insertChildToRenderInlineIgnoringContinuation(RenderInline& parent, RenderPtr<RenderObject> child, RenderObject* beforeChild)
-{
-    inlineBuilder().insertChildIgnoringContinuation(parent, WTFMove(child), beforeChild);
-}
-
 void RenderTreeBuilder::updateAfterDescendants(RenderElement& renderer)
 {
     if (is<RenderBlock>(renderer))
index 517b21e..ec53d79 100644 (file)
@@ -51,8 +51,9 @@ public:
     RenderTreeBuilder(RenderView&);
     ~RenderTreeBuilder();
 
-    void insertChild(RenderElement& parent, RenderPtr<RenderObject>, RenderObject* beforeChild = nullptr);
     void insertChild(RenderTreePosition&, RenderPtr<RenderObject>);
+    void insertChild(RenderElement& parent, RenderPtr<RenderObject>, RenderObject* beforeChild = nullptr);
+    void insertChildIgnoringContinuation(RenderElement& parent, RenderPtr<RenderObject>, RenderObject* beforeChild = nullptr);
 
     RenderPtr<RenderObject> takeChild(RenderElement&, RenderObject&) WARN_UNUSED_RETURN;
 
@@ -63,9 +64,6 @@ public:
     static RenderTreeBuilder* current() { return s_current; }
 
     // These functions are temporary until after all block/inline/continuation code is moved over.
-    void insertChildToRenderBlockIgnoringContinuation(RenderBlock& parent, RenderPtr<RenderObject>, RenderObject* beforeChild = nullptr);
-    void insertChildToRenderInlineIgnoringContinuation(RenderInline& parent, RenderPtr<RenderObject>, RenderObject* beforeChild = nullptr);
-
     RenderPtr<RenderObject> takeChildFromRenderElement(RenderElement& parent, RenderObject& child) WARN_UNUSED_RETURN;
 
     void childFlowStateChangesAndAffectsParentBlock(RenderElement& child);
index 2878732..d1ec942 100644 (file)
@@ -124,7 +124,7 @@ void RenderTreeBuilder::Block::insertChildToContinuation(RenderBlock& parent, Re
     }
 
     if (child->isFloatingOrOutOfFlowPositioned()) {
-        beforeChildParent->addChildIgnoringContinuation(m_builder, WTFMove(child), beforeChild);
+        m_builder.insertChildIgnoringContinuation(*beforeChildParent, WTFMove(child), beforeChild);
         return;
     }
 
@@ -133,21 +133,21 @@ void RenderTreeBuilder::Block::insertChildToContinuation(RenderBlock& parent, Re
     bool flowIsNormal = flow->isInline() || !flow->style().columnSpan();
 
     if (flow == beforeChildParent) {
-        flow->addChildIgnoringContinuation(m_builder, WTFMove(child), beforeChild);
+        m_builder.insertChildIgnoringContinuation(*flow, WTFMove(child), beforeChild);
         return;
     }
 
     // The goal here is to match up if we can, so that we can coalesce and create the
     // minimal # of continuations needed for the inline.
     if (childIsNormal == bcpIsNormal) {
-        beforeChildParent->addChildIgnoringContinuation(m_builder, WTFMove(child), beforeChild);
+        m_builder.insertChildIgnoringContinuation(*beforeChildParent, WTFMove(child), beforeChild);
         return;
     }
     if (flowIsNormal == childIsNormal) {
-        flow->addChildIgnoringContinuation(m_builder, WTFMove(child), nullptr); // Just treat like an append.
+        m_builder.insertChildIgnoringContinuation(*flow, WTFMove(child)); // Just treat like an append.
         return;
     }
-    beforeChildParent->addChildIgnoringContinuation(m_builder, WTFMove(child), beforeChild);
+    m_builder.insertChildIgnoringContinuation(*beforeChildParent, WTFMove(child), beforeChild);
 }
 
 void RenderTreeBuilder::Block::insertChildIgnoringContinuation(RenderBlock& parent, RenderPtr<RenderObject> child, RenderObject* beforeChild)
index be55ac1..61346ad 100644 (file)
@@ -139,20 +139,20 @@ void RenderTreeBuilder::Inline::insertChildToContinuation(RenderInline& parent,
         ASSERT_NOT_REACHED();
 
     if (child->isFloatingOrOutOfFlowPositioned())
-        return beforeChildAncestor->addChildIgnoringContinuation(m_builder, WTFMove(child), beforeChild);
+        return m_builder.insertChildIgnoringContinuation(*beforeChildAncestor, WTFMove(child), beforeChild);
 
     if (flow == beforeChildAncestor)
-        return flow->addChildIgnoringContinuation(m_builder, WTFMove(child), beforeChild);
+        return m_builder.insertChildIgnoringContinuation(*flow, WTFMove(child), beforeChild);
     // A continuation always consists of two potential candidates: an inline or an anonymous
     // block box holding block children.
     bool childInline = newChildIsInline(parent, *child);
     // The goal here is to match up if we can, so that we can coalesce and create the
     // minimal # of continuations needed for the inline.
     if (childInline == beforeChildAncestor->isInline())
-        return beforeChildAncestor->addChildIgnoringContinuation(m_builder, WTFMove(child), beforeChild);
+        return m_builder.insertChildIgnoringContinuation(*beforeChildAncestor, WTFMove(child), beforeChild);
     if (flow->isInline() == childInline)
-        return flow->addChildIgnoringContinuation(m_builder, WTFMove(child)); // Just treat like an append.
-    return beforeChildAncestor->addChildIgnoringContinuation(m_builder, WTFMove(child), beforeChild);
+        return m_builder.insertChildIgnoringContinuation(*flow, WTFMove(child)); // Just treat like an append.
+    return m_builder.insertChildIgnoringContinuation(*beforeChildAncestor, WTFMove(child), beforeChild);
 }
 
 void RenderTreeBuilder::Inline::insertChildIgnoringContinuation(RenderInline& parent, RenderPtr<RenderObject> child, RenderObject* beforeChild)
@@ -306,7 +306,7 @@ void RenderTreeBuilder::Inline::splitInlines(RenderInline& parent, RenderBlock*
             // every time, which is a bit wasteful.
         }
         auto childToMove = m_builder.takeChildFromRenderElement(*rendererToMove->parent(), *rendererToMove);
-        cloneInline->addChildIgnoringContinuation(m_builder, WTFMove(childToMove));
+        m_builder.insertChildIgnoringContinuation(*cloneInline, WTFMove(childToMove));
         rendererToMove->setNeedsLayoutAndPrefWidthsRecalc();
         rendererToMove = nextSibling;
     }
@@ -334,7 +334,7 @@ void RenderTreeBuilder::Inline::splitInlines(RenderInline& parent, RenderBlock*
             cloneInline = cloneAsContinuation(downcast<RenderInline>(*current));
 
             // Insert our child clone as the first child.
-            cloneInline->addChildIgnoringContinuation(m_builder, WTFMove(cloneChild));
+            m_builder.insertChildIgnoringContinuation(*cloneInline, WTFMove(cloneChild));
 
             // Hook the clone up as a continuation of |curr|.
             cloneInline->insertIntoContinuationChainAfter(*current);
@@ -344,7 +344,7 @@ void RenderTreeBuilder::Inline::splitInlines(RenderInline& parent, RenderBlock*
             for (auto* sibling = currentChild->nextSibling(); sibling;) {
                 auto* next = sibling->nextSibling();
                 auto childToMove = m_builder.takeChildFromRenderElement(*current, *sibling);
-                cloneInline->addChildIgnoringContinuation(m_builder, WTFMove(childToMove));
+                m_builder.insertChildIgnoringContinuation(*cloneInline, WTFMove(childToMove));
                 sibling->setNeedsLayoutAndPrefWidthsRecalc();
                 sibling = next;
             }