Title: [228429] trunk/Source/WebCore
Revision
228429
Author
za...@apple.com
Date
2018-02-13 12:36:41 -0800 (Tue, 13 Feb 2018)

Log Message

[RenderTreeBuilder] Move RenderSVG*::takeChild() to RenderTreeBuilder
https://bugs.webkit.org/show_bug.cgi?id=182736
<rdar://problem/37503107>

Reviewed by Antti Koivisto.

No change in functionality.

* rendering/svg/RenderSVGContainer.cpp:
(WebCore::RenderSVGContainer::takeChild): Deleted.
* rendering/svg/RenderSVGContainer.h:
* rendering/svg/RenderSVGInline.cpp:
(WebCore::RenderSVGInline::takeChild): Deleted.
* rendering/svg/RenderSVGInline.h:
* rendering/svg/RenderSVGRoot.cpp:
(WebCore::RenderSVGRoot::takeChild): Deleted.
* rendering/svg/RenderSVGRoot.h:
* rendering/svg/RenderSVGText.cpp:
(WebCore::RenderSVGText::takeChild): Deleted.
* rendering/svg/RenderSVGText.h:
* rendering/updating/RenderTreeBuilder.cpp:
(WebCore::RenderTreeBuilder::takeChild):
* rendering/updating/RenderTreeBuilderSVG.cpp:
(WebCore::RenderTreeBuilder::SVG::takeChild):
* rendering/updating/RenderTreeBuilderSVG.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (228428 => 228429)


--- trunk/Source/WebCore/ChangeLog	2018-02-13 19:52:46 UTC (rev 228428)
+++ trunk/Source/WebCore/ChangeLog	2018-02-13 20:36:41 UTC (rev 228429)
@@ -1,5 +1,33 @@
 2018-02-13  Zalan Bujtas  <za...@apple.com>
 
+        [RenderTreeBuilder] Move RenderSVG*::takeChild() to RenderTreeBuilder
+        https://bugs.webkit.org/show_bug.cgi?id=182736
+        <rdar://problem/37503107>
+
+        Reviewed by Antti Koivisto.
+
+        No change in functionality.
+
+        * rendering/svg/RenderSVGContainer.cpp:
+        (WebCore::RenderSVGContainer::takeChild): Deleted.
+        * rendering/svg/RenderSVGContainer.h:
+        * rendering/svg/RenderSVGInline.cpp:
+        (WebCore::RenderSVGInline::takeChild): Deleted.
+        * rendering/svg/RenderSVGInline.h:
+        * rendering/svg/RenderSVGRoot.cpp:
+        (WebCore::RenderSVGRoot::takeChild): Deleted.
+        * rendering/svg/RenderSVGRoot.h:
+        * rendering/svg/RenderSVGText.cpp:
+        (WebCore::RenderSVGText::takeChild): Deleted.
+        * rendering/svg/RenderSVGText.h:
+        * rendering/updating/RenderTreeBuilder.cpp:
+        (WebCore::RenderTreeBuilder::takeChild):
+        * rendering/updating/RenderTreeBuilderSVG.cpp:
+        (WebCore::RenderTreeBuilder::SVG::takeChild):
+        * rendering/updating/RenderTreeBuilderSVG.h:
+
+2018-02-13  Zalan Bujtas  <za...@apple.com>
+
         [RenderTreeBuilder] Move RenderGrid::takeChild() to RenderTreeBuilder
         https://bugs.webkit.org/show_bug.cgi?id=182734
         <rdar://problem/37500876>

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGContainer.cpp (228428 => 228429)


--- trunk/Source/WebCore/rendering/svg/RenderSVGContainer.cpp	2018-02-13 19:52:46 UTC (rev 228428)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGContainer.cpp	2018-02-13 20:36:41 UTC (rev 228429)
@@ -95,12 +95,6 @@
     builder.insertChildToSVGContainer(*this, WTFMove(newChild), beforeChild);
 }
 
-RenderPtr<RenderObject> RenderSVGContainer::takeChild(RenderTreeBuilder& builder, RenderObject& child)
-{
-    SVGResourcesCache::clientWillBeRemovedFromTree(child);
-    return RenderSVGModelObject::takeChild(builder, child);
-}
-
 bool RenderSVGContainer::selfWillPaint()
 {
     auto* resources = SVGResourcesCache::cachedResourcesForRenderer(*this);

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGContainer.h (228428 => 228429)


--- trunk/Source/WebCore/rendering/svg/RenderSVGContainer.h	2018-02-13 19:52:46 UTC (rev 228428)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGContainer.h	2018-02-13 20:36:41 UTC (rev 228429)
@@ -49,7 +49,6 @@
     void layout() override;
 
     void addChild(RenderTreeBuilder&, RenderPtr<RenderObject> child, RenderObject* beforeChild = 0) final;
-    RenderPtr<RenderObject> takeChild(RenderTreeBuilder&, RenderObject&) final;
     void addFocusRingRects(Vector<LayoutRect>&, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer = 0) final;
 
     FloatRect objectBoundingBox() const final { return m_objectBoundingBox; }

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGInline.cpp (228428 => 228429)


--- trunk/Source/WebCore/rendering/svg/RenderSVGInline.cpp	2018-02-13 19:52:46 UTC (rev 228428)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGInline.cpp	2018-02-13 20:36:41 UTC (rev 228429)
@@ -128,19 +128,4 @@
     builder.insertChildToSVGInline(*this, WTFMove(newChild), beforeChild);
 }
 
-RenderPtr<RenderObject> RenderSVGInline::takeChild(RenderTreeBuilder& builder, RenderObject& child)
-{
-    SVGResourcesCache::clientWillBeRemovedFromTree(child);
-
-    auto* textAncestor = RenderSVGText::locateRenderSVGTextAncestor(*this);
-    if (!textAncestor)
-        return RenderInline::takeChild(builder, child);
-
-    Vector<SVGTextLayoutAttributes*, 2> affectedAttributes;
-    textAncestor->subtreeChildWillBeRemoved(&child, affectedAttributes);
-    auto takenChild = RenderInline::takeChild(builder, child);
-    textAncestor->subtreeChildWasRemoved(affectedAttributes);
-    return takenChild;
 }
-
-}

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGInline.h (228428 => 228429)


--- trunk/Source/WebCore/rendering/svg/RenderSVGInline.h	2018-02-13 19:52:46 UTC (rev 228428)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGInline.h	2018-02-13 20:36:41 UTC (rev 228429)
@@ -62,7 +62,6 @@
     void styleDidChange(StyleDifference, const RenderStyle* oldStyle) final;
 
     void addChild(RenderTreeBuilder&, RenderPtr<RenderObject> child, RenderObject* beforeChild = nullptr) final;
-    RenderPtr<RenderObject> takeChild(RenderTreeBuilder&, RenderObject&) final;
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp (228428 => 228429)


--- trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp	2018-02-13 19:52:46 UTC (rev 228428)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp	2018-02-13 20:36:41 UTC (rev 228429)
@@ -308,12 +308,6 @@
     builder.insertChildToSVGRoot(*this, WTFMove(newChild), beforeChild);
 }
 
-RenderPtr<RenderObject> RenderSVGRoot::takeChild(RenderTreeBuilder& builder, RenderObject& child)
-{
-    SVGResourcesCache::clientWillBeRemovedFromTree(child);
-    return RenderReplaced::takeChild(builder, child);
-}
-
 // RenderBox methods will expect coordinates w/o any transforms in coordinates
 // relative to our borderBox origin.  This method gives us exactly that.
 void RenderSVGRoot::buildLocalToBorderBoxTransform()

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGRoot.h (228428 => 228429)


--- trunk/Source/WebCore/rendering/svg/RenderSVGRoot.h	2018-02-13 19:52:46 UTC (rev 228428)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGRoot.h	2018-02-13 20:36:41 UTC (rev 228429)
@@ -83,7 +83,6 @@
 
     void styleDidChange(StyleDifference, const RenderStyle* oldStyle) override;
     void addChild(RenderTreeBuilder&, RenderPtr<RenderObject> child, RenderObject* beforeChild = 0) override;
-    RenderPtr<RenderObject> takeChild(RenderTreeBuilder&, RenderObject&) override;
 
     const AffineTransform& localToParentTransform() const override;
 

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGText.cpp (228428 => 228429)


--- trunk/Source/WebCore/rendering/svg/RenderSVGText.cpp	2018-02-13 19:52:46 UTC (rev 228428)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGText.cpp	2018-02-13 20:36:41 UTC (rev 228429)
@@ -525,17 +525,6 @@
     builder.insertChildToSVGText(*this, WTFMove(newChild), beforeChild);
 }
 
-RenderPtr<RenderObject> RenderSVGText::takeChild(RenderTreeBuilder& builder, RenderObject& child)
-{
-    SVGResourcesCache::clientWillBeRemovedFromTree(child);
-
-    Vector<SVGTextLayoutAttributes*, 2> affectedAttributes;
-    subtreeChildWillBeRemoved(&child, affectedAttributes);
-    auto takenChild = RenderSVGBlock::takeChild(builder, child);
-    subtreeChildWasRemoved(affectedAttributes);
-    return takenChild;
-}
-
 // Fix for <rdar://problem/8048875>. We should not render :first-line CSS Style
 // in a SVG text element context.
 RenderBlock* RenderSVGText::firstLineBlock() const

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGText.h (228428 => 228429)


--- trunk/Source/WebCore/rendering/svg/RenderSVGText.h	2018-02-13 19:52:46 UTC (rev 228428)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGText.h	2018-02-13 20:36:41 UTC (rev 228429)
@@ -84,7 +84,6 @@
     void mapLocalToContainer(const RenderLayerModelObject* repaintContainer, TransformState&, MapCoordinatesFlags, bool* wasFixed) const override;
     const RenderObject* pushMappingToContainer(const RenderLayerModelObject* ancestorToStopAt, RenderGeometryMap&) const override;
     void addChild(RenderTreeBuilder&, RenderPtr<RenderObject> child, RenderObject* beforeChild = nullptr) override;
-    RenderPtr<RenderObject> takeChild(RenderTreeBuilder&, RenderObject&) override;
     void willBeDestroyed(RenderTreeBuilder&) override;
 
     const AffineTransform& localToParentTransform() const override { return m_localTransform; }

Modified: trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp (228428 => 228429)


--- trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp	2018-02-13 19:52:46 UTC (rev 228428)
+++ trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp	2018-02-13 20:36:41 UTC (rev 228429)
@@ -33,6 +33,9 @@
 #include "RenderRuby.h"
 #include "RenderRubyBase.h"
 #include "RenderRubyRun.h"
+#include "RenderSVGContainer.h"
+#include "RenderSVGInline.h"
+#include "RenderSVGRoot.h"
 #include "RenderTable.h"
 #include "RenderTableRow.h"
 #include "RenderTableSection.h"
@@ -209,6 +212,18 @@
     if (is<RenderGrid>(parent))
         return takeChildFromRenderGrid(downcast<RenderGrid>(parent), child);
 
+    if (is<RenderSVGText>(parent))
+        return svgBuilder().takeChild(downcast<RenderSVGText>(parent), child);
+
+    if (is<RenderSVGInline>(parent))
+        return svgBuilder().takeChild(downcast<RenderSVGInline>(parent), child);
+
+    if (is<RenderSVGContainer>(parent))
+        return svgBuilder().takeChild(downcast<RenderSVGContainer>(parent), child);
+
+    if (is<RenderSVGRoot>(parent))
+        return svgBuilder().takeChild(downcast<RenderSVGRoot>(parent), child);
+
     return parent.takeChild(*this, child);
 }
 

Modified: trunk/Source/WebCore/rendering/updating/RenderTreeBuilderSVG.cpp (228428 => 228429)


--- trunk/Source/WebCore/rendering/updating/RenderTreeBuilderSVG.cpp	2018-02-13 19:52:46 UTC (rev 228428)
+++ trunk/Source/WebCore/rendering/updating/RenderTreeBuilderSVG.cpp	2018-02-13 20:36:41 UTC (rev 228429)
@@ -72,4 +72,42 @@
     parent.subtreeChildWasAdded(&childToAdd);
 }
 
+RenderPtr<RenderObject> RenderTreeBuilder::SVG::takeChild(RenderSVGText& parent, RenderObject& child)
+{
+    SVGResourcesCache::clientWillBeRemovedFromTree(child);
+
+    Vector<SVGTextLayoutAttributes*, 2> affectedAttributes;
+    parent.subtreeChildWillBeRemoved(&child, affectedAttributes);
+    auto takenChild = parent.RenderBlockFlow::takeChild(m_builder, child);
+    parent.subtreeChildWasRemoved(affectedAttributes);
+    return takenChild;
 }
+
+RenderPtr<RenderObject> RenderTreeBuilder::SVG::takeChild(RenderSVGInline& parent, RenderObject& child)
+{
+    SVGResourcesCache::clientWillBeRemovedFromTree(child);
+
+    auto* textAncestor = RenderSVGText::locateRenderSVGTextAncestor(parent);
+    if (!textAncestor)
+        return parent.RenderElement::takeChild(m_builder, child);
+
+    Vector<SVGTextLayoutAttributes*, 2> affectedAttributes;
+    textAncestor->subtreeChildWillBeRemoved(&child, affectedAttributes);
+    auto takenChild = parent.RenderElement::takeChild(m_builder, child);
+    textAncestor->subtreeChildWasRemoved(affectedAttributes);
+    return takenChild;
+}
+
+RenderPtr<RenderObject> RenderTreeBuilder::SVG::takeChild(RenderSVGContainer& parent, RenderObject& child)
+{
+    SVGResourcesCache::clientWillBeRemovedFromTree(child);
+    return parent.RenderElement::takeChild(m_builder, child);
+}
+
+RenderPtr<RenderObject> RenderTreeBuilder::SVG::takeChild(RenderSVGRoot& parent, RenderObject& child)
+{
+    SVGResourcesCache::clientWillBeRemovedFromTree(child);
+    return parent.RenderElement::takeChild(m_builder, child);
+}
+
+}

Modified: trunk/Source/WebCore/rendering/updating/RenderTreeBuilderSVG.h (228428 => 228429)


--- trunk/Source/WebCore/rendering/updating/RenderTreeBuilderSVG.h	2018-02-13 19:52:46 UTC (rev 228428)
+++ trunk/Source/WebCore/rendering/updating/RenderTreeBuilderSVG.h	2018-02-13 20:36:41 UTC (rev 228429)
@@ -43,6 +43,11 @@
     void insertChild(RenderSVGRoot& parent, RenderPtr<RenderObject> child, RenderObject* beforeChild);
     void insertChild(RenderSVGText& parent, RenderPtr<RenderObject> child, RenderObject* beforeChild);
 
+    RenderPtr<RenderObject> takeChild(RenderSVGText& parent, RenderObject& child);
+    RenderPtr<RenderObject> takeChild(RenderSVGInline& parent, RenderObject& child);
+    RenderPtr<RenderObject> takeChild(RenderSVGContainer& parent, RenderObject& child);
+    RenderPtr<RenderObject> takeChild(RenderSVGRoot& parent, RenderObject& child);
+
 private:
     RenderTreeBuilder& m_builder;
 };
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to