Title: [102360] trunk/Source/WebCore
Revision
102360
Author
kl...@webkit.org
Date
2011-12-08 12:01:12 -0800 (Thu, 08 Dec 2011)

Log Message

Optimize RenderObject::containingBlock().
<http://webkit.org/b/74109>

Reviewed by David Hyatt.

When climbing the parent chain to locate the containing block-level element,
use !isRenderBlock() to reject renderers rather than checking against an arbitrary
list of non-block renderers and then rejecting anything that isn't a block anyway.

RenderObject::containingBlock() was very hot (2.0%) when scrolling on youtube.com.
This change takes it down to 1.0% (60% of which is RenderObject::isRenderBlock().)

* rendering/RenderObject.cpp:
(WebCore::RenderObject::containingBlock):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (102359 => 102360)


--- trunk/Source/WebCore/ChangeLog	2011-12-08 19:39:57 UTC (rev 102359)
+++ trunk/Source/WebCore/ChangeLog	2011-12-08 20:01:12 UTC (rev 102360)
@@ -1,3 +1,20 @@
+2011-12-08  Andreas Kling  <kl...@webkit.org>
+
+        Optimize RenderObject::containingBlock().
+        <http://webkit.org/b/74109>
+
+        Reviewed by David Hyatt.
+
+        When climbing the parent chain to locate the containing block-level element,
+        use !isRenderBlock() to reject renderers rather than checking against an arbitrary
+        list of non-block renderers and then rejecting anything that isn't a block anyway.
+
+        RenderObject::containingBlock() was very hot (2.0%) when scrolling on youtube.com.
+        This change takes it down to 1.0% (60% of which is RenderObject::isRenderBlock().)
+
+        * rendering/RenderObject.cpp:
+        (WebCore::RenderObject::containingBlock):
+
 2011-12-08  Nayan Kumar K  <naya...@motorola.com>
 
         Define DEBUG_GL_COMMANDS only in debug builds.

Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (102359 => 102360)


--- trunk/Source/WebCore/rendering/RenderObject.cpp	2011-12-08 19:39:57 UTC (rev 102359)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp	2011-12-08 20:01:12 UTC (rev 102360)
@@ -736,12 +736,7 @@
             o = o->parent();
         }
     } else {
-        while (o && ((o->isInline() && !o->isReplaced()) || o->isTableRow() || o->isTableSection()
-                     || o->isTableCol() || o->isFrameSet() || o->isMedia()
-#if ENABLE(SVG)
-                     || o->isSVGContainer() || o->isSVGRoot()
-#endif
-                     ))
+        while (o && ((o->isInline() && !o->isReplaced()) || !o->isRenderBlock()))
             o = o->parent();
     }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to