Generalize dirtying of parent's line boxes when taking a renderer out of tree.
authorakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 29 Oct 2014 23:02:10 +0000 (23:02 +0000)
committerakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 29 Oct 2014 23:02:10 +0000 (23:02 +0000)
<https://webkit.org/b/138152>

Reviewed by Antti Koivisto.

Instead of calling dirtyLinesFromChangedChild() when certain types of renderers
are about to be destroyed, always do this in RenderElement::willBeRemovedFromTree().

This is part of an effort to make render tree teardown less incomprehensible.

We still don't bother at all if we're in the process of tearing down the entire
render tree, since that would be a waste of time.

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::willBeDestroyed):
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::willBeDestroyed):
* rendering/RenderElement.cpp:
(WebCore::RenderElement::willBeRemovedFromTree):
* rendering/RenderInline.cpp:
(WebCore::RenderInline::willBeDestroyed):
* rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::willBeDestroyed): Deleted.
* rendering/RenderReplaced.h:

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

Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderBlock.cpp
Source/WebCore/rendering/RenderBlockFlow.cpp
Source/WebCore/rendering/RenderElement.cpp
Source/WebCore/rendering/RenderInline.cpp
Source/WebCore/rendering/RenderReplaced.cpp
Source/WebCore/rendering/RenderReplaced.h

index 232e444..7c71f21 100644 (file)
@@ -1,3 +1,30 @@
+2014-10-29  Andreas Kling  <akling@apple.com>
+
+        Generalize dirtying of parent's line boxes when taking a renderer out of tree.
+        <https://webkit.org/b/138152>
+
+        Reviewed by Antti Koivisto.
+
+        Instead of calling dirtyLinesFromChangedChild() when certain types of renderers
+        are about to be destroyed, always do this in RenderElement::willBeRemovedFromTree().
+
+        This is part of an effort to make render tree teardown less incomprehensible.
+
+        We still don't bother at all if we're in the process of tearing down the entire
+        render tree, since that would be a waste of time.
+
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::willBeDestroyed):
+        * rendering/RenderBlockFlow.cpp:
+        (WebCore::RenderBlockFlow::willBeDestroyed):
+        * rendering/RenderElement.cpp:
+        (WebCore::RenderElement::willBeRemovedFromTree):
+        * rendering/RenderInline.cpp:
+        (WebCore::RenderInline::willBeDestroyed):
+        * rendering/RenderReplaced.cpp:
+        (WebCore::RenderReplaced::willBeDestroyed): Deleted.
+        * rendering/RenderReplaced.h:
+
 2014-10-28  Ada Chan  <adachan@apple.com>
 
         Implement WKPageSetMuted(bool).
index 0db30ed..9a81fb6 100644 (file)
@@ -242,11 +242,6 @@ void RenderBlock::willBeDestroyed()
     // properly dirty line boxes that they are removed from. Effects that do :before/:after only on hover could crash otherwise.
     destroyLeftoverChildren();
 
-    if (!documentBeingDestroyed()) {
-        if (parent())
-            parent()->dirtyLinesFromChangedChild(*this);
-    }
-
     removeFromUpdateScrollInfoAfterLayoutTransaction();
 
     RenderBox::willBeDestroyed();
index 7e8dfb2..041acf7 100644 (file)
@@ -166,8 +166,7 @@ void RenderBlockFlow::willBeDestroyed()
                         childBox->removeFromParent();
                 }
             }
-        } else if (parent())
-            parent()->dirtyLinesFromChangedChild(*this);
+        }
     }
 
     m_lineBoxes.deleteLineBoxes();
index 485a470..f1a2870 100644 (file)
@@ -1041,7 +1041,7 @@ void RenderElement::willBeRemovedFromTree()
     if (m_style->hasFixedBackgroundImage() && !frame().settings().fixedBackgroundsPaintRelativeToDocument())
         view().frameView().removeSlowRepaintObject(this);
 
-    if (isOutOfFlowPositioned() && parent()->childrenInline())
+    if (!documentBeingDestroyed())
         parent()->dirtyLinesFromChangedChild(*this);
 
     if (auto* containerFlowThread = parent()->renderNamedFlowThreadWrapper())
index f806472..52c909d 100644 (file)
@@ -98,8 +98,7 @@ void RenderInline::willBeDestroyed()
                 for (auto box = firstLineBox(); box; box = box->nextLineBox())
                     box->removeFromParent();
             }
-        } else if (parent()) 
-            parent()->dirtyLinesFromChangedChild(*this);
+        }
     }
 
     m_lineBoxes.deleteLineBoxes();
index b27df2c..f27f78e 100644 (file)
@@ -71,14 +71,6 @@ RenderReplaced::~RenderReplaced()
 {
 }
 
-void RenderReplaced::willBeDestroyed()
-{
-    if (!documentBeingDestroyed() && parent())
-        parent()->dirtyLinesFromChangedChild(*this);
-
-    RenderBox::willBeDestroyed();
-}
-
 void RenderReplaced::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)
 {
     RenderBox::styleDidChange(diff, oldStyle);
index 2e7826c..3faa889 100644 (file)
@@ -43,8 +43,6 @@ protected:
     RenderReplaced(Element&, PassRef<RenderStyle>, const LayoutSize& intrinsicSize);
     RenderReplaced(Document&, PassRef<RenderStyle>, const LayoutSize& intrinsicSize);
 
-    virtual void willBeDestroyed() override;
-
     virtual void layout() override;
 
     virtual LayoutSize intrinsicSize() const override final { return m_intrinsicSize; }