[RenderTreeBuilder] Remove redundant RenderTreeBuilder instance
authorzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 12 Feb 2018 20:12:35 +0000 (20:12 +0000)
committerzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 12 Feb 2018 20:12:35 +0000 (20:12 +0000)
https://bugs.webkit.org/show_bug.cgi?id=182700
<rdar://problem/37463958>

Reviewed by Antti Koivisto.

* rendering/RenderView.cpp:
(WebCore::RenderView::willBeDestroyed):

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

Source/WebCore/ChangeLog
Source/WebCore/dom/Document.cpp
Source/WebCore/rendering/RenderView.cpp

index a211f72..abae70b 100644 (file)
@@ -1,3 +1,14 @@
+2018-02-12  Zalan Bujtas  <zalan@apple.com>
+
+        [RenderTreeBuilder] Remove redundant RenderTreeBuilder instance
+        https://bugs.webkit.org/show_bug.cgi?id=182700
+        <rdar://problem/37463958>
+
+        Reviewed by Antti Koivisto.
+
+        * rendering/RenderView.cpp:
+        (WebCore::RenderView::willBeDestroyed):
+
 2018-02-12  Chris Fleizach  <cfleizach@apple.com>
 
         AX: defer focusedUIElement notifications
index 020077c..fec9ff9 100644 (file)
@@ -2315,7 +2315,10 @@ void Document::destroyRenderTree()
     unscheduleStyleRecalc();
 
     // FIXME: RenderObject::view() uses m_renderView and we can't null it before destruction is completed
-    m_renderView->destroy();
+    {
+        RenderTreeBuilder builder(*m_renderView);
+        m_renderView->destroy();
+    }
     m_renderView.release();
 
     Node::setRenderer(nullptr);
index f7b7ca8..1377b9d 100644 (file)
@@ -615,11 +615,8 @@ void RenderView::willBeDestroyed(RenderTreeBuilder& builder)
 {
     RenderBlockFlow::willBeDestroyed(builder);
     // FIXME: This is a workaround for leftover content (see webkit.org/b/182547).
-    if (firstChild()) {
-        RenderTreeBuilder builder(*this);
-        while (firstChild())
-            removeAndDestroyChild(builder, *firstChild());
-    }
+    while (firstChild())
+        removeAndDestroyChild(builder, *firstChild());
 
     ASSERT_WITH_MESSAGE(m_rendererCount == 1, "All other renderers in this render tree should have been destroyed");
 }