Changeset 40771 in webkit


Ignore:
Timestamp:
Feb 7, 2009 11:03:43 PM (15 years ago)
Author:
hyatt@apple.com
Message:

2009-02-07 David Hyatt <hyatt@apple.com>

Shrink the size of all InlineTextBoxes and all InlineBoxes (for images and replaced elements) by four bytes.
Change the overflow variable on InlineFlowBoxes into a short and move the bits for InlineFlowBoxes out of the
base InlineBox class. Since the number of bits in the base class was 35, shoving the 3 bits for InlineFlowBoxes
back down into that class (into the 16 bits exposed by making the overflow variable into a short), all text
boxes and image boxes shrink by 4 bytes.

Reviewed by Anders

  • rendering/InlineBox.h: (WebCore::InlineBox::InlineBox):
  • rendering/InlineFlowBox.cpp: (WebCore::InlineFlowBox::placeBoxesHorizontally): (WebCore::InlineFlowBox::computeLogicalBoxHeights): (WebCore::InlineFlowBox::placeBoxesVertically):
  • rendering/InlineFlowBox.h: (WebCore::InlineFlowBox::InlineFlowBox): (WebCore::InlineFlowBox::maxHorizontalVisualOverflow): (WebCore::InlineFlowBox::hasTextChildren):
Location:
trunk/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r40770 r40771  
     12009-02-07  David Hyatt  <hyatt@apple.com>
     2
     3        Shrink the size of all InlineTextBoxes and all InlineBoxes (for images and replaced elements) by four bytes.
     4        Change the overflow variable on InlineFlowBoxes into a short and move the bits for InlineFlowBoxes out of the
     5        base InlineBox class.  Since the number of bits in the base class was 35, shoving the 3 bits for InlineFlowBoxes
     6        back down into that class (into the 16 bits exposed by making the overflow variable into a short), all text
     7        boxes and image boxes shrink by 4 bytes.
     8
     9        Reviewed by Anders
     10
     11        * rendering/InlineBox.h:
     12        (WebCore::InlineBox::InlineBox):
     13        * rendering/InlineFlowBox.cpp:
     14        (WebCore::InlineFlowBox::placeBoxesHorizontally):
     15        (WebCore::InlineFlowBox::computeLogicalBoxHeights):
     16        (WebCore::InlineFlowBox::placeBoxesVertically):
     17        * rendering/InlineFlowBox.h:
     18        (WebCore::InlineFlowBox::InlineFlowBox):
     19        (WebCore::InlineFlowBox::maxHorizontalVisualOverflow):
     20        (WebCore::InlineFlowBox::hasTextChildren):
     21
    1222009-02-07  Dean Jackson  <dino@apple.com>
    223
  • trunk/WebCore/rendering/InlineBox.h

    r40769 r40771  
    5151        , m_dirty(false)
    5252        , m_extracted(false)
    53         , m_includeLeftEdge(false)
    54         , m_includeRightEdge(false)
    55         , m_hasTextChildren(true)
    5653        , m_endsWithBreak(false)
    5754        , m_hasSelectedChildren(false)
     
    8683        , m_dirty(dirty)
    8784        , m_extracted(extracted)
    88         , m_includeLeftEdge(false)
    89         , m_includeRightEdge(false)
    90         , m_hasTextChildren(true)
    9185        , m_endsWithBreak(false)
    9286        , m_hasSelectedChildren(false)   
     
    205199    int baseline() const { return m_baseline; }
    206200
    207     bool hasTextChildren() const { return m_hasTextChildren; }
    208 
    209201    virtual int topOverflow() { return yPos(); }
    210202    virtual int bottomOverflow() { return yPos() + height(); }
     
    274266    bool m_dirty : 1;
    275267    bool m_extracted : 1;
    276 
    277     // for InlineFlowBox
    278     bool m_includeLeftEdge : 1;
    279     bool m_includeRightEdge : 1;
    280     bool m_hasTextChildren : 1;
    281268
    282269    // for RootInlineBox
  • trunk/WebCore/rendering/InlineFlowBox.cpp

    r40769 r40771  
    319319            leftPosition = min(x + visualOverflowLeft, leftPosition);
    320320            rightPosition = max(x + text->width() + visualOverflowRight, rightPosition);
    321             m_maxHorizontalVisualOverflow = max(max(visualOverflowRight, -visualOverflowLeft), m_maxHorizontalVisualOverflow);
     321            m_maxHorizontalVisualOverflow = max(max(visualOverflowRight, -visualOverflowLeft), (int)m_maxHorizontalVisualOverflow);
    322322            x += text->width();
    323323        } else {
     
    446446            continue; // Positioned placeholders don't affect calculations.
    447447       
     448        bool isInlineFlow = curr->isInlineFlowBox();
     449
    448450        curr->setHeight(curr->object()->lineHeight(m_firstLine));
    449451        curr->setBaseline(curr->object()->baselinePosition(m_firstLine));
     
    457459                maxPositionBottom = curr->height();
    458460        }
    459         else if (curr->hasTextChildren() || curr->boxModelObject()->hasHorizontalBordersOrPadding() || strictMode) {
     461        else if ((!isInlineFlow || static_cast<InlineFlowBox*>(curr)->hasTextChildren()) || curr->boxModelObject()->hasHorizontalBordersOrPadding() || strictMode) {
    460462            int ascent = curr->baseline() - curr->yPos();
    461463            int descent = curr->height() - ascent;
     
    483485        // Adjust boxes to use their real box y/height and not the logical height (as dictated by
    484486        // line-height).
    485         if (curr->isInlineFlowBox())
     487        bool isInlineFlow = curr->isInlineFlowBox();
     488        if (isInlineFlow)
    486489            static_cast<InlineFlowBox*>(curr)->placeBoxesVertically(y, maxHeight, maxAscent, strictMode, topPosition, bottomPosition, selectionTop, selectionBottom);
    487490
     
    492495            curr->setYPos(y + maxHeight - curr->height());
    493496        else {
    494             if (!curr->hasTextChildren() && !curr->boxModelObject()->hasHorizontalBordersOrPadding() && !strictMode)
     497            if ((isInlineFlow && !static_cast<InlineFlowBox*>(curr)->hasTextChildren()) && !curr->boxModelObject()->hasHorizontalBordersOrPadding() && !strictMode)
    495498                childAffectsTopBottomPos = false;
    496499            curr->setYPos(curr->yPos() + y + maxAscent - curr->baseline());
  • trunk/WebCore/rendering/InlineFlowBox.h

    r40769 r40771  
    3737        , m_lastChild(0)
    3838        , m_maxHorizontalVisualOverflow(0)
     39        , m_includeLeftEdge(false)
     40        , m_includeRightEdge(false)
     41        , m_hasTextChildren(true)
    3942#ifndef NDEBUG
    4043        , m_hasBadChildList(false)
     
    131134    virtual void setVerticalOverflowPositions(int /*top*/, int /*bottom*/) { }
    132135    virtual void setVerticalSelectionPositions(int /*top*/, int /*bottom*/) { }
    133     int maxHorizontalVisualOverflow() const { return m_maxHorizontalVisualOverflow; }
     136    short maxHorizontalVisualOverflow() const { return m_maxHorizontalVisualOverflow; }
    134137
    135138    void removeChild(InlineBox* child);
     
    140143    virtual int placeEllipsisBox(bool ltr, int blockEdge, int ellipsisWidth, bool&);
    141144
     145    bool hasTextChildren() const { return m_hasTextChildren; }
     146
    142147    void checkConsistency() const;
    143148    void setHasBadChildList();
     
    146151    InlineBox* m_firstChild;
    147152    InlineBox* m_lastChild;
    148     int m_maxHorizontalVisualOverflow;
     153    short m_maxHorizontalVisualOverflow;
     154   
     155    bool m_includeLeftEdge : 1;
     156    bool m_includeRightEdge : 1;
     157    bool m_hasTextChildren : 1;
    149158
    150159#ifndef NDEBUG
Note: See TracChangeset for help on using the changeset viewer.