[RenderTreeBuilder] Move RenderMenuList::takeChild() to RenderTreeBuilder
authorzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 13 Feb 2018 03:26:50 +0000 (03:26 +0000)
committerzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 13 Feb 2018 03:26:50 +0000 (03:26 +0000)
https://bugs.webkit.org/show_bug.cgi?id=182715
<rdar://problem/37477050>

Reviewed by Antti Koivisto.

No change in functionality.

* rendering/RenderMenuList.cpp:
(RenderMenuList::takeChild): Deleted.
* rendering/RenderMenuList.h:
* rendering/updating/RenderTreeBuilder.cpp:
(WebCore::RenderTreeBuilder::takeChild):
(WebCore::RenderTreeBuilder::takeChildFromRenderMenuList):
* rendering/updating/RenderTreeBuilder.h:

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

Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderMenuList.cpp
Source/WebCore/rendering/RenderMenuList.h
Source/WebCore/rendering/updating/RenderTreeBuilder.cpp
Source/WebCore/rendering/updating/RenderTreeBuilder.h

index 0a596f1..26c6658 100644 (file)
@@ -1,3 +1,21 @@
+2018-02-12  Zalan Bujtas  <zalan@apple.com>
+
+        [RenderTreeBuilder] Move RenderMenuList::takeChild() to RenderTreeBuilder
+        https://bugs.webkit.org/show_bug.cgi?id=182715
+        <rdar://problem/37477050>
+
+        Reviewed by Antti Koivisto.
+
+        No change in functionality.
+
+        * rendering/RenderMenuList.cpp:
+        (RenderMenuList::takeChild): Deleted.
+        * rendering/RenderMenuList.h:
+        * rendering/updating/RenderTreeBuilder.cpp:
+        (WebCore::RenderTreeBuilder::takeChild):
+        (WebCore::RenderTreeBuilder::takeChildFromRenderMenuList):
+        * rendering/updating/RenderTreeBuilder.h:
+
 2018-02-12  Ross Kirsling  <ross.kirsling@sony.com>
 
         Unify UserAgent into WebCore/platform.
index c6008ba..5c31f49 100644 (file)
@@ -172,13 +172,6 @@ void RenderMenuList::addChild(RenderTreeBuilder&, RenderPtr<RenderObject> child,
         cache->childrenChanged(this, child.get());
 }
 
-RenderPtr<RenderObject> RenderMenuList::takeChild(RenderTreeBuilder& builder, RenderObject& oldChild)
-{
-    if (!m_innerBlock || &oldChild == m_innerBlock)
-        return RenderFlexibleBox::takeChild(builder, oldChild);
-    return builder.takeChild(*m_innerBlock, oldChild);
-}
-
 void RenderMenuList::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)
 {
     RenderBlock::styleDidChange(diff, oldStyle);
index 66feb72..5ff4092 100644 (file)
@@ -70,7 +70,6 @@ private:
     bool isMenuList() const override { return true; }
 
     void addChild(RenderTreeBuilder&, RenderPtr<RenderObject> newChild, RenderObject* beforeChild = 0) override;
-    RenderPtr<RenderObject> takeChild(RenderTreeBuilder&, RenderObject&) override;
     bool createsAnonymousWrapper() const override { return true; }
 
     void updateFromElement() override;
index e2c995c..e65176f 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "RenderButton.h"
 #include "RenderElement.h"
+#include "RenderMenuList.h"
 #include "RenderRuby.h"
 #include "RenderRubyBase.h"
 #include "RenderRubyRun.h"
@@ -198,6 +199,9 @@ RenderPtr<RenderObject> RenderTreeBuilder::takeChild(RenderElement& parent, Rend
     if (is<RenderRubyRun>(parent))
         return rubyBuilder().takeChild(downcast<RenderRubyRun>(parent), child);
 
+    if (is<RenderMenuList>(parent))
+        return takeChildFromRenderMenuList(downcast<RenderMenuList>(parent), child);
+
     return parent.takeChild(*this, child);
 }
 
@@ -510,4 +514,12 @@ RenderObject* RenderTreeBuilder::resolveMovedChildForMultiColumnFlow(RenderFragm
     return multiColumnBuilder().resolveMovedChild(enclosingFragmentedFlow, beforeChild);
 }
 
+RenderPtr<RenderObject> RenderTreeBuilder::takeChildFromRenderMenuList(RenderMenuList& parent, RenderObject& child)
+{
+    auto* innerRenderer = parent.innerRenderer();
+    if (!innerRenderer || &child == innerRenderer)
+        return parent.RenderBlock::takeChild(*this, child);
+    return takeChild(*innerRenderer, child);
+}
+
 }
index a456078..d3a4963 100644 (file)
@@ -30,6 +30,7 @@
 namespace WebCore {
 
 class RenderMathMLFenced;
+class RenderMenuList;
 class RenderRubyAsBlock;
 class RenderRubyAsInline;
 class RenderRubyBase;
@@ -103,6 +104,7 @@ private:
     class MathML;
 
     void removeAnonymousWrappersForInlineChildrenIfNeeded(RenderElement& parent);
+    RenderPtr<RenderObject> takeChildFromRenderMenuList(RenderMenuList& parent, RenderObject& child);
 
     FirstLetter& firstLetterBuilder() { return *m_firstLetterBuilder; }
     List& listBuilder() { return *m_listBuilder; }