[RenderTreeBuilder] Move RenderMathMLFenced::addChild() to RenderTreeBuilder
authorzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 15 Feb 2018 03:41:57 +0000 (03:41 +0000)
committerzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 15 Feb 2018 03:41:57 +0000 (03:41 +0000)
https://bugs.webkit.org/show_bug.cgi?id=182817
<rdar://problem/37556761>

Reviewed by Antti Koivisto.

No change in functionality.

* rendering/mathml/RenderMathMLFenced.cpp:
(WebCore::RenderMathMLFenced::addChild): Deleted.
* rendering/mathml/RenderMathMLFenced.h:
* rendering/updating/RenderTreeBuilder.cpp:
(WebCore::RenderTreeBuilder::insertChild):
(WebCore::RenderTreeBuilder::insertChildToRenderMathMLFenced): Deleted.
* rendering/updating/RenderTreeBuilder.h:
* rendering/updating/RenderTreeBuilderMathML.cpp:
(WebCore::RenderTreeBuilder::MathML::insertChild):

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

Source/WebCore/ChangeLog
Source/WebCore/rendering/mathml/RenderMathMLFenced.cpp
Source/WebCore/rendering/mathml/RenderMathMLFenced.h
Source/WebCore/rendering/updating/RenderTreeBuilder.cpp
Source/WebCore/rendering/updating/RenderTreeBuilder.h
Source/WebCore/rendering/updating/RenderTreeBuilderMathML.cpp

index 04829b5..c49c382 100644 (file)
@@ -1,3 +1,23 @@
+2018-02-14  Zalan Bujtas  <zalan@apple.com>
+
+        [RenderTreeBuilder] Move RenderMathMLFenced::addChild() to RenderTreeBuilder
+        https://bugs.webkit.org/show_bug.cgi?id=182817
+        <rdar://problem/37556761>
+
+        Reviewed by Antti Koivisto.
+
+        No change in functionality.
+
+        * rendering/mathml/RenderMathMLFenced.cpp:
+        (WebCore::RenderMathMLFenced::addChild): Deleted.
+        * rendering/mathml/RenderMathMLFenced.h:
+        * rendering/updating/RenderTreeBuilder.cpp:
+        (WebCore::RenderTreeBuilder::insertChild):
+        (WebCore::RenderTreeBuilder::insertChildToRenderMathMLFenced): Deleted.
+        * rendering/updating/RenderTreeBuilder.h:
+        * rendering/updating/RenderTreeBuilderMathML.cpp:
+        (WebCore::RenderTreeBuilder::MathML::insertChild):
+
 2018-02-14  Antti Koivisto  <antti@apple.com>
 
         Do sibling invalidation on mutation
index 77b72b6..89bb040 100644 (file)
@@ -85,14 +85,6 @@ void RenderMathMLFenced::updateFromElement()
     }
 }
 
-void RenderMathMLFenced::addChild(RenderTreeBuilder& builder, RenderPtr<RenderObject> child, RenderObject* beforeChild)
-{
-    // make the fences if the render object is empty
-    if (!firstChild())
-        updateFromElement();
-    builder.insertChildToRenderMathMLFenced(*this, WTFMove(child), beforeChild);
-}
-
 }
 
 #endif
index 9f5a55c..a0b887f 100644 (file)
@@ -46,11 +46,11 @@ public:
     RenderMathMLFencedOperator* closeFenceRenderer() const { return m_closeFenceRenderer.get(); }
     void setCloseFenceRenderer(RenderMathMLFencedOperator& renderer) { m_closeFenceRenderer = makeWeakPtr(renderer); }
 
+    void updateFromElement();
+
 private:
     bool isRenderMathMLFenced() const final { return true; }
     const char* renderName() const final { return "RenderMathMLFenced"; }
-    void addChild(RenderTreeBuilder&, RenderPtr<RenderObject> child, RenderObject* beforeChild) final;
-    void updateFromElement();
 
     String m_open;
     String m_close;
@@ -61,4 +61,6 @@ private:
 
 }
 
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderMathMLFenced, isRenderMathMLFenced())
+
 #endif // ENABLE(MATHML)
index a47bd82..6c2c084 100644 (file)
@@ -34,6 +34,7 @@
 #include "RenderElement.h"
 #include "RenderGrid.h"
 #include "RenderLineBreak.h"
+#include "RenderMathMLFenced.h"
 #include "RenderMenuList.h"
 #include "RenderRuby.h"
 #include "RenderRubyBase.h"
@@ -214,6 +215,11 @@ void RenderTreeBuilder::insertChild(RenderElement& parent, RenderPtr<RenderObjec
         return;
     }
 
+    if (is<RenderMathMLFenced>(parent)) {
+        mathMLBuilder().insertChild(downcast<RenderMathMLFenced>(parent), WTFMove(child), beforeChild);
+        return;
+    }
+
     parent.addChild(*this, WTFMove(child), beforeChild);
 }
 
@@ -507,11 +513,6 @@ void RenderTreeBuilder::insertChildToRenderBlockFlow(RenderBlockFlow& parent, Re
     blockFlowBuilder().insertChild(parent, WTFMove(child), beforeChild);
 }
 
-void RenderTreeBuilder::insertChildToRenderMathMLFenced(RenderMathMLFenced& parent, RenderPtr<RenderObject> child, RenderObject* beforeChild)
-{
-    mathMLBuilder().insertChild(parent, WTFMove(child), beforeChild);
-}
-
 void RenderTreeBuilder::updateAfterDescendants(RenderElement& renderer)
 {
     if (is<RenderBlock>(renderer))
index e096281..96e63b0 100644 (file)
@@ -72,7 +72,6 @@ public:
     void insertChildToRenderTable(RenderTable& parent, RenderPtr<RenderObject> child, RenderObject* beforeChild = nullptr);
     void insertChildToRenderTableSection(RenderTableSection& parent, RenderPtr<RenderObject> child, RenderObject* beforeChild = nullptr);
     void insertChildToRenderTableRow(RenderTableRow& parent, RenderPtr<RenderObject> child, RenderObject* beforeChild = nullptr);
-    void insertChildToRenderMathMLFenced(RenderMathMLFenced& parent, RenderPtr<RenderObject> child, RenderObject* beforeChild = nullptr);
 
     RenderPtr<RenderObject> takeChildFromRenderElement(RenderElement& parent, RenderObject& child) WARN_UNUSED_RETURN;
 
index 15c2a18..547bf74 100644 (file)
@@ -56,8 +56,11 @@ void RenderTreeBuilder::MathML::makeFences(RenderMathMLFenced& parent)
 
 void RenderTreeBuilder::MathML::insertChild(RenderMathMLFenced& parent, RenderPtr<RenderObject> child, RenderObject* beforeChild)
 {
-    if (!parent.firstChild())
+    // make the fences if the render object is empty
+    if (!parent.firstChild()) {
+        parent.updateFromElement();
         makeFences(parent);
+    }
     // FIXME: Adding or removing a child should possibly cause all later separators to shift places
     // if they're different, as later child positions change by +1 or -1.
     // This should also handle surrogate pairs. See https://bugs.webkit.org/show_bug.cgi?id=125938.