Changeset 130710 in webkit


Ignore:
Timestamp:
Oct 8, 2012 6:39:20 PM (12 years ago)
Author:
eric@webkit.org
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):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r130708 r130710  
     12012-10-08  Eric Seidel  <eric@webkit.org>
     2
     3        Inline logicalHeightForRowSizing to shave another 2-3% off robohornet's resizecol.html
     4        https://bugs.webkit.org/show_bug.cgi?id=98703
     5
     6        Reviewed by Emil A Eklund.
     7
     8        This is very small potatoes.  There are much bigger wins for table layout yet, but
     9        this was an easy win.
     10
     11        This function should probably be converted to use int's only, as table cells are pixel-sized
     12        according to our subpixel-experts.
     13
     14        Also, I suspect there should be ways to early return with less-math in the common cases, but
     15        I've saved such for a later patch.
     16
     17        Note that I changed from using paddingBefore/paddingAfter (which include the instrinsic padding)
     18        to calling computedCSSPaddingBefore/computedCSSPaddingAfter directly as well.
     19
     20        This single function is about 11% of total time for robohornet's resizecol.
     21
     22        * rendering/RenderTableCell.cpp:
     23        * rendering/RenderTableCell.h:
     24        (WebCore::RenderTableCell::logicalHeightForRowSizing):
     25
    1262012-10-08  Alec Flett  <alecflett@chromium.org>
    227
  • trunk/Source/WebCore/rendering/RenderTableCell.cpp

    r130698 r130710  
    126126}
    127127
    128 LayoutUnit RenderTableCell::logicalHeightForRowSizing() const
    129 {
    130     LayoutUnit adjustedLogicalHeight = logicalHeight() - (intrinsicPaddingBefore() + intrinsicPaddingAfter());
    131 
    132     LayoutUnit styleLogicalHeight = valueForLength(style()->logicalHeight(), 0, view());
    133     if (document()->inQuirksMode() || style()->boxSizing() == BORDER_BOX) {
    134         // Explicit heights use the border box in quirks mode.
    135         // Don't adjust height.
    136     } else {
    137         // In strict mode, box-sizing: content-box do the right
    138         // thing and actually add in the border and padding.
    139         LayoutUnit adjustedPaddingBefore = paddingBefore() - intrinsicPaddingBefore();
    140         LayoutUnit adjustedPaddingAfter = paddingAfter() - intrinsicPaddingAfter();
    141         styleLogicalHeight += adjustedPaddingBefore + adjustedPaddingAfter + borderBefore() + borderAfter();
    142     }
    143 
    144     return max(styleLogicalHeight, adjustedLogicalHeight);
    145 }
    146 
    147128Length RenderTableCell::logicalWidthFromColumns(RenderTableCol* firstColForThisCell, Length widthFromStyle) const
    148129{
  • trunk/Source/WebCore/rendering/RenderTableCell.h

    r130698 r130710  
    9191    }
    9292
    93     LayoutUnit logicalHeightForRowSizing() const;
     93    LayoutUnit logicalHeightForRowSizing() const
     94    {
     95        // FIXME: This function does too much work, and is very hot during table layout!
     96        LayoutUnit adjustedLogicalHeight = logicalHeight() - (intrinsicPaddingBefore() + intrinsicPaddingAfter());
     97        LayoutUnit styleLogicalHeight = valueForLength(style()->logicalHeight(), 0, view());
     98        // In strict mode, box-sizing: content-box do the right thing and actually add in the border and padding.
     99        // Call computedCSSPadding* directly to avoid including implicitPadding.
     100        if (!document()->inQuirksMode() && style()->boxSizing() != BORDER_BOX)
     101            styleLogicalHeight += computedCSSPaddingBefore() + computedCSSPaddingAfter() + borderBefore() + borderAfter();
     102        return max(styleLogicalHeight, adjustedLogicalHeight);
     103    }
    94104
    95105    virtual void computePreferredLogicalWidths();
Note: See TracChangeset for help on using the changeset viewer.