Title: [130710] trunk/Source/WebCore
Revision
130710
Author
e...@webkit.org
Date
2012-10-08 18:39:20 -0700 (Mon, 08 Oct 2012)

Log Message

Inline logicalHeightForRowSizing to shave another 2-3% off robohornet's resizecol.html
https://bugs.webkit.org/show_bug.cgi?id=98703

Reviewed by Emil A Eklund.

This is very small potatoes.  There are much bigger wins for table layout yet, but
this was an easy win.

This function should probably be converted to use int's only, as table cells are pixel-sized
according to our subpixel-experts.

Also, I suspect there should be ways to early return with less-math in the common cases, but
I've saved such for a later patch.

Note that I changed from using paddingBefore/paddingAfter (which include the instrinsic padding)
to calling computedCSSPaddingBefore/computedCSSPaddingAfter directly as well.

This single function is about 11% of total time for robohornet's resizecol.

* rendering/RenderTableCell.cpp:
* rendering/RenderTableCell.h:
(WebCore::RenderTableCell::logicalHeightForRowSizing):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (130709 => 130710)


--- trunk/Source/WebCore/ChangeLog	2012-10-09 01:36:26 UTC (rev 130709)
+++ trunk/Source/WebCore/ChangeLog	2012-10-09 01:39:20 UTC (rev 130710)
@@ -1,3 +1,28 @@
+2012-10-08  Eric Seidel  <e...@webkit.org>
+
+        Inline logicalHeightForRowSizing to shave another 2-3% off robohornet's resizecol.html
+        https://bugs.webkit.org/show_bug.cgi?id=98703
+
+        Reviewed by Emil A Eklund.
+
+        This is very small potatoes.  There are much bigger wins for table layout yet, but
+        this was an easy win.
+
+        This function should probably be converted to use int's only, as table cells are pixel-sized
+        according to our subpixel-experts.
+
+        Also, I suspect there should be ways to early return with less-math in the common cases, but
+        I've saved such for a later patch.
+
+        Note that I changed from using paddingBefore/paddingAfter (which include the instrinsic padding)
+        to calling computedCSSPaddingBefore/computedCSSPaddingAfter directly as well.
+
+        This single function is about 11% of total time for robohornet's resizecol.
+
+        * rendering/RenderTableCell.cpp:
+        * rendering/RenderTableCell.h:
+        (WebCore::RenderTableCell::logicalHeightForRowSizing):
+
 2012-10-08  Alec Flett  <alecfl...@chromium.org>
 
         IndexedDB: remove autogenerated objectStore/index id code

Modified: trunk/Source/WebCore/rendering/RenderTableCell.cpp (130709 => 130710)


--- trunk/Source/WebCore/rendering/RenderTableCell.cpp	2012-10-09 01:36:26 UTC (rev 130709)
+++ trunk/Source/WebCore/rendering/RenderTableCell.cpp	2012-10-09 01:39:20 UTC (rev 130710)
@@ -125,25 +125,6 @@
         section()->setNeedsCellRecalc();
 }
 
-LayoutUnit RenderTableCell::logicalHeightForRowSizing() const
-{
-    LayoutUnit adjustedLogicalHeight = logicalHeight() - (intrinsicPaddingBefore() + intrinsicPaddingAfter());
-
-    LayoutUnit styleLogicalHeight = valueForLength(style()->logicalHeight(), 0, view());
-    if (document()->inQuirksMode() || style()->boxSizing() == BORDER_BOX) {
-        // Explicit heights use the border box in quirks mode.
-        // Don't adjust height.
-    } else {
-        // In strict mode, box-sizing: content-box do the right
-        // thing and actually add in the border and padding.
-        LayoutUnit adjustedPaddingBefore = paddingBefore() - intrinsicPaddingBefore();
-        LayoutUnit adjustedPaddingAfter = paddingAfter() - intrinsicPaddingAfter();
-        styleLogicalHeight += adjustedPaddingBefore + adjustedPaddingAfter + borderBefore() + borderAfter();
-    }
-
-    return max(styleLogicalHeight, adjustedLogicalHeight);
-}
-
 Length RenderTableCell::logicalWidthFromColumns(RenderTableCol* firstColForThisCell, Length widthFromStyle) const
 {
     ASSERT(firstColForThisCell && firstColForThisCell == table()->colElement(col()));

Modified: trunk/Source/WebCore/rendering/RenderTableCell.h (130709 => 130710)


--- trunk/Source/WebCore/rendering/RenderTableCell.h	2012-10-09 01:36:26 UTC (rev 130709)
+++ trunk/Source/WebCore/rendering/RenderTableCell.h	2012-10-09 01:39:20 UTC (rev 130710)
@@ -90,7 +90,17 @@
         return styleWidth;
     }
 
-    LayoutUnit logicalHeightForRowSizing() const;
+    LayoutUnit logicalHeightForRowSizing() const
+    {
+        // FIXME: This function does too much work, and is very hot during table layout!
+        LayoutUnit adjustedLogicalHeight = logicalHeight() - (intrinsicPaddingBefore() + intrinsicPaddingAfter());
+        LayoutUnit styleLogicalHeight = valueForLength(style()->logicalHeight(), 0, view());
+        // In strict mode, box-sizing: content-box do the right thing and actually add in the border and padding.
+        // Call computedCSSPadding* directly to avoid including implicitPadding.
+        if (!document()->inQuirksMode() && style()->boxSizing() != BORDER_BOX)
+            styleLogicalHeight += computedCSSPaddingBefore() + computedCSSPaddingAfter() + borderBefore() + borderAfter();
+        return max(styleLogicalHeight, adjustedLogicalHeight);
+    }
 
     virtual void computePreferredLogicalWidths();
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to