2008-05-25 Maciej Stachowiak <mjs@apple.com>
authormjs@apple.com <mjs@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 25 May 2008 23:23:25 +0000 (23:23 +0000)
committermjs@apple.com <mjs@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 25 May 2008 23:23:25 +0000 (23:23 +0000)
        Reviewed by Darin.

        - don't repaint nodes that are removed before layout
        4.3% speedup on Acid3 test 26

        Mitz points out the new flag can also be used to optimize other
        cases of needless repaint such as
        <https://bugs.webkit.org/show_bug.cgi?id=15129>.

        * rendering/RenderContainer.cpp:
        (WebCore::RenderContainer::removeChildNode): If the child has never had a layout,
        don't bother to repaint it, since there's nothing to dirty.
        * rendering/RenderObject.cpp:
        (WebCore::RenderObject::RenderObject): Initialize m_everHadLayout to false.
        (WebCore::RenderObject::setNeedsLayout): Set m_everHadLayout to true if we
        are being marked as not needing layout.
        * rendering/RenderObject.h:

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

WebCore/ChangeLog
WebCore/rendering/RenderContainer.cpp
WebCore/rendering/RenderObject.cpp
WebCore/rendering/RenderObject.h

index 73653d2f2a7faf33c200c5440879f610c43549e6..da6a3d5087c1d93c28c608959ef2dcb2bc9ee466 100644 (file)
@@ -1,3 +1,23 @@
+2008-05-25  Maciej Stachowiak  <mjs@apple.com>
+
+        Reviewed by Darin.
+
+        - don't repaint nodes that are removed before layout
+        4.3% speedup on Acid3 test 26
+
+        Mitz points out the new flag can also be used to optimize other
+        cases of needless repaint such as
+        <https://bugs.webkit.org/show_bug.cgi?id=15129>.
+        
+        * rendering/RenderContainer.cpp:
+        (WebCore::RenderContainer::removeChildNode): If the child has never had a layout,
+        don't bother to repaint it, since there's nothing to dirty.
+        * rendering/RenderObject.cpp:
+        (WebCore::RenderObject::RenderObject): Initialize m_everHadLayout to false.
+        (WebCore::RenderObject::setNeedsLayout): Set m_everHadLayout to true if we
+        are being marked as not needing layout.
+        * rendering/RenderObject.h:
+
 2008-05-25  Dan Bernstein  <mitz@apple.com>
 
         Reviewed by Darin Adler.
index 3cf14268db9acae3f74c53846a289c33ebe7000b..6e8bb15c839db60cfd487e92c073258644323bad 100644 (file)
@@ -140,7 +140,7 @@ RenderObject* RenderContainer::removeChildNode(RenderObject* oldChild, bool full
     // So that we'll get the appropriate dirty bit set (either that a normal flow child got yanked or
     // that a positioned child got yanked).  We also repaint, so that the area exposed when the child
     // disappears gets repainted properly.
-    if (!documentBeingDestroyed() && fullRemove) {
+    if (!documentBeingDestroyed() && fullRemove && oldChild->m_everHadLayout) {
         oldChild->setNeedsLayoutAndPrefWidthsRecalc();
         oldChild->repaint();
     }
index c61bd99e7a02727c50853d3fdf2ad93e5bd66827..8fda122d4bc524bc6b16554a9dc37c88dc1fbb47 100644 (file)
@@ -197,6 +197,7 @@ RenderObject::RenderObject(Node* node)
     , m_hasReflection(false)
     , m_hasOverrideSize(false)
     , m_hasCounterNodeMap(false)
+    , m_everHadLayout(false)
 {
 #ifndef NDEBUG
     ++RenderObjectCounter::count;
@@ -699,6 +700,7 @@ void RenderObject::setNeedsLayout(bool b, bool markParents)
                 layer()->setNeedsFullRepaint();
         }
     } else {
+        m_everHadLayout = true;
         m_posChildNeedsLayout = false;
         m_normalChildNeedsLayout = false;
         m_needsPositionedMovementLayout = false;
index 9f8834bc64dac21bafb1e5ac48fcc1b91035ae3b..d9f648942a8f69fc97b6d0243b0f8761f851b4cd 100644 (file)
@@ -954,6 +954,7 @@ private:
     
 public:
     bool m_hasCounterNodeMap         : 1;
+    bool m_everHadLayout             : 1;
 };
 
 } // namespace WebCore