Changeset 116260 in webkit


Ignore:
Timestamp:
May 6, 2012 7:19:15 PM (12 years ago)
Author:
rwlbuis@webkit.org
Message:

Shrink TextRun object size
https://bugs.webkit.org/show_bug.cgi?id=85751

Reviewed by Darin Adler.

Reorder the member variables in TextRun so it shrinks from 56 to 40 bytes on my 64-bit build. This is important
for SVG, since RenderSVGText shrinks because of this.

Also add a compile assert for the expected object size.

  • platform/graphics/TextRun.cpp:

(ExpectedTextRunSize):
(WebCore):

  • platform/graphics/TextRun.h:

(WebCore::TextRun::TextRun):
(WebCore::TextRun::direction):
(TextRun):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r116258 r116260  
     12012-05-06  Rob Buis  <rbuis@rim.com>
     2
     3        Shrink TextRun object size
     4        https://bugs.webkit.org/show_bug.cgi?id=85751
     5
     6        Reviewed by Darin Adler.
     7
     8        Reorder the member variables in TextRun so it shrinks from 56 to 40 bytes on my 64-bit build. This is important
     9        for SVG, since RenderSVGText shrinks because of this.
     10
     11        Also add a compile assert for the expected object size.
     12
     13        * platform/graphics/TextRun.cpp:
     14        (ExpectedTextRunSize):
     15        (WebCore):
     16        * platform/graphics/TextRun.h:
     17        (WebCore::TextRun::TextRun):
     18        (WebCore::TextRun::direction):
     19        (TextRun):
     20
    1212012-05-06  Jonathan Dong  <jonathan.dong@torchmobile.com.cn>
    222
  • trunk/Source/WebCore/platform/graphics/TextRun.cpp

    r95901 r116260  
    2929namespace WebCore {
    3030
     31class ExpectedTextRunSize {
     32    const void* pointer;;
     33    int integers[2];
     34    float float1;
     35#if ENABLE(SVG)
     36    float float2;
     37#endif
     38    float float3;
     39    uint32_t bitfields : 9;
     40    RefPtr<TextRun::RenderingContext> renderingContext;
     41};
     42
     43COMPILE_ASSERT(sizeof(TextRun) == sizeof(ExpectedTextRunSize), "TextRun is not of expected size");
     44
    3145bool TextRun::s_allowsRoundingHacks = false;
    3246
  • trunk/Source/WebCore/platform/graphics/TextRun.h

    r114032 r116260  
    6464        , m_len(len)
    6565        , m_xpos(xpos)
    66         , m_expansion(expansion)
    67         , m_expansionBehavior(expansionBehavior)
    6866#if ENABLE(SVG)
    6967        , m_horizontalGlyphStretch(1)
    7068#endif
     69        , m_expansion(expansion)
     70        , m_expansionBehavior(expansionBehavior)
    7171        , m_allowTabs(allowTabs)
    7272        , m_direction(direction)
     
    8484        , m_len(s.length())
    8585        , m_xpos(xpos)
    86         , m_expansion(expansion)
    87         , m_expansionBehavior(expansionBehavior)
    8886#if ENABLE(SVG)
    8987        , m_horizontalGlyphStretch(1)
    9088#endif
     89        , m_expansion(expansion)
     90        , m_expansionBehavior(expansionBehavior)
    9191        , m_allowTabs(allowTabs)
    9292        , m_direction(direction)
     
    121121    bool allowsLeadingExpansion() const { return m_expansionBehavior & AllowLeadingExpansion; }
    122122    bool allowsTrailingExpansion() const { return m_expansionBehavior & AllowTrailingExpansion; }
    123     TextDirection direction() const { return m_direction; }
     123    TextDirection direction() const { return static_cast<TextDirection>(m_direction); }
    124124    bool rtl() const { return m_direction == RTL; }
    125125    bool ltr() const { return m_direction == LTR; }
     
    164164    // the text line is not the same as left start of the containing block.
    165165    float m_xpos; 
    166     float m_expansion;
    167     ExpansionBehavior m_expansionBehavior;
    168166#if ENABLE(SVG)
    169167    float m_horizontalGlyphStretch;
    170168#endif
    171     bool m_allowTabs;
    172     TextDirection m_direction;
    173     bool m_directionalOverride; // Was this direction set by an override character.
    174     bool m_characterScanForCodePath;
    175     bool m_applyRunRounding;
    176     bool m_applyWordRounding;
    177     bool m_disableSpacing;
     169    float m_expansion;
     170    ExpansionBehavior m_expansionBehavior : 2;
     171    unsigned m_allowTabs : 1;
     172    unsigned m_direction : 1;
     173    unsigned m_directionalOverride : 1; // Was this direction set by an override character.
     174    unsigned m_characterScanForCodePath : 1;
     175    unsigned m_applyRunRounding : 1;
     176    unsigned m_applyWordRounding : 1;
     177    unsigned m_disableSpacing : 1;
    178178    RefPtr<RenderingContext> m_renderingContext;
    179179};
Note: See TracChangeset for help on using the changeset viewer.