Changeset 71055 in webkit


Ignore:
Timestamp:
Nov 1, 2010 2:13:55 PM (13 years ago)
Author:
hyatt@apple.com
Message:

https://bugs.webkit.org/show_bug.cgi?id=48776

Reviewed by Dan Bernstein.

Change isVertical() on InlineBox to isHorizontal() instead. This makes the horizontal code path come
first if you branch on isHorizontal() and makes the code read better (since that's the more common code
path).

  • rendering/InlineBox.cpp:

(WebCore::InlineBox::logicalHeight):

  • rendering/InlineBox.h:

(WebCore::InlineBox::InlineBox):
(WebCore::InlineBox::isHorizontal):
(WebCore::InlineBox::setIsHorizontal):
(WebCore::InlineBox::width):
(WebCore::InlineBox::height):
(WebCore::InlineBox::logicalLeft):
(WebCore::InlineBox::setLogicalLeft):
(WebCore::InlineBox::logicalTop):
(WebCore::InlineBox::setLogicalTop):
(WebCore::InlineBox::baselinePosition):
(WebCore::InlineBox::lineHeight):

  • rendering/InlineFlowBox.cpp:

(WebCore::InlineFlowBox::addToLine):
(WebCore::InlineFlowBox::placeBoxesInInlineDirection):
(WebCore::InlineFlowBox::computeBlockDirectionOverflow):
(WebCore::InlineFlowBox::paintFillLayer):
(WebCore::InlineFlowBox::paintBoxDecorations):
(WebCore::InlineFlowBox::paintMask):

  • rendering/InlineFlowBox.h:

(WebCore::InlineFlowBox::marginLogicalLeft):
(WebCore::InlineFlowBox::marginLogicalRight):
(WebCore::InlineFlowBox::borderLogicalLeft):
(WebCore::InlineFlowBox::borderLogicalRight):
(WebCore::InlineFlowBox::paddingLogicalLeft):
(WebCore::InlineFlowBox::paddingLogicalRight):
(WebCore::InlineFlowBox::setInlineDirectionOverflowPositions):
(WebCore::InlineFlowBox::setBlockDirectionOverflowPositions):

  • rendering/InlineTextBox.cpp:

(WebCore::InlineTextBox::selectionRect):
(WebCore::InlineTextBox::applyShadowToGraphicsContext):
(WebCore::paintTextWithShadows):
(WebCore::InlineTextBox::paint):
(WebCore::InlineTextBox::paintDecoration):

  • rendering/InlineTextBox.h:
  • rendering/RenderBlockLineLayout.cpp:

(WebCore::RenderBlock::createLineBoxes):

  • rendering/RenderBox.cpp:

(WebCore::RenderBox::blockDirectionOverflow):

  • rendering/RenderBox.h:
  • rendering/RenderBoxModelObject.cpp:

(WebCore::RenderBoxModelObject::paintFillLayerExtended):

  • rendering/RenderLineBoxList.cpp:

(WebCore::RenderLineBoxList::hitTest):

  • rendering/RootInlineBox.cpp:

(WebCore::RootInlineBox::RootInlineBox):
(WebCore::RootInlineBox::placeEllipsis):

  • rendering/RootInlineBox.h:

(WebCore::RootInlineBox::baselinePosition):
(WebCore::RootInlineBox::lineHeight):

Location:
trunk/WebCore
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r71049 r71055  
     12010-11-01  David Hyatt  <hyatt@apple.com>
     2
     3        Reviewed by Dan Bernstein.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=48776
     6       
     7        Change isVertical() on InlineBox to isHorizontal() instead.  This makes the horizontal code path come
     8        first if you branch on isHorizontal() and makes the code read better (since that's the more common code
     9        path).
     10
     11        * rendering/InlineBox.cpp:
     12        (WebCore::InlineBox::logicalHeight):
     13        * rendering/InlineBox.h:
     14        (WebCore::InlineBox::InlineBox):
     15        (WebCore::InlineBox::isHorizontal):
     16        (WebCore::InlineBox::setIsHorizontal):
     17        (WebCore::InlineBox::width):
     18        (WebCore::InlineBox::height):
     19        (WebCore::InlineBox::logicalLeft):
     20        (WebCore::InlineBox::setLogicalLeft):
     21        (WebCore::InlineBox::logicalTop):
     22        (WebCore::InlineBox::setLogicalTop):
     23        (WebCore::InlineBox::baselinePosition):
     24        (WebCore::InlineBox::lineHeight):
     25        * rendering/InlineFlowBox.cpp:
     26        (WebCore::InlineFlowBox::addToLine):
     27        (WebCore::InlineFlowBox::placeBoxesInInlineDirection):
     28        (WebCore::InlineFlowBox::computeBlockDirectionOverflow):
     29        (WebCore::InlineFlowBox::paintFillLayer):
     30        (WebCore::InlineFlowBox::paintBoxDecorations):
     31        (WebCore::InlineFlowBox::paintMask):
     32        * rendering/InlineFlowBox.h:
     33        (WebCore::InlineFlowBox::marginLogicalLeft):
     34        (WebCore::InlineFlowBox::marginLogicalRight):
     35        (WebCore::InlineFlowBox::borderLogicalLeft):
     36        (WebCore::InlineFlowBox::borderLogicalRight):
     37        (WebCore::InlineFlowBox::paddingLogicalLeft):
     38        (WebCore::InlineFlowBox::paddingLogicalRight):
     39        (WebCore::InlineFlowBox::setInlineDirectionOverflowPositions):
     40        (WebCore::InlineFlowBox::setBlockDirectionOverflowPositions):
     41        * rendering/InlineTextBox.cpp:
     42        (WebCore::InlineTextBox::selectionRect):
     43        (WebCore::InlineTextBox::applyShadowToGraphicsContext):
     44        (WebCore::paintTextWithShadows):
     45        (WebCore::InlineTextBox::paint):
     46        (WebCore::InlineTextBox::paintDecoration):
     47        * rendering/InlineTextBox.h:
     48        * rendering/RenderBlockLineLayout.cpp:
     49        (WebCore::RenderBlock::createLineBoxes):
     50        * rendering/RenderBox.cpp:
     51        (WebCore::RenderBox::blockDirectionOverflow):
     52        * rendering/RenderBox.h:
     53        * rendering/RenderBoxModelObject.cpp:
     54        (WebCore::RenderBoxModelObject::paintFillLayerExtended):
     55        * rendering/RenderLineBoxList.cpp:
     56        (WebCore::RenderLineBoxList::hitTest):
     57        * rendering/RootInlineBox.cpp:
     58        (WebCore::RootInlineBox::RootInlineBox):
     59        (WebCore::RootInlineBox::placeEllipsis):
     60        * rendering/RootInlineBox.h:
     61        (WebCore::RootInlineBox::baselinePosition):
     62        (WebCore::RootInlineBox::lineHeight):
     63
    1642010-11-01  Simon Fraser  <simon.fraser@apple.com>
    265
  • trunk/WebCore/rendering/InlineBox.cpp

    r71043 r71055  
    9696        return m_isText ? renderer()->style(m_firstLine)->font().height() : 0;
    9797    if (renderer()->isBox() && parent())
    98         return m_isVertical ? toRenderBox(m_renderer)->width() : toRenderBox(m_renderer)->height();
     98        return isHorizontal() ? toRenderBox(m_renderer)->height() : toRenderBox(m_renderer)->width();
    9999
    100100    ASSERT(isInlineFlowBox());
  • trunk/WebCore/rendering/InlineBox.h

    r70917 r71055  
    5252        , m_hasVirtualLogicalHeight(false)
    5353#endif
    54         , m_isVertical(false)
     54        , m_isHorizontal(true)
    5555        , m_endsWithBreak(false)
    5656        , m_hasSelectedChildren(false)
     
    7070
    7171    InlineBox(RenderObject* obj, int x, int y, int logicalWidth, bool firstLine, bool constructed,
    72               bool dirty, bool extracted, bool isVertical, InlineBox* next, InlineBox* prev, InlineFlowBox* parent)
     72              bool dirty, bool extracted, bool isHorizontal, InlineBox* next, InlineBox* prev, InlineFlowBox* parent)
    7373        : m_next(next)
    7474        , m_prev(prev)
     
    8686        , m_hasVirtualLogicalHeight(false)
    8787#endif
    88         , m_isVertical(isVertical)
     88        , m_isHorizontal(isHorizontal)
    8989        , m_endsWithBreak(false)
    9090        , m_hasSelectedChildren(false)   
     
    153153    }
    154154
    155     bool isVertical() const { return m_isVertical; }
    156     void setIsVertical(bool v) { m_isVertical = v; }
     155    bool isHorizontal() const { return m_isHorizontal; }
     156    void setIsHorizontal(bool horizontal) { m_isHorizontal = horizontal; }
    157157
    158158    virtual IntRect calculateBoundaries() const
     
    217217    int y() const { return m_y; }
    218218
    219     int width() const { return m_isVertical ? logicalHeight() : logicalWidth(); }
    220     int height() const { return m_isVertical ? logicalWidth() : logicalHeight(); }
     219    int width() const { return isHorizontal() ? logicalWidth() : logicalHeight(); }
     220    int height() const { return isHorizontal() ? logicalHeight() : logicalWidth(); }
    221221
    222222    // The logicalLeft position is the left edge of the line box in a horizontal line and the top edge in a vertical line.
    223     int logicalLeft() const { return !m_isVertical ? m_x : m_y; }
     223    int logicalLeft() const { return isHorizontal() ? m_x : m_y; }
    224224    int logicalRight() const { return logicalLeft() + logicalWidth(); }
    225225    void setLogicalLeft(int left)
    226226    {
    227         if (!m_isVertical)
     227        if (isHorizontal())
    228228            m_x = left;
    229229        else
     
    232232
    233233    // The logicalTop[ position is the top edge of the line box in a horizontal line and the left edge in a vertical line.
    234     int logicalTop() const { return !m_isVertical ? m_y : m_x; }
     234    int logicalTop() const { return isHorizontal() ? m_y : m_x; }
    235235    int logicalBottom() const { return logicalTop() + logicalHeight(); }
    236236    void setLogicalTop(int top)
    237237    {
    238         if (!m_isVertical)
     238        if (isHorizontal())
    239239            m_y = top;
    240240        else
     
    249249    int logicalHeight() const;
    250250
    251     virtual int baselinePosition() const { return boxModelObject()->baselinePosition(m_firstLine, m_isVertical ? VerticalLine : HorizontalLine, PositionOnContainingLine); }
    252     virtual int lineHeight() const { return boxModelObject()->lineHeight(m_firstLine, m_isVertical ? VerticalLine : HorizontalLine, PositionOnContainingLine); }
     251    virtual int baselinePosition() const { return boxModelObject()->baselinePosition(m_firstLine, isHorizontal() ? HorizontalLine : VerticalLine, PositionOnContainingLine); }
     252    virtual int lineHeight() const { return boxModelObject()->lineHeight(m_firstLine, isHorizontal() ? HorizontalLine : VerticalLine, PositionOnContainingLine); }
    253253   
    254254
     
    320320    bool m_hasVirtualLogicalHeight : 1;
    321321
    322     bool m_isVertical : 1;
     322    bool m_isHorizontal : 1;
    323323
    324324    // for RootInlineBox
  • trunk/WebCore/rendering/InlineFlowBox.cpp

    r71043 r71055  
    8181    }
    8282    child->setFirstLineStyleBit(m_firstLine);
    83     child->setIsVertical(m_isVertical);
     83    child->setIsHorizontal(isHorizontal());
    8484    if (child->isText())
    8585        m_hasTextChildren = true;
     
    329329                // The box can have a different writing-mode than the overall line, so this is a bit complicated.
    330330                // Just get all the physical margin and overflow values by hand based off |isVertical|.
    331                 int logicalLeftMargin = !isVertical() ? curr->boxModelObject()->marginLeft() : curr->boxModelObject()->marginTop();
    332                 int logicalRightMargin = !isVertical() ? curr->boxModelObject()->marginRight() : curr->boxModelObject()->marginBottom();
     331                int logicalLeftMargin = isHorizontal() ? curr->boxModelObject()->marginLeft() : curr->boxModelObject()->marginTop();
     332                int logicalRightMargin = isHorizontal() ? curr->boxModelObject()->marginRight() : curr->boxModelObject()->marginBottom();
    333333               
    334334                logicalLeft += logicalLeftMargin;
     
    337337                RenderBox* box = toRenderBox(curr->renderer());
    338338
    339                 int childOverflowLogicalLeft = box->hasOverflowClip() ? 0 : (!isVertical() ? box->leftLayoutOverflow() : box->topLayoutOverflow());
    340                 int childOverflowLogicalRight = box->hasOverflowClip() ? curr->logicalWidth() : (!isVertical() ? box->rightLayoutOverflow() : box->bottomLayoutOverflow());
     339                int childOverflowLogicalLeft = box->hasOverflowClip() ? 0 : (isHorizontal() ? box->leftLayoutOverflow() : box->topLayoutOverflow());
     340                int childOverflowLogicalRight = box->hasOverflowClip() ? curr->logicalWidth() : (isHorizontal() ? box->rightLayoutOverflow() : box->bottomLayoutOverflow());
    341341               
    342342                logicalLeftLayoutOverflow = min(logicalLeft + childOverflowLogicalLeft, logicalLeftLayoutOverflow);
    343343                logicalRightLayoutOverflow = max(logicalLeft + childOverflowLogicalRight, logicalRightLayoutOverflow);
    344344
    345                 logicalLeftVisualOverflow = min(logicalLeft + (!isVertical() ? box->leftVisualOverflow() : box->topVisualOverflow()), logicalLeftVisualOverflow);
    346                 logicalRightVisualOverflow = max(logicalLeft + (!isVertical() ? box->rightVisualOverflow() : box->bottomVisualOverflow()), logicalRightVisualOverflow);
     345                logicalLeftVisualOverflow = min(logicalLeft + (isHorizontal() ? box->leftVisualOverflow() : box->topVisualOverflow()), logicalLeftVisualOverflow);
     346                logicalRightVisualOverflow = max(logicalLeft + (isHorizontal() ? box->rightVisualOverflow() : box->bottomVisualOverflow()), logicalRightVisualOverflow);
    347347               
    348348                logicalLeft += curr->logicalWidth() + logicalRightMargin;
     
    634634           
    635635            RenderBox* box = toRenderBox(curr->renderer());
    636             box->blockDirectionOverflow(isVertical(), childTopLayoutOverflow, childBottomLayoutOverflow,
     636            box->blockDirectionOverflow(isHorizontal(), childTopLayoutOverflow, childBottomLayoutOverflow,
    637637                                        childTopVisualOverflow, childBottomVisualOverflow);
    638638           
     
    774774        for (InlineFlowBox* curr = this; curr; curr = curr->nextLineBox())
    775775            totalLogicalWidth += curr->logicalWidth();
    776         int stripX = tx - (isVertical() ? 0 : logicalOffsetOnLine);
    777         int stripY = ty - (isVertical() ? logicalOffsetOnLine : 0);
    778         int stripWidth = isVertical() ? width() : totalLogicalWidth;
    779         int stripHeight = isVertical() ? totalLogicalWidth : height();
     776        int stripX = tx - (isHorizontal() ? logicalOffsetOnLine : 0);
     777        int stripY = ty - (isHorizontal() ? 0 : logicalOffsetOnLine);
     778        int stripWidth = isHorizontal() ? totalLogicalWidth : width();
     779        int stripHeight = isHorizontal() ? height() : totalLogicalWidth;
    780780        paintInfo.context->save();
    781781        paintInfo.context->clip(IntRect(tx, ty, width(), height()));
     
    803803    int x = m_x;
    804804    int y = m_y;
    805     int w = m_isVertical ? logicalHeight() : logicalWidth();
    806     int h = m_isVertical ? logicalWidth() : logicalHeight();
     805    int w = width();
     806    int h = height();
    807807
    808808    // Constrain our background/border painting to the line top and bottom if necessary.
     
    810810    if (!hasTextChildren() && !noQuirksMode) {
    811811        RootInlineBox* rootBox = root();
    812         int& top = m_isVertical ? x : y;
    813         int& logicalHeight = m_isVertical ? w : h;
     812        int& top = isHorizontal() ? y : x;
     813        int& logicalHeight = isHorizontal() ? h : w;
    814814        int bottom = min(rootBox->lineBottom(), top + logicalHeight);
    815815        top = max(rootBox->lineTop(), top);
     
    866866                for (InlineFlowBox* curr = this; curr; curr = curr->nextLineBox())
    867867                    totalLogicalWidth += curr->logicalWidth();
    868                 int stripX = tx - (isVertical() ? 0 : logicalOffsetOnLine);
    869                 int stripY = ty - (isVertical() ? logicalOffsetOnLine : 0);
    870                 int stripWidth = isVertical() ? w : totalLogicalWidth;
    871                 int stripHeight = isVertical() ? totalLogicalWidth : h;
     868                int stripX = tx - (isHorizontal() ? logicalOffsetOnLine : 0);
     869                int stripY = ty - (isHorizontal() ? 0 : logicalOffsetOnLine);
     870                int stripWidth = isHorizontal() ? totalLogicalWidth : w;
     871                int stripHeight = isHorizontal() ? h : totalLogicalWidth;
    872872                context->save();
    873873                context->clip(IntRect(tx, ty, w, h));
     
    886886    int x = m_x;
    887887    int y = m_y;
    888     int w = m_isVertical ? logicalHeight() : logicalWidth();
    889     int h = m_isVertical ? logicalWidth() : logicalHeight();
     888    int w = width();
     889    int h = height();
    890890
    891891    // Constrain our background/border painting to the line top and bottom if necessary.
     
    893893    if (!hasTextChildren() && !noQuirksMode) {
    894894        RootInlineBox* rootBox = root();
    895         int& top = m_isVertical ? x : y;
    896         int& logicalHeight = m_isVertical ? w : h;
     895        int& top = isHorizontal() ? y : x;
     896        int& logicalHeight = isHorizontal() ? h : w;
    897897        int bottom = min(rootBox->lineBottom(), top + logicalHeight);
    898898        top = max(rootBox->lineTop(), top);
     
    944944        for (InlineFlowBox* curr = this; curr; curr = curr->nextLineBox())
    945945            totalLogicalWidth += curr->logicalWidth();
    946         int stripX = tx - (isVertical() ? 0 : logicalOffsetOnLine);
    947         int stripY = ty - (isVertical() ? logicalOffsetOnLine : 0);
    948         int stripWidth = isVertical() ? w : totalLogicalWidth;
    949         int stripHeight = isVertical() ? totalLogicalWidth : h;
     946        int stripX = tx - (isHorizontal() ? logicalOffsetOnLine : 0);
     947        int stripY = ty - (isHorizontal() ? 0 : logicalOffsetOnLine);
     948        int stripWidth = isHorizontal() ? totalLogicalWidth : w;
     949        int stripHeight = isHorizontal() ? h : totalLogicalWidth;
    950950        paintInfo.context->save();
    951951        paintInfo.context->clip(IntRect(tx, ty, w, h));
  • trunk/WebCore/rendering/InlineFlowBox.h

    r71043 r71055  
    109109        if (!includeLogicalLeftEdge())
    110110            return 0;
    111         return !isVertical() ? boxModelObject()->marginLeft() : boxModelObject()->marginTop();
     111        return isHorizontal() ? boxModelObject()->marginLeft() : boxModelObject()->marginTop();
    112112    }
    113113    int marginLogicalRight() const
     
    115115        if (!includeLogicalRightEdge())
    116116            return 0;
    117         return !isVertical() ? boxModelObject()->marginRight() : boxModelObject()->marginBottom();
     117        return isHorizontal() ? boxModelObject()->marginRight() : boxModelObject()->marginBottom();
    118118    }
    119119    int borderLogicalLeft() const
     
    121121        if (!includeLogicalLeftEdge())
    122122            return 0;
    123         return !isVertical() ? renderer()->style()->borderLeftWidth() : renderer()->style()->borderTopWidth();
     123        return isHorizontal() ? renderer()->style()->borderLeftWidth() : renderer()->style()->borderTopWidth();
    124124    }
    125125    int borderLogicalRight() const
     
    127127        if (!includeLogicalRightEdge())
    128128            return 0;
    129         return !isVertical() ? renderer()->style()->borderRightWidth() : renderer()->style()->borderBottomWidth();
     129        return isHorizontal() ? renderer()->style()->borderRightWidth() : renderer()->style()->borderBottomWidth();
    130130    }
    131131    int paddingLogicalLeft() const
     
    133133        if (!includeLogicalLeftEdge())
    134134            return 0;
    135         return !isVertical() ? boxModelObject()->paddingLeft() : boxModelObject()->paddingTop();
     135        return isHorizontal() ? boxModelObject()->paddingLeft() : boxModelObject()->paddingTop();
    136136    }
    137137    int paddingLogicalRight() const
     
    139139        if (!includeLogicalRightEdge())
    140140            return 0;
    141         return !isVertical() ? boxModelObject()->paddingRight() : boxModelObject()->paddingBottom();
     141        return isHorizontal() ? boxModelObject()->paddingRight() : boxModelObject()->paddingBottom();
    142142    }
    143143
     
    242242            && logicalLeftVisualOverflow == logicalLeft() && logicalRightVisualOverflow == logicalRight())
    243243            return;
    244        
    245         int width = isVertical() ? logicalHeight() : logicalWidth();
    246         int height = isVertical() ? logicalWidth() : logicalHeight();
    247        
    248         m_overflow = adoptPtr(new RenderOverflow(IntRect(m_x, m_y, width, height)));   
    249     }
    250 
    251     if (isVertical()) {
     244        m_overflow = adoptPtr(new RenderOverflow(IntRect(m_x, m_y, width(), height())));   
     245    }
     246
     247    if (isHorizontal()) {
     248        m_overflow->setLeftLayoutOverflow(logicalLeftLayoutOverflow);
     249        m_overflow->setRightLayoutOverflow(logicalRightLayoutOverflow);
     250        m_overflow->setLeftVisualOverflow(logicalLeftVisualOverflow);
     251        m_overflow->setRightVisualOverflow(logicalRightVisualOverflow);
     252    } else {
    252253        m_overflow->setTopLayoutOverflow(logicalLeftLayoutOverflow);
    253254        m_overflow->setBottomLayoutOverflow(logicalRightLayoutOverflow);
    254255        m_overflow->setTopVisualOverflow(logicalLeftVisualOverflow);
    255256        m_overflow->setBottomVisualOverflow(logicalRightVisualOverflow); 
    256     } else {
    257         m_overflow->setLeftLayoutOverflow(logicalLeftLayoutOverflow);
    258         m_overflow->setRightLayoutOverflow(logicalRightLayoutOverflow);
    259         m_overflow->setLeftVisualOverflow(logicalLeftVisualOverflow);
    260         m_overflow->setRightVisualOverflow(logicalRightVisualOverflow);
    261257    }
    262258}
     
    269265            && logicalTopVisualOverflow == logicalTop() && logicalBottomVisualOverflow == logicalBottom())
    270266            return;
    271            
    272         int width = isVertical() ? logicalHeight() : logicalWidth();
    273         int height = isVertical() ? logicalWidth() : logicalHeight();
    274        
    275         m_overflow = adoptPtr(new RenderOverflow(IntRect(m_x, m_y, width, height)));
    276     }
    277 
    278     if (!isVertical()) {
     267        m_overflow = adoptPtr(new RenderOverflow(IntRect(m_x, m_y, width(), height())));
     268    }
     269
     270    if (isHorizontal()) {
    279271        m_overflow->setTopLayoutOverflow(logicalTopLayoutOverflow);
    280272        m_overflow->setBottomLayoutOverflow(logicalBottomLayoutOverflow);
  • trunk/WebCore/rendering/InlineTextBox.cpp

    r71043 r71055  
    163163        logicalWidth = m_logicalWidth - r.x();
    164164   
    165     IntPoint topPoint = m_isVertical ? IntPoint(tx + selTop, ty + m_y + r.x()) : IntPoint(tx + m_x + r.x(), ty + selTop);
    166     int width = m_isVertical ? selHeight : logicalWidth;
    167     int height = m_isVertical ? logicalWidth : selHeight;
     165    IntPoint topPoint = isHorizontal() ? IntPoint(tx + m_x + r.x(), ty + selTop) : IntPoint(tx + selTop, ty + m_y + r.x());
     166    int width = isHorizontal() ? logicalWidth : selHeight;
     167    int height = isHorizontal() ? selHeight : logicalWidth;
    168168   
    169169    return IntRect(topPoint, IntSize(width, height));
     
    322322}
    323323
    324 FloatSize InlineTextBox::applyShadowToGraphicsContext(GraphicsContext* context, const ShadowData* shadow, const FloatRect& textRect, bool stroked, bool opaque, bool vertical)
     324FloatSize InlineTextBox::applyShadowToGraphicsContext(GraphicsContext* context, const ShadowData* shadow, const FloatRect& textRect, bool stroked, bool opaque, bool horizontal)
    325325{
    326326    if (!shadow)
     
    328328
    329329    FloatSize extraOffset;
    330     int shadowX = vertical ? shadow->y() : shadow->x();
    331     int shadowY = vertical ? -shadow->x() : shadow->y();
     330    int shadowX = horizontal ? shadow->x() : shadow->y();
     331    int shadowY = horizontal ? shadow->y() : -shadow->x();
    332332    FloatSize shadowOffset(shadowX, shadowY);
    333333    int shadowBlur = shadow->blur();
     
    350350
    351351static void paintTextWithShadows(GraphicsContext* context, const Font& font, const TextRun& textRun, int startOffset, int endOffset, int truncationPoint, const IntPoint& textOrigin,
    352                                  const IntRect& boxRect, const ShadowData* shadow, bool stroked, bool vertical)
     352                                 const IntRect& boxRect, const ShadowData* shadow, bool stroked, bool horizontal)
    353353{
    354354    Color fillColor = context->fillColor();
     
    361361        IntSize extraOffset;
    362362        if (shadow)
    363             extraOffset = roundedIntSize(InlineTextBox::applyShadowToGraphicsContext(context, shadow, boxRect, stroked, opaque, vertical));
     363            extraOffset = roundedIntSize(InlineTextBox::applyShadowToGraphicsContext(context, shadow, boxRect, stroked, opaque, horizontal));
    364364        else if (!opaque)
    365365            context->setFillColor(fillColor, fillColorSpace);
     
    398398    int logicalLeftOverflow = parent()->logicalLeft() - parent()->logicalLeftVisualOverflow();
    399399    int logicalRightOverflow = parent()->logicalRightVisualOverflow() - (parent()->logicalLeft() + parent()->logicalWidth());
    400     int logicalStart = logicalLeft() - logicalLeftOverflow + (isVertical() ? ty : tx);
     400    int logicalStart = logicalLeft() - logicalLeftOverflow + (isHorizontal() ? tx : ty);
    401401    int logicalExtent = logicalWidth() + logicalLeftOverflow + logicalRightOverflow;
    402402   
    403     int paintEnd = isVertical() ? paintInfo.rect.bottom() : paintInfo.rect.right();
    404     int paintStart = isVertical() ? paintInfo.rect.y() : paintInfo.rect.x();
     403    int paintEnd = isHorizontal() ? paintInfo.rect.right() : paintInfo.rect.bottom();
     404    int paintStart = isHorizontal() ? paintInfo.rect.x() : paintInfo.rect.y();
    405405   
    406406    if (logicalStart >= paintEnd || logicalStart + logicalExtent <= paintStart)
     
    428428            int widthOfHiddenText = m_logicalWidth - widthOfVisibleText;
    429429            // FIXME: The hit testing logic also needs to take this translation int account.
    430             if (!m_isVertical)
     430            if (isHorizontal())
    431431                tx += isLeftToRightDirection() ? widthOfHiddenText : -widthOfHiddenText;
    432432            else
     
    448448    IntRect boxRect(boxOrigin, IntSize(logicalWidth(), logicalHeight()));
    449449
    450     if (m_isVertical) {
     450    if (!isHorizontal()) {
    451451        context->save();
    452452        context->translate(boxRect.x(), boxRect.bottom());
     
    575575        if (!paintSelectedTextSeparately || ePos <= sPos) {
    576576            // FIXME: Truncate right-to-left text correctly.
    577             paintTextWithShadows(context, font, textRun, 0, length, length, textOrigin, boxRect, textShadow, textStrokeWidth > 0, m_isVertical);
     577            paintTextWithShadows(context, font, textRun, 0, length, length, textOrigin, boxRect, textShadow, textStrokeWidth > 0, isHorizontal());
    578578        } else
    579             paintTextWithShadows(context, font, textRun, ePos, sPos, length, textOrigin, boxRect, textShadow, textStrokeWidth > 0, m_isVertical);
     579            paintTextWithShadows(context, font, textRun, ePos, sPos, length, textOrigin, boxRect, textShadow, textStrokeWidth > 0, isHorizontal());
    580580
    581581        if (textStrokeWidth > 0)
     
    589589
    590590        updateGraphicsContext(context, selectionFillColor, selectionStrokeColor, selectionStrokeWidth, styleToUse->colorSpace());
    591         paintTextWithShadows(context, font, textRun, sPos, ePos, length, textOrigin, boxRect, selectionShadow, selectionStrokeWidth > 0, m_isVertical);
     591        paintTextWithShadows(context, font, textRun, sPos, ePos, length, textOrigin, boxRect, selectionShadow, selectionStrokeWidth > 0, isHorizontal());
    592592
    593593        if (selectionStrokeWidth > 0)
     
    630630    }
    631631   
    632     if (m_isVertical)
     632    if (!isHorizontal())
    633633        context->restore();
    634634}
     
    773773            IntRect shadowRect(localOrigin, IntSize(width, baseline + 2));
    774774            shadowRect.inflate(s->blur());
    775             int shadowX = m_isVertical ? s->y() : s->x();
    776             int shadowY = m_isVertical ? -s->x() : s->y();
     775            int shadowX = isHorizontal() ? s->x() : s->y();
     776            int shadowY = isHorizontal() ? s->y() : -s->x();
    777777            shadowRect.move(shadowX, shadowY);
    778778            clipRect.unite(shadowRect);
     
    796796                extraOffset = 0;
    797797            }
    798             int shadowX = m_isVertical ? shadow->y() : shadow->x();
    799             int shadowY = m_isVertical ? -shadow->x() : shadow->y();
     798            int shadowX = isHorizontal() ? shadow->x() : shadow->y();
     799            int shadowY = isHorizontal() ? shadow->y() : -shadow->x();
    800800            context->setShadow(IntSize(shadowX, shadowY - extraOffset), shadow->blur(), shadow->color(), colorSpace);
    801801            setShadow = true;
  • trunk/WebCore/rendering/InlineTextBox.h

    r70482 r71055  
    128128
    129129    // Needs to be public, so the static paintTextWithShadows() function can use it.
    130     static FloatSize applyShadowToGraphicsContext(GraphicsContext*, const ShadowData*, const FloatRect& textRect, bool stroked, bool opaque, bool vertical);
     130    static FloatSize applyShadowToGraphicsContext(GraphicsContext*, const ShadowData*, const FloatRect& textRect, bool stroked, bool opaque, bool horizontal);
    131131
    132132private:
  • trunk/WebCore/rendering/RenderBlockLineLayout.cpp

    r70848 r71055  
    209209            parentBox = static_cast<InlineFlowBox*>(newBox);
    210210            parentBox->setFirstLineStyleBit(firstLine);
    211             parentBox->setIsVertical(!style()->isHorizontalWritingMode());
     211            parentBox->setIsHorizontal(style()->isHorizontalWritingMode());
    212212            constructedNewBox = true;
    213213        }
  • trunk/WebCore/rendering/RenderBox.cpp

    r71043 r71055  
    31863186}
    31873187
    3188 void RenderBox::blockDirectionOverflow(bool isLineVertical, int& logicalTopLayoutOverflow, int& logicalBottomLayoutOverflow,
     3188void RenderBox::blockDirectionOverflow(bool isLineHorizontal, int& logicalTopLayoutOverflow, int& logicalBottomLayoutOverflow,
    31893189                                       int& logicalTopVisualOverflow, int& logicalBottomVisualOverflow)
    31903190{
    3191     if (isLineVertical) {
     3191    if (isLineHorizontal) {
     3192        logicalTopLayoutOverflow = topLayoutOverflow();
     3193        logicalBottomLayoutOverflow = bottomLayoutOverflow();
     3194        logicalTopVisualOverflow = topVisualOverflow();
     3195        logicalBottomVisualOverflow = bottomVisualOverflow();
     3196    } else {
    31923197        logicalTopLayoutOverflow = leftLayoutOverflow();
    31933198        logicalBottomLayoutOverflow = rightLayoutOverflow();
    31943199        logicalTopVisualOverflow = leftVisualOverflow();
    31953200        logicalBottomVisualOverflow = rightVisualOverflow();
    3196     } else {
    3197         logicalTopLayoutOverflow = topLayoutOverflow();
    3198         logicalBottomLayoutOverflow = bottomLayoutOverflow();
    3199         logicalTopVisualOverflow = topVisualOverflow();
    3200         logicalBottomVisualOverflow = bottomVisualOverflow();
    3201     }
     3201    }
    32023202}
    32033203
  • trunk/WebCore/rendering/RenderBox.h

    r71043 r71055  
    156156    void clearLayoutOverflow();
    157157
    158     void blockDirectionOverflow(bool isLineVertical, int& logicalTopLayoutOverflow, int& logicalBottomLayoutOverflow,
     158    void blockDirectionOverflow(bool isLineHorizontal, int& logicalTopLayoutOverflow, int& logicalBottomLayoutOverflow,
    159159                                int& logicalTopVisualOverflow, int& logicalBottomVisualOverflow);
    160160
  • trunk/WebCore/rendering/RenderBoxModelObject.cpp

    r70848 r71055  
    527527        if (!includeLeftEdge) {
    528528            topLeft = IntSize();
    529             if (box->isVertical())
     529            if (box->isHorizontal())
     530                bottomLeft = IntSize();
     531            else
     532                topRight = IntSize();
     533        }
     534       
     535        if (!includeRightEdge) {
     536            if (box->isHorizontal())
    530537                topRight = IntSize();
    531538            else
    532539                bottomLeft = IntSize();
    533         }
    534        
    535         if (!includeRightEdge) {
    536             if (box->isVertical())
    537                 bottomLeft = IntSize();
    538             else
    539                 topRight = IntSize();
    540540            bottomRight = IntSize();
    541541        }
  • trunk/WebCore/rendering/RenderLineBoxList.cpp

    r70917 r71055  
    279279        return false;
    280280
    281     bool isVertical = firstLineBox()->isVertical();
    282    
    283     int logicalPointStart = isVertical ? x - result.leftPadding() : y - result.topPadding();
    284     int logicalPointEnd = isVertical ? x + result.rightPadding() : y + result.bottomPadding();
    285     int offset = isVertical ? tx : ty;
     281    bool isHorizontal = firstLineBox()->isHorizontal();
     282   
     283    int logicalPointStart = isHorizontal ? y - result.topPadding() : x - result.leftPadding();
     284    int logicalPointEnd = isHorizontal ? y + result.bottomPadding() : x + result.rightPadding();
     285    int offset = isHorizontal ? ty : tx;
    286286
    287287    // We can check the first box and last box and avoid hit testing if we don't
  • trunk/WebCore/rendering/RootInlineBox.cpp

    r70330 r71055  
    4949    , m_blockLogicalHeight(0)
    5050{
    51     setIsVertical(!block->style()->isHorizontalWritingMode());
     51    setIsHorizontal(block->style()->isHorizontalWritingMode());
    5252}
    5353
     
    100100    EllipsisBox* ellipsisBox = new (renderer()->renderArena()) EllipsisBox(renderer(), ellipsisStr, this,
    101101                                                              ellipsisWidth - (markupBox ? markupBox->logicalWidth() : 0), logicalHeight(),
    102                                                               y(), !prevRootBox(), isVertical(), markupBox);
     102                                                              y(), !prevRootBox(), isHorizontal(), markupBox);
    103103   
    104104    if (!gEllipsisBoxMap)
  • trunk/WebCore/rendering/RootInlineBox.h

    r70072 r71055  
    8989    virtual void clearTruncation();
    9090
    91     virtual int baselinePosition() const { return boxModelObject()->baselinePosition(m_firstLine, m_isVertical ? VerticalLine : HorizontalLine, PositionOfInteriorLineBoxes); }
    92     virtual int lineHeight() const { return boxModelObject()->lineHeight(m_firstLine, m_isVertical ? VerticalLine : HorizontalLine, PositionOfInteriorLineBoxes); }
     91    virtual int baselinePosition() const { return boxModelObject()->baselinePosition(m_firstLine, isHorizontal() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes); }
     92    virtual int lineHeight() const { return boxModelObject()->lineHeight(m_firstLine, isHorizontal() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes); }
    9393
    9494#if PLATFORM(MAC)
Note: See TracChangeset for help on using the changeset viewer.