Title: [228701] trunk/Source/WebCore
Revision
228701
Author
za...@apple.com
Date
2018-02-19 11:03:37 -0800 (Mon, 19 Feb 2018)

Log Message

[RenderTreeBuilder] Remove redundant RenderObject::removeFromParentAndDestroy
https://bugs.webkit.org/show_bug.cgi?id=182926
<rdar://problem/37674997>

Reviewed by Antti Koivisto.

Call RenderTreeBuilder::removeAndDestroyChild() directly instead.

No change in functionality.

* dom/Document.cpp:
(WebCore::Document::setFullScreenRenderer):
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::removeAndDestroyAllContinuations):
* rendering/RenderButton.cpp:
(WebCore::RenderButton::setText):
* rendering/RenderFullScreen.cpp:
(WebCore::RenderFullScreen::willBeDestroyed):
(WebCore::RenderFullScreen::unwrapRenderer):
* rendering/RenderListItem.cpp:
(WebCore::RenderListItem::willBeDestroyed):
* rendering/RenderObject.cpp:
(WebCore::RenderObject::removeFromParentAndDestroy): Deleted.
* rendering/RenderObject.h:
* rendering/RenderTextFragment.cpp:
(WebCore::RenderTextFragment::willBeDestroyed):
(WebCore::RenderTextFragment::setText):
* rendering/updating/RenderTreeBuilder.cpp:
(WebCore::RenderTreeBuilder::removeFromParentAndDestroyCleaningUpAnonymousWrappers):
* rendering/updating/RenderTreeBuilderBlock.cpp:
(WebCore::RenderTreeBuilder::Block::takeChild):
* rendering/updating/RenderTreeBuilderList.cpp:
(WebCore::RenderTreeBuilder::List::updateItemMarker):
* rendering/updating/RenderTreeBuilderMultiColumn.cpp:
(WebCore::RenderTreeBuilder::MultiColumn::destroyFragmentedFlow):
(WebCore::RenderTreeBuilder::MultiColumn::handleSpannerRemoval):
* rendering/updating/RenderTreeBuilderRuby.cpp:
(WebCore::RenderTreeBuilder::Ruby::moveBlockChildren):
(WebCore::RenderTreeBuilder::Ruby::takeChild):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (228700 => 228701)


--- trunk/Source/WebCore/ChangeLog	2018-02-19 18:55:34 UTC (rev 228700)
+++ trunk/Source/WebCore/ChangeLog	2018-02-19 19:03:37 UTC (rev 228701)
@@ -1,3 +1,45 @@
+2018-02-19  Zalan Bujtas  <za...@apple.com>
+
+        [RenderTreeBuilder] Remove redundant RenderObject::removeFromParentAndDestroy
+        https://bugs.webkit.org/show_bug.cgi?id=182926
+        <rdar://problem/37674997>
+
+        Reviewed by Antti Koivisto.
+
+        Call RenderTreeBuilder::removeAndDestroyChild() directly instead. 
+
+        No change in functionality.
+
+        * dom/Document.cpp:
+        (WebCore::Document::setFullScreenRenderer):
+        * rendering/RenderBoxModelObject.cpp:
+        (WebCore::RenderBoxModelObject::removeAndDestroyAllContinuations):
+        * rendering/RenderButton.cpp:
+        (WebCore::RenderButton::setText):
+        * rendering/RenderFullScreen.cpp:
+        (WebCore::RenderFullScreen::willBeDestroyed):
+        (WebCore::RenderFullScreen::unwrapRenderer):
+        * rendering/RenderListItem.cpp:
+        (WebCore::RenderListItem::willBeDestroyed):
+        * rendering/RenderObject.cpp:
+        (WebCore::RenderObject::removeFromParentAndDestroy): Deleted.
+        * rendering/RenderObject.h:
+        * rendering/RenderTextFragment.cpp:
+        (WebCore::RenderTextFragment::willBeDestroyed):
+        (WebCore::RenderTextFragment::setText):
+        * rendering/updating/RenderTreeBuilder.cpp:
+        (WebCore::RenderTreeBuilder::removeFromParentAndDestroyCleaningUpAnonymousWrappers):
+        * rendering/updating/RenderTreeBuilderBlock.cpp:
+        (WebCore::RenderTreeBuilder::Block::takeChild):
+        * rendering/updating/RenderTreeBuilderList.cpp:
+        (WebCore::RenderTreeBuilder::List::updateItemMarker):
+        * rendering/updating/RenderTreeBuilderMultiColumn.cpp:
+        (WebCore::RenderTreeBuilder::MultiColumn::destroyFragmentedFlow):
+        (WebCore::RenderTreeBuilder::MultiColumn::handleSpannerRemoval):
+        * rendering/updating/RenderTreeBuilderRuby.cpp:
+        (WebCore::RenderTreeBuilder::Ruby::moveBlockChildren):
+        (WebCore::RenderTreeBuilder::Ruby::takeChild):
+
 2018-02-19  Tim Horton  <timothy_hor...@apple.com>
 
         Increase text autosizing constants for extra zoom mode

Modified: trunk/Source/WebCore/dom/Document.cpp (228700 => 228701)


--- trunk/Source/WebCore/dom/Document.cpp	2018-02-19 18:55:34 UTC (rev 228700)
+++ trunk/Source/WebCore/dom/Document.cpp	2018-02-19 19:03:37 UTC (rev 228701)
@@ -6315,7 +6315,7 @@
     }
 
     if (m_fullScreenRenderer)
-        m_fullScreenRenderer->removeFromParentAndDestroy(builder);
+        builder.removeAndDestroyChild(*m_fullScreenRenderer);
     ASSERT(!m_fullScreenRenderer);
 
     m_fullScreenRenderer = makeWeakPtr(renderer);

Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp (228700 => 228701)


--- trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp	2018-02-19 18:55:34 UTC (rev 228700)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp	2018-02-19 19:03:37 UTC (rev 228701)
@@ -2558,7 +2558,7 @@
     ASSERT(continuationChainNodeMap().contains(this));
     auto& continuationChainNode = *continuationChainNodeMap().get(this);
     while (continuationChainNode.next)
-        continuationChainNode.next->renderer->removeFromParentAndDestroy(builder);
+        builder.removeAndDestroyChild(*continuationChainNode.next->renderer);
     removeFromContinuationChain();
 }
 

Modified: trunk/Source/WebCore/rendering/RenderButton.cpp (228700 => 228701)


--- trunk/Source/WebCore/rendering/RenderButton.cpp	2018-02-19 18:55:34 UTC (rev 228700)
+++ trunk/Source/WebCore/rendering/RenderButton.cpp	2018-02-19 19:03:37 UTC (rev 228701)
@@ -117,11 +117,9 @@
         return;
     }
     if (RenderTreeBuilder::current())
-        m_buttonText->removeFromParentAndDestroy(*RenderTreeBuilder::current());
-    else {
-        RenderTreeBuilder builder(*document().renderView());
-        m_buttonText->removeFromParentAndDestroy(builder);
-    }
+        RenderTreeBuilder::current()->removeAndDestroyChild(*m_buttonText);
+    else
+        RenderTreeBuilder(*document().renderView()).removeAndDestroyChild(*m_buttonText);
 }
 
 String RenderButton::text() const

Modified: trunk/Source/WebCore/rendering/RenderFullScreen.cpp (228700 => 228701)


--- trunk/Source/WebCore/rendering/RenderFullScreen.cpp	2018-02-19 18:55:34 UTC (rev 228700)
+++ trunk/Source/WebCore/rendering/RenderFullScreen.cpp	2018-02-19 19:03:37 UTC (rev 228701)
@@ -61,7 +61,7 @@
 void RenderFullScreen::willBeDestroyed(RenderTreeBuilder& builder)
 {
     if (m_placeholder) {
-        m_placeholder->removeFromParentAndDestroy(builder);
+        builder.removeAndDestroyChild(*m_placeholder);
         ASSERT(!m_placeholder);
     }
 
@@ -169,7 +169,7 @@
                 if (auto* nonAnonymousChild = downcast<RenderBlock>(*child).firstChild())
                     child = nonAnonymousChild;
                 else {
-                    child->removeFromParentAndDestroy(builder);
+                    builder.removeAndDestroyChild(*child);
                     continue;
                 }
             }
@@ -184,10 +184,10 @@
         }
     }
     if (placeholder())
-        placeholder()->removeFromParentAndDestroy(builder);
+        builder.removeAndDestroyChild(*placeholder());
     ASSERT(!placeholder());
 
-    removeFromParentAndDestroy(builder);
+    builder.removeAndDestroyChild(*this);
 }
 
 void RenderFullScreen::createPlaceholder(std::unique_ptr<RenderStyle> style, const LayoutRect& frameRect)

Modified: trunk/Source/WebCore/rendering/RenderListItem.cpp (228700 => 228701)


--- trunk/Source/WebCore/rendering/RenderListItem.cpp	2018-02-19 18:55:34 UTC (rev 228700)
+++ trunk/Source/WebCore/rendering/RenderListItem.cpp	2018-02-19 19:03:37 UTC (rev 228701)
@@ -31,6 +31,7 @@
 #include "HTMLUListElement.h"
 #include "InlineElementBox.h"
 #include "PseudoElement.h"
+#include "RenderTreeBuilder.h"
 #include "RenderView.h"
 #include "StyleInheritedData.h"
 #include <wtf/IsoMallocInlines.h>
@@ -57,7 +58,7 @@
 void RenderListItem::willBeDestroyed(RenderTreeBuilder& builder)
 {
     if (m_marker)
-        m_marker->removeFromParentAndDestroy(builder);
+        builder.removeAndDestroyChild(*m_marker);
     RenderBlockFlow::willBeDestroyed(builder);
 }
 

Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (228700 => 228701)


--- trunk/Source/WebCore/rendering/RenderObject.cpp	2018-02-19 18:55:34 UTC (rev 228700)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp	2018-02-19 19:03:37 UTC (rev 228701)
@@ -255,12 +255,6 @@
     m_parent = parent;
 }
 
-void RenderObject::removeFromParentAndDestroy(RenderTreeBuilder& builder)
-{
-    ASSERT(m_parent);
-    builder.removeAndDestroyChild(*this);
-}
-
 RenderObject* RenderObject::nextInPreOrder() const
 {
     if (RenderObject* o = firstChildSlow())

Modified: trunk/Source/WebCore/rendering/RenderObject.h (228700 => 228701)


--- trunk/Source/WebCore/rendering/RenderObject.h	2018-02-19 18:55:34 UTC (rev 228700)
+++ trunk/Source/WebCore/rendering/RenderObject.h	2018-02-19 19:03:37 UTC (rev 228701)
@@ -753,8 +753,6 @@
     void imageChanged(CachedImage*, const IntRect* = nullptr) override;
     virtual void imageChanged(WrappedImagePtr, const IntRect* = nullptr) { }
 
-    void removeFromParentAndDestroy(RenderTreeBuilder&);
-
     CSSAnimationController& animation() const;
 
     // Map points and quads through elements, potentially via 3d transforms. You should never need to call these directly; use

Modified: trunk/Source/WebCore/rendering/RenderTextFragment.cpp (228700 => 228701)


--- trunk/Source/WebCore/rendering/RenderTextFragment.cpp	2018-02-19 18:55:34 UTC (rev 228700)
+++ trunk/Source/WebCore/rendering/RenderTextFragment.cpp	2018-02-19 19:03:37 UTC (rev 228701)
@@ -77,7 +77,7 @@
 void RenderTextFragment::willBeDestroyed(RenderTreeBuilder& builder)
 {
     if (m_firstLetter)
-        m_firstLetter->removeFromParentAndDestroy(builder);
+        builder.removeAndDestroyChild(*m_firstLetter);
     RenderText::willBeDestroyed(builder);
 }
 
@@ -89,11 +89,9 @@
     if (!m_firstLetter)
         return;
     if (RenderTreeBuilder::current())
-        m_firstLetter->removeFromParentAndDestroy(*RenderTreeBuilder::current());
-    else {
-        RenderTreeBuilder builder(*document().renderView());
-        m_firstLetter->removeFromParentAndDestroy(builder);
-    }
+        RenderTreeBuilder::current()->removeAndDestroyChild(*m_firstLetter);
+    else
+        RenderTreeBuilder(*document().renderView()).removeAndDestroyChild(*m_firstLetter);
     ASSERT(!m_firstLetter);
     ASSERT(!textNode() || textNode()->renderer() == this);
 }

Modified: trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp (228700 => 228701)


--- trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp	2018-02-19 18:55:34 UTC (rev 228700)
+++ trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp	2018-02-19 19:03:37 UTC (rev 228701)
@@ -646,7 +646,7 @@
 {
     // If the tree is destroyed, there is no need for a clean-up phase.
     if (child.renderTreeBeingDestroyed()) {
-        child.removeFromParentAndDestroy(*this);
+        removeAndDestroyChild(child);
         return;
     }
 

Modified: trunk/Source/WebCore/rendering/updating/RenderTreeBuilderBlock.cpp (228700 => 228701)


--- trunk/Source/WebCore/rendering/updating/RenderTreeBuilderBlock.cpp	2018-02-19 18:55:34 UTC (rev 228700)
+++ trunk/Source/WebCore/rendering/updating/RenderTreeBuilderBlock.cpp	2018-02-19 19:03:37 UTC (rev 228701)
@@ -319,7 +319,7 @@
 
             // Delete the now-empty block's lines and nuke it.
             nextBlock.deleteLines();
-            nextBlock.removeFromParentAndDestroy(m_builder);
+            m_builder.removeAndDestroyChild(nextBlock);
             next = nullptr;
         }
     }

Modified: trunk/Source/WebCore/rendering/updating/RenderTreeBuilderList.cpp (228700 => 228701)


--- trunk/Source/WebCore/rendering/updating/RenderTreeBuilderList.cpp	2018-02-19 18:55:34 UTC (rev 228700)
+++ trunk/Source/WebCore/rendering/updating/RenderTreeBuilderList.cpp	2018-02-19 19:03:37 UTC (rev 228701)
@@ -80,7 +80,7 @@
 
     if (style.listStyleType() == NoneListStyle && (!style.listStyleImage() || style.listStyleImage()->errorOccurred())) {
         if (auto* marker = listItemRenderer.markerRenderer())
-            marker->removeFromParentAndDestroy(m_builder);
+            m_builder.removeAndDestroyChild(*marker);
         return;
     }
 
@@ -121,7 +121,7 @@
 
     // If current parent is an anonymous block that has lost all its children, destroy it.
     if (currentParent && currentParent->isAnonymousBlock() && !currentParent->firstChild() && !downcast<RenderBlock>(*currentParent).continuation())
-        currentParent->removeFromParentAndDestroy(m_builder);
+        m_builder.removeAndDestroyChild(*currentParent);
 }
 
 }

Modified: trunk/Source/WebCore/rendering/updating/RenderTreeBuilderMultiColumn.cpp (228700 => 228701)


--- trunk/Source/WebCore/rendering/updating/RenderTreeBuilderMultiColumn.cpp	2018-02-19 18:55:34 UTC (rev 228700)
+++ trunk/Source/WebCore/rendering/updating/RenderTreeBuilderMultiColumn.cpp	2018-02-19 19:03:37 UTC (rev 228701)
@@ -212,11 +212,11 @@
         parentAndSpannerList.append(std::make_pair(spannerOriginalParent, m_builder.takeChild(*spanner->parent(), *spanner)));
     }
     while (auto* columnSet = multiColumnFlow.firstMultiColumnSet())
-        columnSet->removeFromParentAndDestroy(m_builder);
+        m_builder.removeAndDestroyChild(*columnSet);
 
     flow.clearMultiColumnFlow();
     m_builder.moveAllChildrenTo(multiColumnFlow, flow, RenderTreeBuilder::NormalizeAfterInsertion::Yes);
-    multiColumnFlow.removeFromParentAndDestroy(m_builder);
+    m_builder.removeAndDestroyChild(multiColumnFlow);
     for (auto& parentAndSpanner : parentAndSpannerList)
         m_builder.insertChild(*parentAndSpanner.first, WTFMove(parentAndSpanner.second));
 }
@@ -372,13 +372,13 @@
 {
     // The placeholder may already have been removed, but if it hasn't, do so now.
     if (auto placeholder = flow.spannerMap().take(&downcast<RenderBox>(spanner)))
-        placeholder->removeFromParentAndDestroy(m_builder);
+        m_builder.removeAndDestroyChild(*placeholder);
 
     if (auto* next = spanner.nextSibling()) {
         if (auto* previous = spanner.previousSibling()) {
             if (previous->isRenderMultiColumnSet() && next->isRenderMultiColumnSet()) {
                 // Merge two sets that no longer will be separated by a spanner.
-                next->removeFromParentAndDestroy(m_builder);
+                m_builder.removeAndDestroyChild(*next);
                 previous->setNeedsLayout();
             }
         }

Modified: trunk/Source/WebCore/rendering/updating/RenderTreeBuilderRuby.cpp (228700 => 228701)


--- trunk/Source/WebCore/rendering/updating/RenderTreeBuilderRuby.cpp	2018-02-19 18:55:34 UTC (rev 228700)
+++ trunk/Source/WebCore/rendering/updating/RenderTreeBuilderRuby.cpp	2018-02-19 19:03:37 UTC (rev 228701)
@@ -166,7 +166,7 @@
         auto* anonBlockThere = downcast<RenderBlock>(lastChildThere);
         m_builder.moveAllChildrenTo(*anonBlockHere, *anonBlockThere, RenderTreeBuilder::NormalizeAfterInsertion::Yes);
         anonBlockHere->deleteLines();
-        anonBlockHere->removeFromParentAndDestroy(m_builder);
+        m_builder.removeAndDestroyChild(*anonBlockHere);
     }
     // Move all remaining children normally.
     m_builder.moveChildrenTo(from, to, from.firstChild(), beforeChild, RenderTreeBuilder::NormalizeAfterInsertion::No);
@@ -393,7 +393,7 @@
         ASSERT(child.isBeforeContent() || child.isAfterContent());
         auto& parent = *child.parent();
         auto takenChild = m_builder.takeChild(parent, child);
-        parent.removeFromParentAndDestroy(m_builder);
+        m_builder.removeAndDestroyChild(parent);
         return takenChild;
     }
 
@@ -417,7 +417,7 @@
         ASSERT(child.isBeforeContent() || child.isAfterContent());
         auto& parent = *child.parent();
         auto takenChild = m_builder.takeChild(parent, child);
-        parent.removeFromParentAndDestroy(m_builder);
+        m_builder.removeAndDestroyChild(parent);
         return takenChild;
     }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to