[RenderTreeBuilder] Introduce RenderTreeBuilder to willBeDestoryed/removeFromParentAn...
authorzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 9 Feb 2018 20:50:58 +0000 (20:50 +0000)
committerzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 9 Feb 2018 20:50:58 +0000 (20:50 +0000)
https://bugs.webkit.org/show_bug.cgi?id=182635
<rdar://problem/37377489>

Reviewed by Antti Koivisto.

This patch helps finding callsites where we don't have a RenderTreeBuilder instance.

No change in functionality.

* dom/Document.cpp:
(WebCore::Document::setFullScreenRenderer):
* dom/Document.h:
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::willBeDestroyed):
(WebCore::RenderBlock::takeChild):
* rendering/RenderBlock.h:
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::willBeDestroyed):
* rendering/RenderBlockFlow.h:
* rendering/RenderBox.cpp:
(WebCore::RenderBox::willBeDestroyed):
* rendering/RenderBox.h:
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::willBeDestroyed):
(WebCore::RenderBoxModelObject::removeAndDestroyAllContinuations):
* rendering/RenderBoxModelObject.h:
* rendering/RenderButton.cpp:
(WebCore::RenderButton::setText):
* rendering/RenderCounter.cpp:
(WebCore::RenderCounter::willBeDestroyed):
* rendering/RenderCounter.h:
* rendering/RenderElement.cpp:
(WebCore::RenderElement::willBeDestroyed):
* rendering/RenderElement.h:
* rendering/RenderEmbeddedObject.cpp:
(WebCore::RenderEmbeddedObject::willBeDestroyed):
* rendering/RenderEmbeddedObject.h:
* rendering/RenderFragmentedFlow.cpp:
(WebCore::RenderFragmentedFlow::willBeDestroyed):
* rendering/RenderFragmentedFlow.h:
* rendering/RenderFullScreen.cpp:
(WebCore::RenderFullScreen::willBeDestroyed):
(WebCore::RenderFullScreen::wrapNewRenderer):
(WebCore::RenderFullScreen::wrapExistingRenderer):
(WebCore::RenderFullScreen::unwrapRenderer):
* rendering/RenderFullScreen.h:
* rendering/RenderImage.cpp:
(WebCore::RenderImage::willBeDestroyed):
* rendering/RenderImage.h:
* rendering/RenderInline.cpp:
(WebCore::RenderInline::willBeDestroyed):
* rendering/RenderInline.h:
* rendering/RenderLayerModelObject.cpp:
(WebCore::RenderLayerModelObject::willBeDestroyed):
* rendering/RenderLayerModelObject.h:
* rendering/RenderListBox.cpp:
(WebCore::RenderListBox::willBeDestroyed):
* rendering/RenderListBox.h:
* rendering/RenderListItem.cpp:
(WebCore::RenderListItem::willBeDestroyed):
* rendering/RenderListItem.h:
* rendering/RenderListMarker.cpp:
(WebCore::RenderListMarker::willBeDestroyed):
* rendering/RenderListMarker.h:
* rendering/RenderMenuList.cpp:
(WebCore::RenderMenuList::willBeDestroyed):
* rendering/RenderMenuList.h:
* rendering/RenderMultiColumnFlow.cpp:
(WebCore::RenderMultiColumnFlow::handleSpannerRemoval):
* rendering/RenderObject.cpp:
(WebCore::RenderObject::removeFromParentAndDestroy):
(WebCore::RenderObject::willBeDestroyed):
(WebCore::RenderObject::destroy):
* rendering/RenderObject.h:
* rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::willBeDestroyed):
* rendering/RenderReplaced.h:
* rendering/RenderRuby.cpp:
(WebCore::RenderRubyAsInline::takeChild):
(WebCore::RenderRubyAsBlock::takeChild):
* rendering/RenderSearchField.cpp:
(WebCore::RenderSearchField::willBeDestroyed):
* rendering/RenderSearchField.h:
* rendering/RenderSnapshottedPlugIn.cpp:
(WebCore::RenderSnapshottedPlugIn::willBeDestroyed):
* rendering/RenderSnapshottedPlugIn.h:
* rendering/RenderText.cpp:
(WebCore::RenderText::willBeDestroyed):
* rendering/RenderText.h:
* rendering/RenderTextControlMultiLine.cpp:
(WebCore::RenderTextControlMultiLine::willBeDestroyed):
* rendering/RenderTextControlMultiLine.h:
* rendering/RenderTextFragment.cpp:
(WebCore::RenderTextFragment::willBeDestroyed):
(WebCore::RenderTextFragment::setText):
* rendering/RenderTextFragment.h:
* rendering/RenderVideo.cpp:
(WebCore::RenderVideo::willBeDestroyed):
* rendering/RenderVideo.h:
* rendering/RenderView.cpp:
(WebCore::RenderView::willBeDestroyed):
* rendering/RenderView.h:
* rendering/RenderWidget.cpp:
(WebCore::RenderWidget::willBeDestroyed):
* rendering/RenderWidget.h:
* rendering/svg/RenderSVGBlock.cpp:
(WebCore::RenderSVGBlock::willBeDestroyed):
* rendering/svg/RenderSVGBlock.h:
* rendering/svg/RenderSVGImage.cpp:
(WebCore::RenderSVGImage::willBeDestroyed):
* rendering/svg/RenderSVGImage.h:
* rendering/svg/RenderSVGInline.cpp:
(WebCore::RenderSVGInline::willBeDestroyed):
* rendering/svg/RenderSVGInline.h:
* rendering/svg/RenderSVGModelObject.cpp:
(WebCore::RenderSVGModelObject::willBeDestroyed):
* rendering/svg/RenderSVGModelObject.h:
* rendering/svg/RenderSVGResourceContainer.cpp:
(WebCore::RenderSVGResourceContainer::willBeDestroyed):
* rendering/svg/RenderSVGResourceContainer.h:
* rendering/svg/RenderSVGRoot.cpp:
(WebCore::RenderSVGRoot::willBeDestroyed):
* rendering/svg/RenderSVGRoot.h:
* rendering/svg/RenderSVGText.cpp:
(WebCore::RenderSVGText::willBeDestroyed):
* rendering/svg/RenderSVGText.h:
* rendering/updating/RenderTreeBuilder.cpp:
(WebCore::RenderTreeBuilder::removeFromParentAndDestroyCleaningUpAnonymousWrappers):
* rendering/updating/RenderTreeBuilderList.cpp:
(WebCore::RenderTreeBuilder::List::updateItemMarker):
* rendering/updating/RenderTreeBuilderMultiColumn.cpp:
(WebCore::RenderTreeBuilder::MultiColumn::destroyFragmentedFlow):
* rendering/updating/RenderTreeBuilderRuby.cpp:
(WebCore::RenderTreeBuilder::Ruby::moveBlockChildren):

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

75 files changed:
Source/WebCore/ChangeLog
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Document.h
Source/WebCore/rendering/RenderBlock.cpp
Source/WebCore/rendering/RenderBlock.h
Source/WebCore/rendering/RenderBlockFlow.cpp
Source/WebCore/rendering/RenderBlockFlow.h
Source/WebCore/rendering/RenderBox.cpp
Source/WebCore/rendering/RenderBox.h
Source/WebCore/rendering/RenderBoxModelObject.cpp
Source/WebCore/rendering/RenderBoxModelObject.h
Source/WebCore/rendering/RenderButton.cpp
Source/WebCore/rendering/RenderCounter.cpp
Source/WebCore/rendering/RenderCounter.h
Source/WebCore/rendering/RenderElement.cpp
Source/WebCore/rendering/RenderElement.h
Source/WebCore/rendering/RenderEmbeddedObject.cpp
Source/WebCore/rendering/RenderEmbeddedObject.h
Source/WebCore/rendering/RenderFragmentedFlow.cpp
Source/WebCore/rendering/RenderFragmentedFlow.h
Source/WebCore/rendering/RenderFullScreen.cpp
Source/WebCore/rendering/RenderFullScreen.h
Source/WebCore/rendering/RenderImage.cpp
Source/WebCore/rendering/RenderImage.h
Source/WebCore/rendering/RenderInline.cpp
Source/WebCore/rendering/RenderInline.h
Source/WebCore/rendering/RenderLayerModelObject.cpp
Source/WebCore/rendering/RenderLayerModelObject.h
Source/WebCore/rendering/RenderListBox.cpp
Source/WebCore/rendering/RenderListBox.h
Source/WebCore/rendering/RenderListItem.cpp
Source/WebCore/rendering/RenderListItem.h
Source/WebCore/rendering/RenderListMarker.cpp
Source/WebCore/rendering/RenderListMarker.h
Source/WebCore/rendering/RenderMenuList.cpp
Source/WebCore/rendering/RenderMenuList.h
Source/WebCore/rendering/RenderObject.cpp
Source/WebCore/rendering/RenderObject.h
Source/WebCore/rendering/RenderReplaced.cpp
Source/WebCore/rendering/RenderReplaced.h
Source/WebCore/rendering/RenderRuby.cpp
Source/WebCore/rendering/RenderSearchField.cpp
Source/WebCore/rendering/RenderSearchField.h
Source/WebCore/rendering/RenderSnapshottedPlugIn.cpp
Source/WebCore/rendering/RenderSnapshottedPlugIn.h
Source/WebCore/rendering/RenderText.cpp
Source/WebCore/rendering/RenderText.h
Source/WebCore/rendering/RenderTextControlMultiLine.cpp
Source/WebCore/rendering/RenderTextControlMultiLine.h
Source/WebCore/rendering/RenderTextFragment.cpp
Source/WebCore/rendering/RenderTextFragment.h
Source/WebCore/rendering/RenderVideo.cpp
Source/WebCore/rendering/RenderVideo.h
Source/WebCore/rendering/RenderView.cpp
Source/WebCore/rendering/RenderView.h
Source/WebCore/rendering/RenderWidget.cpp
Source/WebCore/rendering/RenderWidget.h
Source/WebCore/rendering/svg/RenderSVGBlock.cpp
Source/WebCore/rendering/svg/RenderSVGBlock.h
Source/WebCore/rendering/svg/RenderSVGImage.cpp
Source/WebCore/rendering/svg/RenderSVGImage.h
Source/WebCore/rendering/svg/RenderSVGInline.cpp
Source/WebCore/rendering/svg/RenderSVGInline.h
Source/WebCore/rendering/svg/RenderSVGModelObject.cpp
Source/WebCore/rendering/svg/RenderSVGModelObject.h
Source/WebCore/rendering/svg/RenderSVGResourceContainer.cpp
Source/WebCore/rendering/svg/RenderSVGResourceContainer.h
Source/WebCore/rendering/svg/RenderSVGRoot.cpp
Source/WebCore/rendering/svg/RenderSVGRoot.h
Source/WebCore/rendering/svg/RenderSVGText.cpp
Source/WebCore/rendering/svg/RenderSVGText.h
Source/WebCore/rendering/updating/RenderTreeBuilder.cpp
Source/WebCore/rendering/updating/RenderTreeBuilderList.cpp
Source/WebCore/rendering/updating/RenderTreeBuilderMultiColumn.cpp
Source/WebCore/rendering/updating/RenderTreeBuilderRuby.cpp

index 3c75a6d..b2e4921 100644 (file)
@@ -1,3 +1,141 @@
+2018-02-09  Zalan Bujtas  <zalan@apple.com>
+
+        [RenderTreeBuilder] Introduce RenderTreeBuilder to willBeDestoryed/removeFromParentAndDestroy
+        https://bugs.webkit.org/show_bug.cgi?id=182635
+        <rdar://problem/37377489>
+
+        Reviewed by Antti Koivisto.
+
+        This patch helps finding callsites where we don't have a RenderTreeBuilder instance.
+
+        No change in functionality.
+
+        * dom/Document.cpp:
+        (WebCore::Document::setFullScreenRenderer):
+        * dom/Document.h:
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::willBeDestroyed):
+        (WebCore::RenderBlock::takeChild):
+        * rendering/RenderBlock.h:
+        * rendering/RenderBlockFlow.cpp:
+        (WebCore::RenderBlockFlow::willBeDestroyed):
+        * rendering/RenderBlockFlow.h:
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::willBeDestroyed):
+        * rendering/RenderBox.h:
+        * rendering/RenderBoxModelObject.cpp:
+        (WebCore::RenderBoxModelObject::willBeDestroyed):
+        (WebCore::RenderBoxModelObject::removeAndDestroyAllContinuations):
+        * rendering/RenderBoxModelObject.h:
+        * rendering/RenderButton.cpp:
+        (WebCore::RenderButton::setText):
+        * rendering/RenderCounter.cpp:
+        (WebCore::RenderCounter::willBeDestroyed):
+        * rendering/RenderCounter.h:
+        * rendering/RenderElement.cpp:
+        (WebCore::RenderElement::willBeDestroyed):
+        * rendering/RenderElement.h:
+        * rendering/RenderEmbeddedObject.cpp:
+        (WebCore::RenderEmbeddedObject::willBeDestroyed):
+        * rendering/RenderEmbeddedObject.h:
+        * rendering/RenderFragmentedFlow.cpp:
+        (WebCore::RenderFragmentedFlow::willBeDestroyed):
+        * rendering/RenderFragmentedFlow.h:
+        * rendering/RenderFullScreen.cpp:
+        (WebCore::RenderFullScreen::willBeDestroyed):
+        (WebCore::RenderFullScreen::wrapNewRenderer):
+        (WebCore::RenderFullScreen::wrapExistingRenderer):
+        (WebCore::RenderFullScreen::unwrapRenderer):
+        * rendering/RenderFullScreen.h:
+        * rendering/RenderImage.cpp:
+        (WebCore::RenderImage::willBeDestroyed):
+        * rendering/RenderImage.h:
+        * rendering/RenderInline.cpp:
+        (WebCore::RenderInline::willBeDestroyed):
+        * rendering/RenderInline.h:
+        * rendering/RenderLayerModelObject.cpp:
+        (WebCore::RenderLayerModelObject::willBeDestroyed):
+        * rendering/RenderLayerModelObject.h:
+        * rendering/RenderListBox.cpp:
+        (WebCore::RenderListBox::willBeDestroyed):
+        * rendering/RenderListBox.h:
+        * rendering/RenderListItem.cpp:
+        (WebCore::RenderListItem::willBeDestroyed):
+        * rendering/RenderListItem.h:
+        * rendering/RenderListMarker.cpp:
+        (WebCore::RenderListMarker::willBeDestroyed):
+        * rendering/RenderListMarker.h:
+        * rendering/RenderMenuList.cpp:
+        (WebCore::RenderMenuList::willBeDestroyed):
+        * rendering/RenderMenuList.h:
+        * rendering/RenderMultiColumnFlow.cpp:
+        (WebCore::RenderMultiColumnFlow::handleSpannerRemoval):
+        * rendering/RenderObject.cpp:
+        (WebCore::RenderObject::removeFromParentAndDestroy):
+        (WebCore::RenderObject::willBeDestroyed):
+        (WebCore::RenderObject::destroy):
+        * rendering/RenderObject.h:
+        * rendering/RenderReplaced.cpp:
+        (WebCore::RenderReplaced::willBeDestroyed):
+        * rendering/RenderReplaced.h:
+        * rendering/RenderRuby.cpp:
+        (WebCore::RenderRubyAsInline::takeChild):
+        (WebCore::RenderRubyAsBlock::takeChild):
+        * rendering/RenderSearchField.cpp:
+        (WebCore::RenderSearchField::willBeDestroyed):
+        * rendering/RenderSearchField.h:
+        * rendering/RenderSnapshottedPlugIn.cpp:
+        (WebCore::RenderSnapshottedPlugIn::willBeDestroyed):
+        * rendering/RenderSnapshottedPlugIn.h:
+        * rendering/RenderText.cpp:
+        (WebCore::RenderText::willBeDestroyed):
+        * rendering/RenderText.h:
+        * rendering/RenderTextControlMultiLine.cpp:
+        (WebCore::RenderTextControlMultiLine::willBeDestroyed):
+        * rendering/RenderTextControlMultiLine.h:
+        * rendering/RenderTextFragment.cpp:
+        (WebCore::RenderTextFragment::willBeDestroyed):
+        (WebCore::RenderTextFragment::setText):
+        * rendering/RenderTextFragment.h:
+        * rendering/RenderVideo.cpp:
+        (WebCore::RenderVideo::willBeDestroyed):
+        * rendering/RenderVideo.h:
+        * rendering/RenderView.cpp:
+        (WebCore::RenderView::willBeDestroyed):
+        * rendering/RenderView.h:
+        * rendering/RenderWidget.cpp:
+        (WebCore::RenderWidget::willBeDestroyed):
+        * rendering/RenderWidget.h:
+        * rendering/svg/RenderSVGBlock.cpp:
+        (WebCore::RenderSVGBlock::willBeDestroyed):
+        * rendering/svg/RenderSVGBlock.h:
+        * rendering/svg/RenderSVGImage.cpp:
+        (WebCore::RenderSVGImage::willBeDestroyed):
+        * rendering/svg/RenderSVGImage.h:
+        * rendering/svg/RenderSVGInline.cpp:
+        (WebCore::RenderSVGInline::willBeDestroyed):
+        * rendering/svg/RenderSVGInline.h:
+        * rendering/svg/RenderSVGModelObject.cpp:
+        (WebCore::RenderSVGModelObject::willBeDestroyed):
+        * rendering/svg/RenderSVGModelObject.h:
+        * rendering/svg/RenderSVGResourceContainer.cpp:
+        (WebCore::RenderSVGResourceContainer::willBeDestroyed):
+        * rendering/svg/RenderSVGResourceContainer.h:
+        * rendering/svg/RenderSVGRoot.cpp:
+        (WebCore::RenderSVGRoot::willBeDestroyed):
+        * rendering/svg/RenderSVGRoot.h:
+        * rendering/svg/RenderSVGText.cpp:
+        (WebCore::RenderSVGText::willBeDestroyed):
+        * rendering/svg/RenderSVGText.h:
+        * rendering/updating/RenderTreeBuilder.cpp:
+        (WebCore::RenderTreeBuilder::removeFromParentAndDestroyCleaningUpAnonymousWrappers):
+        * rendering/updating/RenderTreeBuilderList.cpp:
+        (WebCore::RenderTreeBuilder::List::updateItemMarker):
+        * rendering/updating/RenderTreeBuilderMultiColumn.cpp:
+        (WebCore::RenderTreeBuilder::MultiColumn::destroyFragmentedFlow):
+        * rendering/updating/RenderTreeBuilderRuby.cpp:
+        (WebCore::RenderTreeBuilder::Ruby::moveBlockChildren):
+
 2018-02-09  Brent Fulgham  <bfulgham@apple.com>
 
         [macOS, iOS] Expose OS marketing version in UserAgent
index df776a3..59082cf 100644 (file)
@@ -6297,7 +6297,7 @@ void Document::webkitDidExitFullScreenForElement(Element*)
     exitingDocument.m_fullScreenChangeDelayTimer.startOneShot(0_s);
 }
 
-void Document::setFullScreenRenderer(RenderFullScreen* renderer)
+void Document::setFullScreenRenderer(RenderTreeBuilder& builder, RenderFullScreen* renderer)
 {
     if (renderer == m_fullScreenRenderer)
         return;
@@ -6312,7 +6312,7 @@ void Document::setFullScreenRenderer(RenderFullScreen* renderer)
     }
 
     if (m_fullScreenRenderer)
-        m_fullScreenRenderer->removeFromParentAndDestroy();
+        m_fullScreenRenderer->removeFromParentAndDestroy(builder);
     ASSERT(!m_fullScreenRenderer);
 
     m_fullScreenRenderer = makeWeakPtr(renderer);
index fd6e6a1..6b1b6f8 100644 (file)
@@ -152,6 +152,7 @@ class ProcessingInstruction;
 class QualifiedName;
 class Range;
 class RenderFullScreen;
+class RenderTreeBuilder;
 class RenderView;
 class RequestAnimationFrameCallback;
 class SVGDocumentExtensions;
@@ -1130,7 +1131,7 @@ public:
     WEBCORE_EXPORT void webkitWillExitFullScreenForElement(Element*);
     WEBCORE_EXPORT void webkitDidExitFullScreenForElement(Element*);
     
-    void setFullScreenRenderer(RenderFullScreen*);
+    void setFullScreenRenderer(RenderTreeBuilder&, RenderFullScreen*);
     RenderFullScreen* fullScreenRenderer() const { return m_fullScreenRenderer.get(); }
 
     void fullScreenChangeDelayTimerFired();
index c71fb54..fb9198e 100644 (file)
@@ -343,7 +343,7 @@ RenderBlock::~RenderBlock()
 }
 
 // Note that this is not called for RenderBlockFlows.
-void RenderBlock::willBeDestroyed()
+void RenderBlock::willBeDestroyed(RenderTreeBuilder& builder)
 {
     if (!renderTreeBeingDestroyed()) {
         if (parent())
@@ -352,7 +352,7 @@ void RenderBlock::willBeDestroyed()
 
     blockWillBeDestroyed();
 
-    RenderBox::willBeDestroyed();
+    RenderBox::willBeDestroyed(builder);
 }
 
 void RenderBlock::blockWillBeDestroyed()
@@ -578,7 +578,7 @@ RenderPtr<RenderObject> RenderBlock::takeChild(RenderTreeBuilder& builder, Rende
             
             // Delete the now-empty block's lines and nuke it.
             nextBlock.deleteLines();
-            nextBlock.removeFromParentAndDestroy();
+            nextBlock.removeFromParentAndDestroy(builder);
             next = nullptr;
         }
     }
index a183dcc..c3f5459 100644 (file)
@@ -323,7 +323,7 @@ public:
     
 protected:
     RenderFragmentedFlow* locateEnclosingFragmentedFlow() const override;
-    void willBeDestroyed() override;
+    void willBeDestroyed(RenderTreeBuilder&) override;
 
     void layout() override;
 
index 25c404e..2a0c0b5 100644 (file)
@@ -127,7 +127,7 @@ RenderBlockFlow::~RenderBlockFlow()
     // Do not add any code here. Add it to willBeDestroyed() instead.
 }
 
-void RenderBlockFlow::willBeDestroyed()
+void RenderBlockFlow::willBeDestroyed(RenderTreeBuilder& builder)
 {
     if (!renderTreeBeingDestroyed()) {
         if (firstRootBox()) {
@@ -154,7 +154,7 @@ void RenderBlockFlow::willBeDestroyed()
     blockWillBeDestroyed();
 
     // NOTE: This jumps down to RenderBox, bypassing RenderBlock since it would do duplicate work.
-    RenderBox::willBeDestroyed();
+    RenderBox::willBeDestroyed(builder);
 }
 
 RenderBlockFlow* RenderBlockFlow::previousSiblingWithOverhangingFloats(bool& parentHasFloats) const
index 9bc6b00..52078b9 100644 (file)
@@ -59,7 +59,7 @@ public:
     void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0) override;
 
 protected:
-    void willBeDestroyed() override;
+    void willBeDestroyed(RenderTreeBuilder&) override;
     
     // This method is called at the start of layout to wipe away all of the floats in our floating objects list. It also
     // repopulates the list with any floats that intrude from previous siblings or parents. Floats that were added by
index a0e504d..c6d8dc1 100644 (file)
@@ -150,7 +150,7 @@ RenderBox::~RenderBox()
     // Do not add any code here. Add it to willBeDestroyed() instead.
 }
 
-void RenderBox::willBeDestroyed()
+void RenderBox::willBeDestroyed(RenderTreeBuilder& builder)
 {
     if (frame().eventHandler().autoscrollRenderer() == this)
         frame().eventHandler().stopAutoscrollTimer(true);
@@ -170,7 +170,7 @@ void RenderBox::willBeDestroyed()
         view().unregisterBoxWithScrollSnapPositions(*this);
 #endif
 
-    RenderBoxModelObject::willBeDestroyed();
+    RenderBoxModelObject::willBeDestroyed(builder);
 }
 
 RenderFragmentContainer* RenderBox::clampToStartAndEndFragments(RenderFragmentContainer* fragment) const
index ad4491b..17e694e 100644 (file)
@@ -631,7 +631,7 @@ protected:
     void styleDidChange(StyleDifference, const RenderStyle* oldStyle) override;
     void updateFromStyle() override;
 
-    void willBeDestroyed() override;
+    void willBeDestroyed(RenderTreeBuilder&) override;
 
     bool createsNewFormattingContext() const;
 
index a8186ef..e2d63a9 100644 (file)
@@ -237,10 +237,10 @@ RenderBoxModelObject::~RenderBoxModelObject()
     // Do not add any code here. Add it to willBeDestroyed() instead.
 }
 
-void RenderBoxModelObject::willBeDestroyed()
+void RenderBoxModelObject::willBeDestroyed(RenderTreeBuilder& builder)
 {
     if (continuation() && !isContinuation()) {
-        removeAndDestroyAllContinuations();
+        removeAndDestroyAllContinuations(builder);
         ASSERT(!continuation());
     }
     if (hasContinuationChainNode())
@@ -252,7 +252,7 @@ void RenderBoxModelObject::willBeDestroyed()
     if (!renderTreeBeingDestroyed())
         view().imageQualityController().rendererWillBeDestroyed(*this);
 
-    RenderLayerModelObject::willBeDestroyed();
+    RenderLayerModelObject::willBeDestroyed(builder);
 }
 
 bool RenderBoxModelObject::hasVisibleBoxDecorationStyle() const
@@ -2551,14 +2551,14 @@ auto RenderBoxModelObject::ensureContinuationChainNode() -> ContinuationChainNod
     }).iterator->value;
 }
 
-void RenderBoxModelObject::removeAndDestroyAllContinuations()
+void RenderBoxModelObject::removeAndDestroyAllContinuations(RenderTreeBuilder& builder)
 {
     ASSERT(!isContinuation());
     ASSERT(hasContinuationChainNode());
     ASSERT(continuationChainNodeMap().contains(this));
     auto& continuationChainNode = *continuationChainNodeMap().get(this);
     while (continuationChainNode.next)
-        continuationChainNode.next->renderer->removeFromParentAndDestroy();
+        continuationChainNode.next->renderer->removeFromParentAndDestroy(builder);
     removeFromContinuationChain();
 }
 
index 7be8b2b..ee840cb 100644 (file)
@@ -245,7 +245,7 @@ protected:
     RenderBoxModelObject(Element&, RenderStyle&&, BaseTypeFlags);
     RenderBoxModelObject(Document&, RenderStyle&&, BaseTypeFlags);
 
-    void willBeDestroyed() override;
+    void willBeDestroyed(RenderTreeBuilder&) override;
 
     LayoutPoint adjustedPositionRelativeToOffsetParent(const LayoutPoint&) const;
 
@@ -308,7 +308,7 @@ public:
 
 private:
     ContinuationChainNode& ensureContinuationChainNode();
-    void removeAndDestroyAllContinuations();
+    void removeAndDestroyAllContinuations(RenderTreeBuilder&);
 
     LayoutUnit computedCSSPadding(const Length&) const;
     
index 65ad34c..ed8a1eb 100644 (file)
@@ -128,7 +128,12 @@ void RenderButton::setText(const String& str)
         m_buttonText->setText(str.impl());
         return;
     }
-    m_buttonText->removeFromParentAndDestroy();
+    if (RenderTreeBuilder::current())
+        m_buttonText->removeFromParentAndDestroy(*RenderTreeBuilder::current());
+    else {
+        RenderTreeBuilder builder(*document().renderView());
+        m_buttonText->removeFromParentAndDestroy(builder);
+    }
 }
 
 String RenderButton::text() const
index 3f14e69..5651af4 100644 (file)
@@ -352,7 +352,7 @@ RenderCounter::~RenderCounter()
     // Do not add any code here. Add it to willBeDestroyed() instead.
 }
 
-void RenderCounter::willBeDestroyed()
+void RenderCounter::willBeDestroyed(RenderTreeBuilder& builder)
 {
     view().removeRenderCounter();
 
@@ -361,7 +361,7 @@ void RenderCounter::willBeDestroyed()
         ASSERT(!m_counterNode);
     }
     
-    RenderText::willBeDestroyed();
+    RenderText::willBeDestroyed(builder);
 }
 
 const char* RenderCounter::renderName() const
index 8a90202..db4df7b 100644 (file)
@@ -43,7 +43,7 @@ public:
     void updateCounter();
 
 private:
-    void willBeDestroyed() override;
+    void willBeDestroyed(RenderTreeBuilder&) override;
     
     const char* renderName() const override;
     bool isCounter() const override;
index b740d98..e28155d 100644 (file)
@@ -1050,7 +1050,7 @@ inline void RenderElement::clearSubtreeLayoutRootIfNeeded() const
     view().frameView().layoutContext().clearSubtreeLayoutRoot();
 }
 
-void RenderElement::willBeDestroyed()
+void RenderElement::willBeDestroyed(RenderTreeBuilder& builder)
 {
     if (m_style.hasFixedBackgroundImage() && !settings().fixedBackgroundsPaintRelativeToDocument())
         view().frameView().removeSlowRepaintObject(*this);
@@ -1060,7 +1060,7 @@ void RenderElement::willBeDestroyed()
     if (hasCounterNodeMap())
         RenderCounter::destroyCounterNodes(*this);
 
-    RenderObject::willBeDestroyed();
+    RenderObject::willBeDestroyed(builder);
 
     clearSubtreeLayoutRootIfNeeded();
 
index ceab7c8..afea512 100644 (file)
@@ -260,7 +260,7 @@ protected:
 
     void insertedIntoTree() override;
     void willBeRemovedFromTree() override;
-    void willBeDestroyed() override;
+    void willBeDestroyed(RenderTreeBuilder&) override;
 
     void setRenderInlineAlwaysCreatesLineBoxes(bool b) { m_renderInlineAlwaysCreatesLineBoxes = b; }
     bool renderInlineAlwaysCreatesLineBoxes() const { return m_renderInlineAlwaysCreatesLineBoxes; }
index 000a089..f8869db 100644 (file)
@@ -113,10 +113,10 @@ RenderEmbeddedObject::~RenderEmbeddedObject()
     // Do not add any code here. Add it to willBeDestroyed() instead.
 }
 
-void RenderEmbeddedObject::willBeDestroyed()
+void RenderEmbeddedObject::willBeDestroyed(RenderTreeBuilder& builder)
 {
     view().frameView().removeEmbeddedObjectToUpdate(*this);
-    RenderWidget::willBeDestroyed();
+    RenderWidget::willBeDestroyed(builder);
 }
 
 RenderPtr<RenderEmbeddedObject> RenderEmbeddedObject::createForApplet(HTMLAppletElement& applet, RenderStyle&& style)
index eaab786..50f576f 100644 (file)
@@ -66,7 +66,7 @@ protected:
 
 protected:
     void layout() override;
-    void willBeDestroyed() override;
+    void willBeDestroyed(RenderTreeBuilder&) override;
 
 private:
     const char* renderName() const override { return "RenderEmbeddedObject"; }
index f5a9b8d..8209adf 100644 (file)
@@ -763,10 +763,10 @@ void RenderFragmentedFlow::deleteLines()
     RenderBlockFlow::deleteLines();
 }
 
-void RenderFragmentedFlow::willBeDestroyed()
+void RenderFragmentedFlow::willBeDestroyed(RenderTreeBuilder& builder)
 {
     clearLinesToFragmentMap();
-    RenderBlockFlow::willBeDestroyed();
+    RenderBlockFlow::willBeDestroyed(builder);
 }
 
 void RenderFragmentedFlow::markFragmentsForOverflowLayoutIfNeeded()
index 1eac978..9cf23bc 100644 (file)
@@ -194,7 +194,7 @@ protected:
     virtual LayoutUnit initialLogicalWidth() const { return 0; };
     
     void clearLinesToFragmentMap();
-    void willBeDestroyed() override;
+    void willBeDestroyed(RenderTreeBuilder&) override;
 
     void mapLocalToContainer(const RenderLayerModelObject* repaintContainer, TransformState&, MapCoordinatesFlags, bool* wasFixed) const override;
 
index 8f0352d..84993c0 100644 (file)
@@ -58,14 +58,14 @@ RenderFullScreen::RenderFullScreen(Document& document, RenderStyle&& style)
     setReplaced(false); 
 }
 
-void RenderFullScreen::willBeDestroyed()
+void RenderFullScreen::willBeDestroyed(RenderTreeBuilder& builder)
 {
     if (m_placeholder) {
-        m_placeholder->removeFromParentAndDestroy();
+        m_placeholder->removeFromParentAndDestroy(builder);
         ASSERT(!m_placeholder);
     }
 
-    RenderFlexibleBox::willBeDestroyed();
+    RenderFlexibleBox::willBeDestroyed(builder);
 }
 
 static RenderStyle createFullScreenStyle()
@@ -106,7 +106,7 @@ RenderPtr<RenderFullScreen> RenderFullScreen::wrapNewRenderer(RenderTreeBuilder&
     builder.insertChild(fullscreenRenderer, WTFMove(renderer));
     fullscreenRenderer.setNeedsLayoutAndPrefWidthsRecalc();
 
-    document.setFullScreenRenderer(&fullscreenRenderer);
+    document.setFullScreenRenderer(builder, &fullscreenRenderer);
 
     return newFullscreenRenderer;
 }
@@ -143,7 +143,7 @@ void RenderFullScreen::wrapExistingRenderer(RenderElement& renderer, Document& d
     builder.insertChild(fullscreenRenderer, WTFMove(toMove));
     fullscreenRenderer.setNeedsLayoutAndPrefWidthsRecalc();
 
-    document.setFullScreenRenderer(&fullscreenRenderer);
+    document.setFullScreenRenderer(builder, &fullscreenRenderer);
 }
 
 void RenderFullScreen::unwrapRenderer(bool& requiresRenderTreeRebuild)
@@ -169,7 +169,7 @@ void RenderFullScreen::unwrapRenderer(bool& requiresRenderTreeRebuild)
                 if (auto* nonAnonymousChild = downcast<RenderBlock>(*child).firstChild())
                     child = nonAnonymousChild;
                 else {
-                    child->removeFromParentAndDestroy();
+                    child->removeFromParentAndDestroy(builder);
                     continue;
                 }
             }
@@ -184,10 +184,10 @@ void RenderFullScreen::unwrapRenderer(bool& requiresRenderTreeRebuild)
         }
     }
     if (placeholder())
-        placeholder()->removeFromParentAndDestroy();
+        placeholder()->removeFromParentAndDestroy(builder);
     ASSERT(!placeholder());
 
-    removeFromParentAndDestroy();
+    removeFromParentAndDestroy(builder);
 }
 
 void RenderFullScreen::createPlaceholder(std::unique_ptr<RenderStyle> style, const LayoutRect& frameRect)
index 5f9c129..b36cfa4 100644 (file)
@@ -48,7 +48,7 @@ public:
     
 private:
     bool isRenderFullScreen() const override { return true; }
-    void willBeDestroyed() override;
+    void willBeDestroyed(RenderTreeBuilder&) override;
     bool isFlexibleBoxImpl() const override { return true; }
 
 protected:
index f34ed10..9e73887 100644 (file)
@@ -149,10 +149,10 @@ RenderImage::~RenderImage()
     // Do not add any code here. Add it to willBeDestroyed() instead.
 }
 
-void RenderImage::willBeDestroyed()
+void RenderImage::willBeDestroyed(RenderTreeBuilder& builder)
 {
     imageResource().shutdown();
-    RenderReplaced::willBeDestroyed();
+    RenderReplaced::willBeDestroyed(builder);
 }
 
 // If we'll be displaying either alt text or an image, add some padding.
index 5654310..06e8e1e 100644 (file)
@@ -77,7 +77,7 @@ public:
     bool hasNonBitmapImage() const;
 
 protected:
-    void willBeDestroyed() override;
+    void willBeDestroyed(RenderTreeBuilder&) override;
 
     bool needsPreferredWidthsRecalculation() const final;
     RenderBox* embeddedContentBox() const final;
index e7f5f8b..0754745 100644 (file)
@@ -70,7 +70,7 @@ RenderInline::RenderInline(Document& document, RenderStyle&& style)
     setChildrenInline(true);
 }
 
-void RenderInline::willBeDestroyed()
+void RenderInline::willBeDestroyed(RenderTreeBuilder& builder)
 {
 #if !ASSERT_DISABLED
     // Make sure we do not retain "this" in the continuation outline table map of our containing blocks.
@@ -107,7 +107,7 @@ void RenderInline::willBeDestroyed()
 
     m_lineBoxes.deleteLineBoxes();
 
-    RenderBoxModelObject::willBeDestroyed();
+    RenderBoxModelObject::willBeDestroyed(builder);
 }
 
 void RenderInline::updateFromStyle()
index 7326c76..6f4f9fa 100644 (file)
@@ -97,7 +97,7 @@ public:
     void addChildIgnoringContinuation(RenderTreeBuilder&, RenderPtr<RenderObject> newChild, RenderObject* beforeChild = nullptr) final;
 
 protected:
-    void willBeDestroyed() override;
+    void willBeDestroyed(RenderTreeBuilder&) override;
 
     void styleWillChange(StyleDifference, const RenderStyle& newStyle) override;
     void styleDidChange(StyleDifference, const RenderStyle* oldStyle) override;
index 55b43a6..41ca69d 100644 (file)
@@ -65,7 +65,7 @@ RenderLayerModelObject::~RenderLayerModelObject()
     // Do not add any code here. Add it to willBeDestroyed() instead.
 }
 
-void RenderLayerModelObject::willBeDestroyed()
+void RenderLayerModelObject::willBeDestroyed(RenderTreeBuilder& builder)
 {
     if (isPositioned()) {
         if (style().hasViewportConstrainedPosition())
@@ -77,7 +77,7 @@ void RenderLayerModelObject::willBeDestroyed()
         destroyLayer();
     }
 
-    RenderElement::willBeDestroyed();
+    RenderElement::willBeDestroyed(builder);
     
     clearRepaintLayoutRects();
 }
index e605a48..0d9a76e 100644 (file)
@@ -73,7 +73,7 @@ protected:
     RenderLayerModelObject(Document&, RenderStyle&&, BaseTypeFlags);
 
     void createLayer();
-    void willBeDestroyed() override;
+    void willBeDestroyed(RenderTreeBuilder&) override;
 
 private:
     std::unique_ptr<RenderLayer> m_layer;
index 4c4d9ab..aa917ef 100644 (file)
@@ -104,11 +104,11 @@ RenderListBox::~RenderListBox()
     // Do not add any code here. Add it to willBeDestroyed() instead.
 }
 
-void RenderListBox::willBeDestroyed()
+void RenderListBox::willBeDestroyed(RenderTreeBuilder& builder)
 {
     setHasVerticalScrollbar(false);
     view().frameView().removeScrollableArea(this);
-    RenderBlockFlow::willBeDestroyed();
+    RenderBlockFlow::willBeDestroyed(builder);
 }
 
 HTMLSelectElement& RenderListBox::selectElement() const
index 9d694df..88c4723 100644 (file)
@@ -68,7 +68,7 @@ public:
     bool scrolledToRight() const override;
 
 private:
-    void willBeDestroyed() override;
+    void willBeDestroyed(RenderTreeBuilder&) override;
 
     void element() const = delete;
 
index b354ddd..bc599b4 100644 (file)
@@ -54,11 +54,11 @@ RenderListItem::~RenderListItem()
     // Do not add any code here. Add it to willBeDestroyed() instead.
 }
 
-void RenderListItem::willBeDestroyed()
+void RenderListItem::willBeDestroyed(RenderTreeBuilder& builder)
 {
     if (m_marker)
-        m_marker->removeFromParentAndDestroy();
-    RenderBlockFlow::willBeDestroyed();
+        m_marker->removeFromParentAndDestroy(builder);
+    RenderBlockFlow::willBeDestroyed(builder);
 }
 
 RenderStyle RenderListItem::computeMarkerStyle() const
index e67d640..8398c7b 100644 (file)
@@ -62,7 +62,7 @@ public:
     bool isInReversedOrderedList() const;
 
 private:
-    void willBeDestroyed() final;
+    void willBeDestroyed(RenderTreeBuilder&) final;
 
     const char* renderName() const final { return "RenderListItem"; }
 
index dd18777..61c3c5a 100644 (file)
@@ -1134,11 +1134,11 @@ RenderListMarker::~RenderListMarker()
     // Do not add any code here. Add it to willBeDestroyed() instead.
 }
 
-void RenderListMarker::willBeDestroyed()
+void RenderListMarker::willBeDestroyed(RenderTreeBuilder& builder)
 {
     if (m_image)
         m_image->removeClient(this);
-    RenderBox::willBeDestroyed();
+    RenderBox::willBeDestroyed(builder);
 }
 
 void RenderListMarker::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)
index 13f124f..9278dc2 100644 (file)
@@ -52,7 +52,7 @@ public:
 #endif
 
 private:
-    void willBeDestroyed() override;
+    void willBeDestroyed(RenderTreeBuilder&) override;
 
     void element() const = delete;
 
index 407d2cb..543c7f0 100644 (file)
@@ -89,7 +89,7 @@ RenderMenuList::~RenderMenuList()
     // Do not add any code here. Add it to willBeDestroyed() instead.
 }
 
-void RenderMenuList::willBeDestroyed()
+void RenderMenuList::willBeDestroyed(RenderTreeBuilder& builder)
 {
 #if !PLATFORM(IOS)
     if (m_popup)
@@ -97,7 +97,7 @@ void RenderMenuList::willBeDestroyed()
     m_popup = nullptr;
 #endif
 
-    RenderFlexibleBox::willBeDestroyed();
+    RenderFlexibleBox::willBeDestroyed(builder);
 }
 
 void RenderMenuList::setInnerRenderer(RenderBlock& innerRenderer)
index bdf4471..66feb72 100644 (file)
@@ -63,7 +63,7 @@ public:
     void setInnerRenderer(RenderBlock&);
 
 private:
-    void willBeDestroyed() override;
+    void willBeDestroyed(RenderTreeBuilder&) override;
 
     void element() const = delete;
 
index 7228bb3..5f9cd01 100644 (file)
@@ -255,10 +255,10 @@ void RenderObject::setParent(RenderElement* parent)
     m_parent = parent;
 }
 
-void RenderObject::removeFromParentAndDestroy()
+void RenderObject::removeFromParentAndDestroy(RenderTreeBuilder& builder)
 {
     ASSERT(m_parent);
-    m_parent->removeAndDestroyChild(*RenderTreeBuilder::current(), *this);
+    m_parent->removeAndDestroyChild(builder, *this);
 }
 
 RenderObject* RenderObject::nextInPreOrder() const
@@ -1434,7 +1434,7 @@ bool RenderObject::isSelectionBorder() const
         || view().selection().end() == this;
 }
 
-void RenderObject::willBeDestroyed()
+void RenderObject::willBeDestroyed(RenderTreeBuilder&)
 {
     ASSERT(!m_parent);
     ASSERT(renderTreeBeingDestroyed() || !is<RenderElement>(*this) || !view().frameView().hasSlowRepaintObject(downcast<RenderElement>(*this)));
@@ -1485,7 +1485,7 @@ void RenderObject::destroy()
         downcast<RenderBoxModelObject>(*this).layer()->willBeDestroyed();
 #endif
 
-    willBeDestroyed();
+    willBeDestroyed(*RenderTreeBuilder::current());
 
     if (is<RenderWidget>(*this)) {
         downcast<RenderWidget>(*this).deref();
index ee68bb0..d54c190 100644 (file)
@@ -63,6 +63,7 @@ class RenderLayer;
 class RenderLayerModelObject;
 class RenderFragmentContainer;
 class RenderTheme;
+class RenderTreeBuilder;
 class SelectionRangeData;
 class TransformState;
 class VisiblePosition;
@@ -752,7 +753,7 @@ public:
     void imageChanged(CachedImage*, const IntRect* = nullptr) override;
     virtual void imageChanged(WrappedImagePtr, const IntRect* = nullptr) { }
 
-    void removeFromParentAndDestroy();
+    void removeFromParentAndDestroy(RenderTreeBuilder&);
 
     CSSAnimationController& animation() const;
 
@@ -787,7 +788,7 @@ protected:
 
     void adjustRectForOutlineAndShadow(LayoutRect&) const;
 
-    virtual void willBeDestroyed();
+    virtual void willBeDestroyed(RenderTreeBuilder&);
 
     virtual void insertedIntoTree();
     virtual void willBeRemovedFromTree();
index caddd4e..a7c8d91 100644 (file)
@@ -72,12 +72,12 @@ RenderReplaced::RenderReplaced(Document& document, RenderStyle&& style, const La
 
 RenderReplaced::~RenderReplaced() = default;
 
-void RenderReplaced::willBeDestroyed()
+void RenderReplaced::willBeDestroyed(RenderTreeBuilder& builder)
 {
     if (!renderTreeBeingDestroyed() && parent())
         parent()->dirtyLinesFromChangedChild(*this);
 
-    RenderBox::willBeDestroyed();
+    RenderBox::willBeDestroyed(builder);
 }
 
 void RenderReplaced::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)
index ae5d954..bf69bfc 100644 (file)
@@ -67,7 +67,7 @@ protected:
     bool shouldPaint(PaintInfo&, const LayoutPoint&);
     LayoutRect localSelectionRect(bool checkWhetherSelected = true) const; // This is in local coordinates, but it's a physical rect (so the top left corner is physical top left).
 
-    void willBeDestroyed() override;
+    void willBeDestroyed(RenderTreeBuilder&) override;
 
 private:
     LayoutUnit computeConstrainedLogicalWidth(ShouldComputePreferred) const;
index 7c04a86..8adb248 100644 (file)
@@ -109,7 +109,7 @@ RenderPtr<RenderObject> RenderRubyAsInline::takeChild(RenderTreeBuilder& builder
         ASSERT(child.isBeforeContent() || child.isAfterContent());
         auto& parent = *child.parent();
         auto takenChild = parent.takeChild(builder, child);
-        parent.removeFromParentAndDestroy();
+        parent.removeFromParentAndDestroy(builder);
         return takenChild;
     }
 
@@ -148,7 +148,7 @@ RenderPtr<RenderObject> RenderRubyAsBlock::takeChild(RenderTreeBuilder& builder,
         ASSERT(child.isBeforeContent() || child.isAfterContent());
         auto& parent = *child.parent();
         auto takenChild = parent.takeChild(builder, child);
-        parent.removeFromParentAndDestroy();
+        parent.removeFromParentAndDestroy(builder);
         return takenChild;
     }
 
index 88fd64a..5a8328e 100644 (file)
@@ -64,14 +64,14 @@ RenderSearchField::~RenderSearchField()
     // Do not add any code here. Add it to willBeDestroyed() instead.
 }
 
-void RenderSearchField::willBeDestroyed()
+void RenderSearchField::willBeDestroyed(RenderTreeBuilder& builder)
 {
     if (m_searchPopup) {
         m_searchPopup->popupMenu()->disconnectClient();
         m_searchPopup = nullptr;
     }
 
-    RenderTextControlSingleLine::willBeDestroyed();
+    RenderTextControlSingleLine::willBeDestroyed(builder);
 }
 
 inline HTMLElement* RenderSearchField::resultsButtonElement() const
index 3a841de..233e6ed 100644 (file)
@@ -48,7 +48,7 @@ public:
 private:
     bool isSearchField() const final { return true; }
 
-    void willBeDestroyed() override;
+    void willBeDestroyed(RenderTreeBuilder&) override;
     LayoutUnit computeControlLogicalHeight(LayoutUnit lineHeight, LayoutUnit nonContentHeight) const override;
     void updateFromElement() override;
     EVisibility visibilityForCancelButton() const;
index ee62330..e447221 100644 (file)
@@ -63,12 +63,12 @@ RenderSnapshottedPlugIn::~RenderSnapshottedPlugIn()
     // Do not add any code here. Add it to willBeDestroyed() instead.
 }
 
-void RenderSnapshottedPlugIn::willBeDestroyed()
+void RenderSnapshottedPlugIn::willBeDestroyed(RenderTreeBuilder& builder)
 {
     ASSERT(m_snapshotResource);
     m_snapshotResource->shutdown();
 
-    RenderEmbeddedObject::willBeDestroyed();
+    RenderEmbeddedObject::willBeDestroyed(builder);
 }
 
 HTMLPlugInImageElement& RenderSnapshottedPlugIn::plugInImageElement() const
index a45a31a..5b1be89 100644 (file)
@@ -43,7 +43,7 @@ public:
     void handleEvent(Event&);
 
 private:
-    void willBeDestroyed() override;
+    void willBeDestroyed(RenderTreeBuilder&) override;
     void frameOwnerElement() const = delete;
     const char* renderName() const final { return "RenderSnapshottedPlugIn"; }
     CursorDirective getCursor(const LayoutPoint&, Cursor&) const final;
index 6ae047c..51c2fbe 100644 (file)
@@ -287,7 +287,7 @@ void RenderText::removeAndDestroyTextBoxes()
     m_lineBoxes.deleteAll();
 }
 
-void RenderText::willBeDestroyed()
+void RenderText::willBeDestroyed(RenderTreeBuilder& builder)
 {
     secureTextTimers().remove(this);
 
@@ -298,7 +298,7 @@ void RenderText::willBeDestroyed()
 
     setInlineWrapperForDisplayContents(nullptr);
 
-    RenderObject::willBeDestroyed();
+    RenderObject::willBeDestroyed(builder);
 }
 
 void RenderText::deleteLineBoxesBeforeSimpleLineLayout()
index f46290f..c246318 100644 (file)
@@ -183,7 +183,7 @@ public:
 
 protected:
     virtual void computePreferredLogicalWidths(float leadWidth);
-    void willBeDestroyed() override;
+    void willBeDestroyed(RenderTreeBuilder&) override;
 
     virtual void setRenderedText(const String&);
     virtual UChar previousCharacter() const;
index 526385c..7e025ea 100644 (file)
@@ -45,12 +45,12 @@ RenderTextControlMultiLine::~RenderTextControlMultiLine()
     // Do not add any code here. Add it to willBeDestroyed() instead.
 }
 
-void RenderTextControlMultiLine::willBeDestroyed()
+void RenderTextControlMultiLine::willBeDestroyed(RenderTreeBuilder& builder)
 {
     if (textAreaElement().isConnected())
         textAreaElement().rendererWillBeDestroyed();
 
-    RenderTextControl::willBeDestroyed();
+    RenderTextControl::willBeDestroyed(builder);
 }
 
 HTMLTextAreaElement& RenderTextControlMultiLine::textAreaElement() const
index 721af9f..19608ef 100644 (file)
@@ -35,7 +35,7 @@ public:
     HTMLTextAreaElement& textAreaElement() const;
 
 private:
-    void willBeDestroyed() override;
+    void willBeDestroyed(RenderTreeBuilder&) override;
     void element() const = delete;
 
     bool isTextArea() const override { return true; }
index dd9acc7..0169adc 100644 (file)
@@ -26,6 +26,7 @@
 #include "RenderBlock.h"
 #include "RenderIterator.h"
 #include "RenderMultiColumnFlow.h"
+#include "RenderTreeBuilder.h"
 #include "Text.h"
 #include <wtf/IsoMallocInlines.h>
 
@@ -73,11 +74,11 @@ void RenderTextFragment::styleDidChange(StyleDifference diff, const RenderStyle*
         block->mutableStyle().removeCachedPseudoStyle(FIRST_LETTER);
 }
 
-void RenderTextFragment::willBeDestroyed()
+void RenderTextFragment::willBeDestroyed(RenderTreeBuilder& builder)
 {
     if (m_firstLetter)
-        m_firstLetter->removeFromParentAndDestroy();
-    RenderText::willBeDestroyed();
+        m_firstLetter->removeFromParentAndDestroy(builder);
+    RenderText::willBeDestroyed(builder);
 }
 
 void RenderTextFragment::setText(const String& newText, bool force)
@@ -87,7 +88,12 @@ void RenderTextFragment::setText(const String& newText, bool force)
     m_end = text().length();
     if (!m_firstLetter)
         return;
-    m_firstLetter->removeFromParentAndDestroy();
+    if (RenderTreeBuilder::current())
+        m_firstLetter->removeFromParentAndDestroy(*RenderTreeBuilder::current());
+    else {
+        RenderTreeBuilder builder(*document().renderView());
+        m_firstLetter->removeFromParentAndDestroy(builder);
+    }
     ASSERT(!m_firstLetter);
     ASSERT(!textNode() || textNode()->renderer() == this);
 }
index 47ba069..b5d59d9 100644 (file)
@@ -60,7 +60,7 @@ public:
 private:
     bool isTextFragment() const override { return true; }
     void styleDidChange(StyleDifference, const RenderStyle* oldStyle) override;
-    void willBeDestroyed() override;
+    void willBeDestroyed(RenderTreeBuilder&) override;
 
     UChar previousCharacter() const override;
 
index 0289205..6410652 100644 (file)
@@ -62,12 +62,12 @@ RenderVideo::~RenderVideo()
     // Do not add any code here. Add it to willBeDestroyed() instead.
 }
 
-void RenderVideo::willBeDestroyed()
+void RenderVideo::willBeDestroyed(RenderTreeBuilder& builder)
 {
     if (auto player = videoElement().player())
         player->setVisible(false);
 
-    RenderMedia::willBeDestroyed();
+    RenderMedia::willBeDestroyed(builder);
 }
 
 void RenderVideo::visibleInViewportStateChanged()
index 8e25c68..d234f4b 100644 (file)
@@ -54,7 +54,7 @@ public:
     void updateFromElement() final;
 
 private:
-    void willBeDestroyed() override;
+    void willBeDestroyed(RenderTreeBuilder&) override;
     void mediaElement() const = delete;
 
     void intrinsicSizeChanged() final;
index 59416ba..f7b7ca8 100644 (file)
@@ -611,9 +611,9 @@ bool RenderView::isScrollableOrRubberbandableBox() const
     return frameView().isScrollable(defineScrollable);
 }
 
-void RenderView::willBeDestroyed()
+void RenderView::willBeDestroyed(RenderTreeBuilder& builder)
 {
-    RenderBlockFlow::willBeDestroyed();
+    RenderBlockFlow::willBeDestroyed(builder);
     // FIXME: This is a workaround for leftover content (see webkit.org/b/182547).
     if (firstChild()) {
         RenderTreeBuilder builder(*this);
index 9c5bb98..6d23f0e 100644 (file)
@@ -214,7 +214,7 @@ private:
 
     bool isScrollableOrRubberbandableBox() const override;
 
-    void willBeDestroyed() override;
+    void willBeDestroyed(RenderTreeBuilder&) override;
 
 private:
     FrameView& m_frameView;
index a2ecd08..4f72d14 100644 (file)
@@ -88,7 +88,7 @@ RenderWidget::RenderWidget(HTMLFrameOwnerElement& element, RenderStyle&& style)
     setInline(false);
 }
 
-void RenderWidget::willBeDestroyed()
+void RenderWidget::willBeDestroyed(RenderTreeBuilder& builder)
 {
 #if PLATFORM(IOS)
     if (hasLayer())
@@ -102,7 +102,7 @@ void RenderWidget::willBeDestroyed()
 
     setWidget(nullptr);
 
-    RenderReplaced::willBeDestroyed();
+    RenderReplaced::willBeDestroyed(builder);
 }
 
 RenderWidget::~RenderWidget()
index 8ae3d2c..78aed3f 100644 (file)
@@ -77,7 +77,7 @@ public:
 protected:
     RenderWidget(HTMLFrameOwnerElement&, RenderStyle&&);
 
-    void willBeDestroyed() override;
+    void willBeDestroyed(RenderTreeBuilder&) override;
     void styleDidChange(StyleDifference, const RenderStyle* oldStyle) final;
     void layout() override;
     void paint(PaintInfo&, const LayoutPoint&) override;
index b011675..335556d 100644 (file)
@@ -71,10 +71,10 @@ void RenderSVGBlock::absoluteRects(Vector<IntRect>&, const LayoutPoint&) const
     ASSERT_NOT_REACHED();
 }
 
-void RenderSVGBlock::willBeDestroyed()
+void RenderSVGBlock::willBeDestroyed(RenderTreeBuilder& builder)
 {
     SVGResourcesCache::clientDestroyed(*this);
-    RenderBlockFlow::willBeDestroyed();
+    RenderBlockFlow::willBeDestroyed(builder);
 }
 
 void RenderSVGBlock::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)
index fedba66..d4e6b12 100644 (file)
@@ -35,7 +35,7 @@ public:
 
 protected:
     RenderSVGBlock(SVGGraphicsElement&, RenderStyle&&);
-    void willBeDestroyed() override;
+    void willBeDestroyed(RenderTreeBuilder&) override;
 
 private:
     void element() const = delete;
index 94eefe8..2d39eb4 100644 (file)
@@ -57,10 +57,10 @@ RenderSVGImage::RenderSVGImage(SVGImageElement& element, RenderStyle&& style)
 
 RenderSVGImage::~RenderSVGImage() = default;
 
-void RenderSVGImage::willBeDestroyed()
+void RenderSVGImage::willBeDestroyed(RenderTreeBuilder& builder)
 {
     imageResource().shutdown();
-    RenderSVGModelObject::willBeDestroyed();
+    RenderSVGModelObject::willBeDestroyed(builder);
 }
 
 SVGImageElement& RenderSVGImage::imageElement() const
index a227c16..bc4ed71 100644 (file)
@@ -52,7 +52,7 @@ public:
     void paintForeground(PaintInfo&);
 
 private:
-    void willBeDestroyed() override;
+    void willBeDestroyed(RenderTreeBuilder&) override;
 
     void element() const = delete;
 
index dde4fdb..77f5add 100644 (file)
@@ -101,10 +101,10 @@ void RenderSVGInline::absoluteQuads(Vector<FloatQuad>& quads, bool* wasFixed) co
         quads.append(localToAbsoluteQuad(FloatRect(textBoundingBox.x() + box->x(), textBoundingBox.y() + box->y(), box->logicalWidth(), box->logicalHeight()), UseTransforms, wasFixed));
 }
 
-void RenderSVGInline::willBeDestroyed()
+void RenderSVGInline::willBeDestroyed(RenderTreeBuilder& builder)
 {
     SVGResourcesCache::clientDestroyed(*this);
-    RenderInline::willBeDestroyed();
+    RenderInline::willBeDestroyed(builder);
 }
 
 void RenderSVGInline::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)
index 979a82e..b12c7f9 100644 (file)
@@ -58,7 +58,7 @@ private:
 
     std::unique_ptr<InlineFlowBox> createInlineFlowBox() final;
 
-    void willBeDestroyed() final;
+    void willBeDestroyed(RenderTreeBuilder&) final;
     void styleDidChange(StyleDifference, const RenderStyle* oldStyle) final;
 
     void addChild(RenderTreeBuilder&, RenderPtr<RenderObject> child, RenderObject* beforeChild = nullptr) final;
index 92ab653..13e2c88 100644 (file)
@@ -92,10 +92,10 @@ void RenderSVGModelObject::absoluteQuads(Vector<FloatQuad>& quads, bool* wasFixe
     quads.append(localToAbsoluteQuad(strokeBoundingBox(), UseTransforms, wasFixed));
 }
 
-void RenderSVGModelObject::willBeDestroyed()
+void RenderSVGModelObject::willBeDestroyed(RenderTreeBuilder& builder)
 {
     SVGResourcesCache::clientDestroyed(*this);
-    RenderElement::willBeDestroyed();
+    RenderElement::willBeDestroyed(builder);
 }
 
 void RenderSVGModelObject::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)
index 8e3a0e1..899d969 100644 (file)
@@ -69,7 +69,7 @@ public:
 protected:
     RenderSVGModelObject(SVGElement&, RenderStyle&&);
 
-    void willBeDestroyed() override;
+    void willBeDestroyed(RenderTreeBuilder&) override;
 
 private:
     bool isRenderSVGModelObject() const final { return true; }
index 014494b..20749d7 100644 (file)
@@ -55,7 +55,7 @@ void RenderSVGResourceContainer::layout()
     RenderSVGHiddenContainer::layout();
 }
 
-void RenderSVGResourceContainer::willBeDestroyed()
+void RenderSVGResourceContainer::willBeDestroyed(RenderTreeBuilder& builder)
 {
     SVGResourcesCache::resourceDestroyed(*this);
 
@@ -64,7 +64,7 @@ void RenderSVGResourceContainer::willBeDestroyed()
         m_registered = false;
     }
 
-    RenderSVGHiddenContainer::willBeDestroyed();
+    RenderSVGHiddenContainer::willBeDestroyed(builder);
 }
 
 void RenderSVGResourceContainer::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)
index f637b71..bfe430d 100644 (file)
@@ -67,7 +67,7 @@ private:
     void addClient(RenderElement&);
     void removeClient(RenderElement&);
 
-    void willBeDestroyed() final;
+    void willBeDestroyed(RenderTreeBuilder&) final;
     void registerResource();
 
     AtomicString m_id;
index d0c192d..565db3e 100644 (file)
@@ -270,12 +270,12 @@ void RenderSVGRoot::paintReplaced(PaintInfo& paintInfo, const LayoutPoint& paint
     childPaintInfo.context().restore();
 }
 
-void RenderSVGRoot::willBeDestroyed()
+void RenderSVGRoot::willBeDestroyed(RenderTreeBuilder& builder)
 {
     RenderBlock::removePercentHeightDescendant(const_cast<RenderSVGRoot&>(*this));
 
     SVGResourcesCache::clientDestroyed(*this);
-    RenderReplaced::willBeDestroyed();
+    RenderReplaced::willBeDestroyed(builder);
 }
 
 void RenderSVGRoot::insertedIntoTree()
index 786707a..d205caf 100644 (file)
@@ -76,7 +76,7 @@ private:
     void layout() override;
     void paintReplaced(PaintInfo&, const LayoutPoint&) override;
 
-    void willBeDestroyed() override;
+    void willBeDestroyed(RenderTreeBuilder&) override;
 
     void insertedIntoTree() override;
     void willBeRemovedFromTree() override;
index b431d6c..100da75 100644 (file)
@@ -225,12 +225,12 @@ static inline void checkLayoutAttributesConsistency(RenderSVGText* text, Vector<
 #endif
 }
 
-void RenderSVGText::willBeDestroyed()
+void RenderSVGText::willBeDestroyed(RenderTreeBuilder& builder)
 {
     m_layoutAttributes.clear();
     m_layoutAttributesBuilder.clearTextPositioningElements();
 
-    RenderSVGBlock::willBeDestroyed();
+    RenderSVGBlock::willBeDestroyed(builder);
 }
 
 void RenderSVGText::subtreeChildWillBeRemoved(RenderObject* child, Vector<SVGTextLayoutAttributes*, 2>& affectedAttributes)
index 127290a..c38767a 100644 (file)
@@ -85,7 +85,7 @@ private:
     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() override;
+    void willBeDestroyed(RenderTreeBuilder&) override;
 
     const AffineTransform& localToParentTransform() const override { return m_localTransform; }
     AffineTransform localTransform() const override { return m_localTransform; }
index 4d05d37..1024cd9 100644 (file)
@@ -385,7 +385,7 @@ void RenderTreeBuilder::removeFromParentAndDestroyCleaningUpAnonymousWrappers(Re
 {
     // If the tree is destroyed, there is no need for a clean-up phase.
     if (child.renderTreeBeingDestroyed()) {
-        child.removeFromParentAndDestroy();
+        child.removeFromParentAndDestroy(*this);
         return;
     }
 
index b008c5a..3c196c6 100644 (file)
@@ -80,7 +80,7 @@ void RenderTreeBuilder::List::updateItemMarker(RenderListItem& listItemRenderer)
 
     if (style.listStyleType() == NoneListStyle && (!style.listStyleImage() || style.listStyleImage()->errorOccurred())) {
         if (auto* marker = listItemRenderer.markerRenderer())
-            marker->removeFromParentAndDestroy();
+            marker->removeFromParentAndDestroy(m_builder);
         return;
     }
 
@@ -121,7 +121,7 @@ void RenderTreeBuilder::List::updateItemMarker(RenderListItem& listItemRenderer)
 
     // 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();
+        currentParent->removeFromParentAndDestroy(m_builder);
 }
 
 }
index d7fc349..b21b67f 100644 (file)
@@ -211,11 +211,11 @@ void RenderTreeBuilder::MultiColumn::destroyFragmentedFlow(RenderBlockFlow& flow
         parentAndSpannerList.append(std::make_pair(spannerOriginalParent, spanner->parent()->takeChild(m_builder, *spanner)));
     }
     while (auto* columnSet = multiColumnFlow.firstMultiColumnSet())
-        columnSet->removeFromParentAndDestroy();
+        columnSet->removeFromParentAndDestroy(m_builder);
 
     flow.clearMultiColumnFlow();
     multiColumnFlow.moveAllChildrenTo(m_builder, &flow, RenderBoxModelObject::NormalizeAfterInsertion::Yes);
-    multiColumnFlow.removeFromParentAndDestroy();
+    multiColumnFlow.removeFromParentAndDestroy(m_builder);
     for (auto& parentAndSpanner : parentAndSpannerList)
         m_builder.insertChild(*parentAndSpanner.first, WTFMove(parentAndSpanner.second));
 }
@@ -371,13 +371,13 @@ void RenderTreeBuilder::MultiColumn::handleSpannerRemoval(RenderMultiColumnFlow&
 {
     // 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();
+        placeholder->removeFromParentAndDestroy(m_builder);
 
     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();
+                next->removeFromParentAndDestroy(m_builder);
                 previous->setNeedsLayout();
             }
         }
index 407b8cf..8544d86 100644 (file)
@@ -157,7 +157,7 @@ void RenderTreeBuilder::Ruby::moveBlockChildren(RenderRubyBase& from, RenderRuby
         auto* anonBlockThere = downcast<RenderBlock>(lastChildThere);
         anonBlockHere->moveAllChildrenTo(m_builder, anonBlockThere, RenderBoxModelObject::NormalizeAfterInsertion::Yes);
         anonBlockHere->deleteLines();
-        anonBlockHere->removeFromParentAndDestroy();
+        anonBlockHere->removeFromParentAndDestroy(m_builder);
     }
     // Move all remaining children normally.
     from.moveChildrenTo(m_builder, &to, from.firstChild(), beforeChild, RenderBoxModelObject::NormalizeAfterInsertion::No);