Changeset 150258 in webkit


Ignore:
Timestamp:
May 17, 2013 8:11:10 AM (11 years ago)
Author:
commit-queue@webkit.org
Message:

Improve -webkit-text-underline-position memory usage.
https://bugs.webkit.org/show_bug.cgi?id=116108

Patch by Lamarque V. Souza <Lamarque.Souza@basyskom.com> on 2013-05-17
Reviewed by Benjamin Poulain.

Remove m_maxLogicalTop private variable from RootInlineBox to reduce
the overall memory used to render RootInlineBoxes (eight bytes per RootInlineBox
instance in a 64-bit machine). RootInline::maxLogicalTop() now computes
the maxLogicalTop value everytime it is called. In a typical page
computeMaxLogicalTop is called less than 10 times for each
InlineTextBox that uses -webkit-text-underline-position. That is a small
price users of -webkit-text-underline-position will pay so that
everybody can benefit from the memory reduction in RootInlineBox.

No new tests, no change in behavior.

  • rendering/InlineFlowBox.cpp:

(WebCore::InlineFlowBox::computeMaxLogicalTop): Make it const.

  • rendering/InlineFlowBox.h:
  • rendering/RootInlineBox.cpp:

(WebCore::RootInlineBox::RootInlineBox): Remove m_maxLogicalTop.
(WebCore::RootInlineBox::alignBoxesInBlockDirection): Remove
computeMaxLogicalTop call and obsolete comment.
(WebCore):
(WebCore::RootInlineBox::maxLogicalTop): Compute maxLogicalTop before
returning its value.

  • rendering/RootInlineBox.h:

(RootInlineBox):

Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r150255 r150258  
     12013-05-17  Lamarque V. Souza  <Lamarque.Souza@basyskom.com>
     2
     3        Improve -webkit-text-underline-position memory usage.
     4        https://bugs.webkit.org/show_bug.cgi?id=116108
     5
     6        Reviewed by Benjamin Poulain.
     7
     8        Remove m_maxLogicalTop private variable from RootInlineBox to reduce
     9        the overall memory used to render RootInlineBoxes (eight bytes per RootInlineBox
     10        instance in a 64-bit machine). RootInline::maxLogicalTop() now computes
     11        the maxLogicalTop value everytime it is called. In a typical page
     12        computeMaxLogicalTop is called less than 10 times for each
     13        InlineTextBox that uses -webkit-text-underline-position. That is a small
     14        price users of -webkit-text-underline-position will pay so that
     15        everybody can benefit from the memory reduction in RootInlineBox.
     16
     17        No new tests, no change in behavior.
     18
     19        * rendering/InlineFlowBox.cpp:
     20        (WebCore::InlineFlowBox::computeMaxLogicalTop): Make it const.
     21        * rendering/InlineFlowBox.h:
     22        * rendering/RootInlineBox.cpp:
     23        (WebCore::RootInlineBox::RootInlineBox): Remove m_maxLogicalTop.
     24        (WebCore::RootInlineBox::alignBoxesInBlockDirection): Remove
     25        computeMaxLogicalTop call and obsolete comment.
     26        (WebCore):
     27        (WebCore::RootInlineBox::maxLogicalTop): Compute maxLogicalTop before
     28        returning its value.
     29        * rendering/RootInlineBox.h:
     30        (RootInlineBox):
     31
    1322013-05-17  Alexis Menard  <alexis@webkit.org>
    233
  • trunk/Source/WebCore/rendering/InlineFlowBox.cpp

    r149930 r150258  
    748748
    749749#if ENABLE(CSS3_TEXT)
    750 void InlineFlowBox::computeMaxLogicalTop(float& maxLogicalTop)
     750void InlineFlowBox::computeMaxLogicalTop(float& maxLogicalTop) const
    751751{
    752752    for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) {
  • trunk/Source/WebCore/rendering/InlineFlowBox.h

    r149967 r150258  
    311311    // Maximum logicalTop among all children of an InlineFlowBox. Used to
    312312    // calculate the offset for TextUnderlinePositionUnder.
    313     void computeMaxLogicalTop(float& maxLogicalTop);
     313    void computeMaxLogicalTop(float& maxLogicalTop) const;
    314314#endif // CSS3_TEXT
    315315private:
  • trunk/Source/WebCore/rendering/RootInlineBox.cpp

    r150214 r150258  
    5555    , m_lineTopWithLeading(0)
    5656    , m_lineBottomWithLeading(0)
    57 #if ENABLE(CSS3_TEXT)
    58     , m_maxLogicalTop(0)
    59 #endif // CSS3_TEXT
    6057{
    6158    setIsHorizontal(block->isHorizontalWritingMode());
     
    284281    if (isSVGRootInlineBox())
    285282        return 0;
    286 
    287     // FIXME: figure out how to call computeMaxLogicalTop() when SVG is enabled.
    288283#endif
    289284
     
    338333    }
    339334
     335    return heightOfBlock + maxHeight;
     336}
     337
    340338#if ENABLE(CSS3_TEXT)
    341     m_maxLogicalTop = 0;
    342     computeMaxLogicalTop(m_maxLogicalTop);
     339float RootInlineBox::maxLogicalTop() const
     340{
     341    float maxLogicalTop = 0;
     342    computeMaxLogicalTop(maxLogicalTop);
     343    return maxLogicalTop;
     344}
    343345#endif // CSS3_TEXT
    344 
    345     return heightOfBlock + maxHeight;
    346 }
    347346
    348347LayoutUnit RootInlineBox::beforeAnnotationsAdjustment() const
  • trunk/Source/WebCore/rendering/RootInlineBox.h

    r149967 r150258  
    191191#if ENABLE(CSS3_TEXT)
    192192    // Used to calculate the underline offset for TextUnderlinePositionUnder.
    193     float maxLogicalTop() const { return m_maxLogicalTop; }
     193    float maxLogicalTop() const;
    194194#endif // CSS3_TEXT
    195195
     
    227227    LayoutUnit m_lineTopWithLeading;
    228228    LayoutUnit m_lineBottomWithLeading;
    229 
    230 #if ENABLE(CSS3_TEXT)
    231     // Maximum logicalTop among all children of an InlineFlowBox. Used to
    232     // calculate the offset for TextUnderlinePositionUnder.
    233     float m_maxLogicalTop;
    234 #endif // CSS3_TEXT
    235229
    236230    struct LineFragmentationData {
Note: See TracChangeset for help on using the changeset viewer.