Title: [135034] trunk/Source/WebCore
Revision
135034
Author
simon.fra...@apple.com
Date
2012-11-16 21:16:04 -0800 (Fri, 16 Nov 2012)

Log Message

Avoid calling the virtual isBlockFlow() in RenderBox::computeRectForRepaint()
https://bugs.webkit.org/show_bug.cgi?id=102581

Reviewed by Dan Bernstein.

isBlockFlow() is a virtual function call, and shows up in profiles of
Facebook pages as called from RenderBox::computeRectForRepaint().

It's faster to do the hasColumns() bit-check first. Also replace
a call to layer() with the hasLayer() bit-check.

* rendering/RenderBox.cpp:
(WebCore::RenderBox::computeRectForRepaint):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (135033 => 135034)


--- trunk/Source/WebCore/ChangeLog	2012-11-17 04:42:20 UTC (rev 135033)
+++ trunk/Source/WebCore/ChangeLog	2012-11-17 05:16:04 UTC (rev 135034)
@@ -1,3 +1,19 @@
+2012-11-16  Simon Fraser  <simon.fra...@apple.com>
+
+        Avoid calling the virtual isBlockFlow() in RenderBox::computeRectForRepaint()
+        https://bugs.webkit.org/show_bug.cgi?id=102581
+
+        Reviewed by Dan Bernstein.
+
+        isBlockFlow() is a virtual function call, and shows up in profiles of
+        Facebook pages as called from RenderBox::computeRectForRepaint().
+        
+        It's faster to do the hasColumns() bit-check first. Also replace
+        a call to layer() with the hasLayer() bit-check.        
+
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::computeRectForRepaint):
+
 2012-11-16  Sheriff Bot  <webkit.review....@gmail.com>
 
         Unreviewed, rolling out r134817.

Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (135033 => 135034)


--- trunk/Source/WebCore/rendering/RenderBox.cpp	2012-11-17 04:42:20 UTC (rev 135033)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp	2012-11-17 05:16:04 UTC (rev 135034)
@@ -1596,7 +1596,7 @@
 
     // We are now in our parent container's coordinate space.  Apply our transform to obtain a bounding box
     // in the parent's coordinate space that encloses us.
-    if (layer() && layer()->transform()) {
+    if (hasLayer() && layer()->transform()) {
         fixed = position == FixedPosition;
         rect = layer()->transform()->mapRect(pixelSnappedIntRect(rect));
         topLeft = rect.location();
@@ -1614,14 +1614,11 @@
         topLeft += layer()->offsetForInFlowPosition();
     }
     
-    if (o->isBlockFlow() && position != AbsolutePosition && position != FixedPosition) {
-        RenderBlock* cb = toRenderBlock(o);
-        if (cb->hasColumns()) {
-            LayoutRect repaintRect(topLeft, rect.size());
-            cb->adjustRectForColumns(repaintRect);
-            topLeft = repaintRect.location();
-            rect = repaintRect;
-        }
+    if (position != AbsolutePosition && position != FixedPosition && o->hasColumns() && o->isBlockFlow()) {
+        LayoutRect repaintRect(topLeft, rect.size());
+        toRenderBlock(o)->adjustRectForColumns(repaintRect);
+        topLeft = repaintRect.location();
+        rect = repaintRect;
     }
 
     // FIXME: We ignore the lightweight clipping rect that controls use, since if |o| is in mid-layout,
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to