https://bugs.webkit.org/show_bug.cgi?id=48776
authorhyatt@apple.com <hyatt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 1 Nov 2010 21:13:55 +0000 (21:13 +0000)
committerhyatt@apple.com <hyatt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 1 Nov 2010 21:13:55 +0000 (21:13 +0000)
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):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@71055 268f45cc-cd09-0410-ab3c-d52691b4dbfc

14 files changed:
WebCore/ChangeLog
WebCore/rendering/InlineBox.cpp
WebCore/rendering/InlineBox.h
WebCore/rendering/InlineFlowBox.cpp
WebCore/rendering/InlineFlowBox.h
WebCore/rendering/InlineTextBox.cpp
WebCore/rendering/InlineTextBox.h
WebCore/rendering/RenderBlockLineLayout.cpp
WebCore/rendering/RenderBox.cpp
WebCore/rendering/RenderBox.h
WebCore/rendering/RenderBoxModelObject.cpp
WebCore/rendering/RenderLineBoxList.cpp
WebCore/rendering/RootInlineBox.cpp
WebCore/rendering/RootInlineBox.h

index 393e522..c8b2f3d 100644 (file)
@@ -1,3 +1,66 @@
+2010-11-01  David Hyatt  <hyatt@apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        https://bugs.webkit.org/show_bug.cgi?id=48776
+        
+        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):
+
 2010-11-01  Simon Fraser  <simon.fraser@apple.com>
 
         Reviewed by Dave Hyatt.
index 6191253..fa3bb66 100644 (file)
@@ -95,7 +95,7 @@ int InlineBox::logicalHeight() const
     if (renderer()->isText())
         return m_isText ? renderer()->style(m_firstLine)->font().height() : 0;
     if (renderer()->isBox() && parent())
-        return m_isVertical ? toRenderBox(m_renderer)->width() : toRenderBox(m_renderer)->height();
+        return isHorizontal() ? toRenderBox(m_renderer)->height() : toRenderBox(m_renderer)->width();
 
     ASSERT(isInlineFlowBox());
     RenderBoxModelObject* flowObject = boxModelObject();
index 1e4b8bf..a55bf80 100644 (file)
@@ -51,7 +51,7 @@ public:
 #if ENABLE(SVG)
         , m_hasVirtualLogicalHeight(false)
 #endif
-        , m_isVertical(false)
+        , m_isHorizontal(true)
         , m_endsWithBreak(false)
         , m_hasSelectedChildren(false)
         , m_hasEllipsisBoxOrHyphen(false)
@@ -69,7 +69,7 @@ public:
     }
 
     InlineBox(RenderObject* obj, int x, int y, int logicalWidth, bool firstLine, bool constructed,
-              bool dirty, bool extracted, bool isVertical, InlineBox* next, InlineBox* prev, InlineFlowBox* parent)
+              bool dirty, bool extracted, bool isHorizontal, InlineBox* next, InlineBox* prev, InlineFlowBox* parent)
         : m_next(next)
         , m_prev(prev)
         , m_parent(parent)
@@ -85,7 +85,7 @@ public:
 #if ENABLE(SVG)
         , m_hasVirtualLogicalHeight(false)
 #endif
-        , m_isVertical(isVertical)
+        , m_isHorizontal(isHorizontal)
         , m_endsWithBreak(false)
         , m_hasSelectedChildren(false)   
         , m_hasEllipsisBoxOrHyphen(false)
@@ -152,8 +152,8 @@ public:
         return 0;
     }
 
-    bool isVertical() const { return m_isVertical; }
-    void setIsVertical(bool v) { m_isVertical = v; }
+    bool isHorizontal() const { return m_isHorizontal; }
+    void setIsHorizontal(bool horizontal) { m_isHorizontal = horizontal; }
 
     virtual IntRect calculateBoundaries() const
     {
@@ -216,26 +216,26 @@ public:
     void setY(int y) { m_y = y; }
     int y() const { return m_y; }
 
-    int width() const { return m_isVertical ? logicalHeight() : logicalWidth(); }
-    int height() const { return m_isVertical ? logicalWidth() : logicalHeight(); }
+    int width() const { return isHorizontal() ? logicalWidth() : logicalHeight(); }
+    int height() const { return isHorizontal() ? logicalHeight() : logicalWidth(); }
 
     // The logicalLeft position is the left edge of the line box in a horizontal line and the top edge in a vertical line.
-    int logicalLeft() const { return !m_isVertical ? m_x : m_y; }
+    int logicalLeft() const { return isHorizontal() ? m_x : m_y; }
     int logicalRight() const { return logicalLeft() + logicalWidth(); }
     void setLogicalLeft(int left)
     {
-        if (!m_isVertical)
+        if (isHorizontal())
             m_x = left;
         else
             m_y = left;
     }
 
     // The logicalTop[ position is the top edge of the line box in a horizontal line and the left edge in a vertical line.
-    int logicalTop() const { return !m_isVertical ? m_y : m_x; }
+    int logicalTop() const { return isHorizontal() ? m_y : m_x; }
     int logicalBottom() const { return logicalTop() + logicalHeight(); }
     void setLogicalTop(int top)
     {
-        if (!m_isVertical)
+        if (isHorizontal())
             m_y = top;
         else
             m_x = top;
@@ -248,8 +248,8 @@ public:
     // The logical height is our extent in the block flow direction, i.e., height for horizontal text and width for vertical text.
     int logicalHeight() const;
 
-    virtual int baselinePosition() const { return boxModelObject()->baselinePosition(m_firstLine, m_isVertical ? VerticalLine : HorizontalLine, PositionOnContainingLine); }
-    virtual int lineHeight() const { return boxModelObject()->lineHeight(m_firstLine, m_isVertical ? VerticalLine : HorizontalLine, PositionOnContainingLine); }
+    virtual int baselinePosition() const { return boxModelObject()->baselinePosition(m_firstLine, isHorizontal() ? HorizontalLine : VerticalLine, PositionOnContainingLine); }
+    virtual int lineHeight() const { return boxModelObject()->lineHeight(m_firstLine, isHorizontal() ? HorizontalLine : VerticalLine, PositionOnContainingLine); }
     
 
     virtual int caretMinOffset() const;
@@ -319,7 +319,7 @@ protected:
     bool m_extracted : 1;
     bool m_hasVirtualLogicalHeight : 1;
 
-    bool m_isVertical : 1;
+    bool m_isHorizontal : 1;
 
     // for RootInlineBox
     bool m_endsWithBreak : 1;  // Whether the line ends with a <br>.
index 8287ceb..a04c16e 100644 (file)
@@ -80,7 +80,7 @@ void InlineFlowBox::addToLine(InlineBox* child)
         m_lastChild = child;
     }
     child->setFirstLineStyleBit(m_firstLine);
-    child->setIsVertical(m_isVertical);
+    child->setIsHorizontal(isHorizontal());
     if (child->isText())
         m_hasTextChildren = true;
 
@@ -328,22 +328,22 @@ int InlineFlowBox::placeBoxesInInlineDirection(int logicalLeft, bool& needsWordS
             } else if (!curr->renderer()->isListMarker() || toRenderListMarker(curr->renderer())->isInside()) {
                 // The box can have a different writing-mode than the overall line, so this is a bit complicated.
                 // Just get all the physical margin and overflow values by hand based off |isVertical|.
-                int logicalLeftMargin = !isVertical() ? curr->boxModelObject()->marginLeft() : curr->boxModelObject()->marginTop();
-                int logicalRightMargin = !isVertical() ? curr->boxModelObject()->marginRight() : curr->boxModelObject()->marginBottom();
+                int logicalLeftMargin = isHorizontal() ? curr->boxModelObject()->marginLeft() : curr->boxModelObject()->marginTop();
+                int logicalRightMargin = isHorizontal() ? curr->boxModelObject()->marginRight() : curr->boxModelObject()->marginBottom();
                 
                 logicalLeft += logicalLeftMargin;
                 curr->setLogicalLeft(logicalLeft);
                        
                 RenderBox* box = toRenderBox(curr->renderer());
 
-                int childOverflowLogicalLeft = box->hasOverflowClip() ? 0 : (!isVertical() ? box->leftLayoutOverflow() : box->topLayoutOverflow());
-                int childOverflowLogicalRight = box->hasOverflowClip() ? curr->logicalWidth() : (!isVertical() ? box->rightLayoutOverflow() : box->bottomLayoutOverflow());
+                int childOverflowLogicalLeft = box->hasOverflowClip() ? 0 : (isHorizontal() ? box->leftLayoutOverflow() : box->topLayoutOverflow());
+                int childOverflowLogicalRight = box->hasOverflowClip() ? curr->logicalWidth() : (isHorizontal() ? box->rightLayoutOverflow() : box->bottomLayoutOverflow());
                 
                 logicalLeftLayoutOverflow = min(logicalLeft + childOverflowLogicalLeft, logicalLeftLayoutOverflow);
                 logicalRightLayoutOverflow = max(logicalLeft + childOverflowLogicalRight, logicalRightLayoutOverflow);
 
-                logicalLeftVisualOverflow = min(logicalLeft + (!isVertical() ? box->leftVisualOverflow() : box->topVisualOverflow()), logicalLeftVisualOverflow);
-                logicalRightVisualOverflow = max(logicalLeft + (!isVertical() ? box->rightVisualOverflow() : box->bottomVisualOverflow()), logicalRightVisualOverflow);
+                logicalLeftVisualOverflow = min(logicalLeft + (isHorizontal() ? box->leftVisualOverflow() : box->topVisualOverflow()), logicalLeftVisualOverflow);
+                logicalRightVisualOverflow = max(logicalLeft + (isHorizontal() ? box->rightVisualOverflow() : box->bottomVisualOverflow()), logicalRightVisualOverflow);
                
                 logicalLeft += curr->logicalWidth() + logicalRightMargin;
             }
@@ -633,7 +633,7 @@ void InlineFlowBox::computeBlockDirectionOverflow(int lineTop, int lineBottom, b
             int childBottomVisualOverflow;
             
             RenderBox* box = toRenderBox(curr->renderer());
-            box->blockDirectionOverflow(isVertical(), childTopLayoutOverflow, childBottomLayoutOverflow,
+            box->blockDirectionOverflow(isHorizontal(), childTopLayoutOverflow, childBottomLayoutOverflow,
                                         childTopVisualOverflow, childBottomVisualOverflow);
             
             if (box->hasOverflowClip()) {
@@ -773,10 +773,10 @@ void InlineFlowBox::paintFillLayer(const PaintInfo& paintInfo, const Color& c, c
         int totalLogicalWidth = logicalOffsetOnLine;
         for (InlineFlowBox* curr = this; curr; curr = curr->nextLineBox())
             totalLogicalWidth += curr->logicalWidth();
-        int stripX = tx - (isVertical() ? 0 : logicalOffsetOnLine);
-        int stripY = ty - (isVertical() ? logicalOffsetOnLine : 0);
-        int stripWidth = isVertical() ? width() : totalLogicalWidth;
-        int stripHeight = isVertical() ? totalLogicalWidth : height();
+        int stripX = tx - (isHorizontal() ? logicalOffsetOnLine : 0);
+        int stripY = ty - (isHorizontal() ? 0 : logicalOffsetOnLine);
+        int stripWidth = isHorizontal() ? totalLogicalWidth : width();
+        int stripHeight = isHorizontal() ? height() : totalLogicalWidth;
         paintInfo.context->save();
         paintInfo.context->clip(IntRect(tx, ty, width(), height()));
         boxModelObject()->paintFillLayerExtended(paintInfo, c, fillLayer, stripX, stripY, stripWidth, stripHeight, this, op);
@@ -802,15 +802,15 @@ void InlineFlowBox::paintBoxDecorations(PaintInfo& paintInfo, int tx, int ty)
 
     int x = m_x;
     int y = m_y;
-    int w = m_isVertical ? logicalHeight() : logicalWidth();
-    int h = m_isVertical ? logicalWidth() : logicalHeight();
+    int w = width();
+    int h = height();
 
     // Constrain our background/border painting to the line top and bottom if necessary.
     bool noQuirksMode = renderer()->document()->inNoQuirksMode();
     if (!hasTextChildren() && !noQuirksMode) {
         RootInlineBox* rootBox = root();
-        int& top = m_isVertical ? x : y;
-        int& logicalHeight = m_isVertical ? w : h;
+        int& top = isHorizontal() ? y : x;
+        int& logicalHeight = isHorizontal() ? h : w;
         int bottom = min(rootBox->lineBottom(), top + logicalHeight);
         top = max(rootBox->lineTop(), top);
         logicalHeight = bottom - top;
@@ -865,10 +865,10 @@ void InlineFlowBox::paintBoxDecorations(PaintInfo& paintInfo, int tx, int ty)
                 int totalLogicalWidth = logicalOffsetOnLine;
                 for (InlineFlowBox* curr = this; curr; curr = curr->nextLineBox())
                     totalLogicalWidth += curr->logicalWidth();
-                int stripX = tx - (isVertical() ? 0 : logicalOffsetOnLine);
-                int stripY = ty - (isVertical() ? logicalOffsetOnLine : 0);
-                int stripWidth = isVertical() ? w : totalLogicalWidth;
-                int stripHeight = isVertical() ? totalLogicalWidth : h;
+                int stripX = tx - (isHorizontal() ? logicalOffsetOnLine : 0);
+                int stripY = ty - (isHorizontal() ? 0 : logicalOffsetOnLine);
+                int stripWidth = isHorizontal() ? totalLogicalWidth : w;
+                int stripHeight = isHorizontal() ? h : totalLogicalWidth;
                 context->save();
                 context->clip(IntRect(tx, ty, w, h));
                 boxModelObject()->paintBorder(context, stripX, stripY, stripWidth, stripHeight, renderer()->style());
@@ -885,15 +885,15 @@ void InlineFlowBox::paintMask(PaintInfo& paintInfo, int tx, int ty)
 
     int x = m_x;
     int y = m_y;
-    int w = m_isVertical ? logicalHeight() : logicalWidth();
-    int h = m_isVertical ? logicalWidth() : logicalHeight();
+    int w = width();
+    int h = height();
 
     // Constrain our background/border painting to the line top and bottom if necessary.
     bool noQuirksMode = renderer()->document()->inNoQuirksMode();
     if (!hasTextChildren() && !noQuirksMode) {
         RootInlineBox* rootBox = root();
-        int& top = m_isVertical ? x : y;
-        int& logicalHeight = m_isVertical ? w : h;
+        int& top = isHorizontal() ? y : x;
+        int& logicalHeight = isHorizontal() ? h : w;
         int bottom = min(rootBox->lineBottom(), top + logicalHeight);
         top = max(rootBox->lineTop(), top);
         logicalHeight = bottom - top;
@@ -943,10 +943,10 @@ void InlineFlowBox::paintMask(PaintInfo& paintInfo, int tx, int ty)
         int totalLogicalWidth = logicalOffsetOnLine;
         for (InlineFlowBox* curr = this; curr; curr = curr->nextLineBox())
             totalLogicalWidth += curr->logicalWidth();
-        int stripX = tx - (isVertical() ? 0 : logicalOffsetOnLine);
-        int stripY = ty - (isVertical() ? logicalOffsetOnLine : 0);
-        int stripWidth = isVertical() ? w : totalLogicalWidth;
-        int stripHeight = isVertical() ? totalLogicalWidth : h;
+        int stripX = tx - (isHorizontal() ? logicalOffsetOnLine : 0);
+        int stripY = ty - (isHorizontal() ? 0 : logicalOffsetOnLine);
+        int stripWidth = isHorizontal() ? totalLogicalWidth : w;
+        int stripHeight = isHorizontal() ? h : totalLogicalWidth;
         paintInfo.context->save();
         paintInfo.context->clip(IntRect(tx, ty, w, h));
         boxModelObject()->paintNinePieceImage(paintInfo.context, stripX, stripY, stripWidth, stripHeight, renderer()->style(), maskNinePieceImage, compositeOp);
index ee11162..79a3e29 100644 (file)
@@ -108,37 +108,37 @@ public:
     {
         if (!includeLogicalLeftEdge())
             return 0;
-        return !isVertical() ? boxModelObject()->marginLeft() : boxModelObject()->marginTop();
+        return isHorizontal() ? boxModelObject()->marginLeft() : boxModelObject()->marginTop();
     }
     int marginLogicalRight() const
     {
         if (!includeLogicalRightEdge())
             return 0;
-        return !isVertical() ? boxModelObject()->marginRight() : boxModelObject()->marginBottom();
+        return isHorizontal() ? boxModelObject()->marginRight() : boxModelObject()->marginBottom();
     }
     int borderLogicalLeft() const
     {
         if (!includeLogicalLeftEdge())
             return 0;
-        return !isVertical() ? renderer()->style()->borderLeftWidth() : renderer()->style()->borderTopWidth();
+        return isHorizontal() ? renderer()->style()->borderLeftWidth() : renderer()->style()->borderTopWidth();
     }
     int borderLogicalRight() const
     {
         if (!includeLogicalRightEdge())
             return 0;
-        return !isVertical() ? renderer()->style()->borderRightWidth() : renderer()->style()->borderBottomWidth();
+        return isHorizontal() ? renderer()->style()->borderRightWidth() : renderer()->style()->borderBottomWidth();
     }
     int paddingLogicalLeft() const
     {
         if (!includeLogicalLeftEdge())
             return 0;
-        return !isVertical() ? boxModelObject()->paddingLeft() : boxModelObject()->paddingTop();
+        return isHorizontal() ? boxModelObject()->paddingLeft() : boxModelObject()->paddingTop();
     }
     int paddingLogicalRight() const
     {
         if (!includeLogicalRightEdge())
             return 0;
-        return !isVertical() ? boxModelObject()->paddingRight() : boxModelObject()->paddingBottom();
+        return isHorizontal() ? boxModelObject()->paddingRight() : boxModelObject()->paddingBottom();
     }
 
     bool includeLogicalLeftEdge() const { return m_includeLogicalLeftEdge; }
@@ -241,23 +241,19 @@ inline void InlineFlowBox::setInlineDirectionOverflowPositions(int logicalLeftLa
         if (logicalLeftLayoutOverflow == logicalLeft() && logicalRightLayoutOverflow == logicalRight() 
             && logicalLeftVisualOverflow == logicalLeft() && logicalRightVisualOverflow == logicalRight())
             return;
-        
-        int width = isVertical() ? logicalHeight() : logicalWidth();
-        int height = isVertical() ? logicalWidth() : logicalHeight();
-        
-        m_overflow = adoptPtr(new RenderOverflow(IntRect(m_x, m_y, width, height)));   
+        m_overflow = adoptPtr(new RenderOverflow(IntRect(m_x, m_y, width(), height())));   
     }
 
-    if (isVertical()) {
-        m_overflow->setTopLayoutOverflow(logicalLeftLayoutOverflow);
-        m_overflow->setBottomLayoutOverflow(logicalRightLayoutOverflow);
-        m_overflow->setTopVisualOverflow(logicalLeftVisualOverflow); 
-        m_overflow->setBottomVisualOverflow(logicalRightVisualOverflow);  
-    } else {
+    if (isHorizontal()) {
         m_overflow->setLeftLayoutOverflow(logicalLeftLayoutOverflow);
         m_overflow->setRightLayoutOverflow(logicalRightLayoutOverflow);
         m_overflow->setLeftVisualOverflow(logicalLeftVisualOverflow); 
         m_overflow->setRightVisualOverflow(logicalRightVisualOverflow);
+    } else {
+        m_overflow->setTopLayoutOverflow(logicalLeftLayoutOverflow);
+        m_overflow->setBottomLayoutOverflow(logicalRightLayoutOverflow);
+        m_overflow->setTopVisualOverflow(logicalLeftVisualOverflow); 
+        m_overflow->setBottomVisualOverflow(logicalRightVisualOverflow);  
     }
 }
 
@@ -268,14 +264,10 @@ inline void InlineFlowBox::setBlockDirectionOverflowPositions(int logicalTopLayo
         if (logicalTopLayoutOverflow == logicalTop() && logicalBottomLayoutOverflow == logicalBottom()
             && logicalTopVisualOverflow == logicalTop() && logicalBottomVisualOverflow == logicalBottom())
             return;
-            
-        int width = isVertical() ? logicalHeight() : logicalWidth();
-        int height = isVertical() ? logicalWidth() : logicalHeight();
-        
-        m_overflow = adoptPtr(new RenderOverflow(IntRect(m_x, m_y, width, height)));
+        m_overflow = adoptPtr(new RenderOverflow(IntRect(m_x, m_y, width(), height())));
     }
 
-    if (!isVertical()) {
+    if (isHorizontal()) {
         m_overflow->setTopLayoutOverflow(logicalTopLayoutOverflow);
         m_overflow->setBottomLayoutOverflow(logicalBottomLayoutOverflow);
         m_overflow->setTopVisualOverflow(logicalTopVisualOverflow); 
index e545d37..f29805e 100644 (file)
@@ -162,9 +162,9 @@ IntRect InlineTextBox::selectionRect(int tx, int ty, int startPos, int endPos)
     else if (r.right() > m_logicalWidth)
         logicalWidth = m_logicalWidth - r.x();
     
-    IntPoint topPoint = m_isVertical ? IntPoint(tx + selTop, ty + m_y + r.x()) : IntPoint(tx + m_x + r.x(), ty + selTop);
-    int width = m_isVertical ? selHeight : logicalWidth;
-    int height = m_isVertical ? logicalWidth : selHeight;
+    IntPoint topPoint = isHorizontal() ? IntPoint(tx + m_x + r.x(), ty + selTop) : IntPoint(tx + selTop, ty + m_y + r.x());
+    int width = isHorizontal() ? logicalWidth : selHeight;
+    int height = isHorizontal() ? selHeight : logicalWidth;
     
     return IntRect(topPoint, IntSize(width, height));
 }
@@ -321,14 +321,14 @@ bool InlineTextBox::nodeAtPoint(const HitTestRequest&, HitTestResult& result, in
     return false;
 }
 
-FloatSize InlineTextBox::applyShadowToGraphicsContext(GraphicsContext* context, const ShadowData* shadow, const FloatRect& textRect, bool stroked, bool opaque, bool vertical)
+FloatSize InlineTextBox::applyShadowToGraphicsContext(GraphicsContext* context, const ShadowData* shadow, const FloatRect& textRect, bool stroked, bool opaque, bool horizontal)
 {
     if (!shadow)
         return FloatSize();
 
     FloatSize extraOffset;
-    int shadowX = vertical ? shadow->y() : shadow->x();
-    int shadowY = vertical ? -shadow->x() : shadow->y();
+    int shadowX = horizontal ? shadow->x() : shadow->y();
+    int shadowY = horizontal ? shadow->y() : -shadow->x();
     FloatSize shadowOffset(shadowX, shadowY);
     int shadowBlur = shadow->blur();
     const Color& shadowColor = shadow->color();
@@ -349,7 +349,7 @@ FloatSize InlineTextBox::applyShadowToGraphicsContext(GraphicsContext* context,
 }
 
 static void paintTextWithShadows(GraphicsContext* context, const Font& font, const TextRun& textRun, int startOffset, int endOffset, int truncationPoint, const IntPoint& textOrigin,
-                                 const IntRect& boxRect, const ShadowData* shadow, bool stroked, bool vertical)
+                                 const IntRect& boxRect, const ShadowData* shadow, bool stroked, bool horizontal)
 {
     Color fillColor = context->fillColor();
     ColorSpace fillColorSpace = context->fillColorSpace();
@@ -360,7 +360,7 @@ static void paintTextWithShadows(GraphicsContext* context, const Font& font, con
     do {
         IntSize extraOffset;
         if (shadow)
-            extraOffset = roundedIntSize(InlineTextBox::applyShadowToGraphicsContext(context, shadow, boxRect, stroked, opaque, vertical));
+            extraOffset = roundedIntSize(InlineTextBox::applyShadowToGraphicsContext(context, shadow, boxRect, stroked, opaque, horizontal));
         else if (!opaque)
             context->setFillColor(fillColor, fillColorSpace);
 
@@ -397,11 +397,11 @@ void InlineTextBox::paint(PaintInfo& paintInfo, int tx, int ty)
     // Would it be simpler to just check our own shadow and stroke overflow by hand here?
     int logicalLeftOverflow = parent()->logicalLeft() - parent()->logicalLeftVisualOverflow();
     int logicalRightOverflow = parent()->logicalRightVisualOverflow() - (parent()->logicalLeft() + parent()->logicalWidth());
-    int logicalStart = logicalLeft() - logicalLeftOverflow + (isVertical() ? ty : tx);
+    int logicalStart = logicalLeft() - logicalLeftOverflow + (isHorizontal() ? tx : ty);
     int logicalExtent = logicalWidth() + logicalLeftOverflow + logicalRightOverflow;
     
-    int paintEnd = isVertical() ? paintInfo.rect.bottom() : paintInfo.rect.right();
-    int paintStart = isVertical() ? paintInfo.rect.y() : paintInfo.rect.x();
+    int paintEnd = isHorizontal() ? paintInfo.rect.right() : paintInfo.rect.bottom();
+    int paintStart = isHorizontal() ? paintInfo.rect.x() : paintInfo.rect.y();
     
     if (logicalStart >= paintEnd || logicalStart + logicalExtent <= paintStart)
         return;
@@ -427,7 +427,7 @@ void InlineTextBox::paint(PaintInfo& paintInfo, int tx, int ty)
             int widthOfVisibleText = toRenderText(renderer())->width(m_start, m_truncation, textPos(), m_firstLine);
             int widthOfHiddenText = m_logicalWidth - widthOfVisibleText;
             // FIXME: The hit testing logic also needs to take this translation int account.
-            if (!m_isVertical)
+            if (isHorizontal())
                 tx += isLeftToRightDirection() ? widthOfHiddenText : -widthOfHiddenText;
             else
                 ty += isLeftToRightDirection() ? widthOfHiddenText : -widthOfHiddenText;
@@ -447,7 +447,7 @@ void InlineTextBox::paint(PaintInfo& paintInfo, int tx, int ty)
     IntPoint textOrigin = IntPoint(boxOrigin.x(), boxOrigin.y() + styleToUse->font().ascent());
     IntRect boxRect(boxOrigin, IntSize(logicalWidth(), logicalHeight()));
 
-    if (m_isVertical) {
+    if (!isHorizontal()) {
         context->save();
         context->translate(boxRect.x(), boxRect.bottom());
         context->rotate(static_cast<float>(deg2rad(90.)));
@@ -574,9 +574,9 @@ void InlineTextBox::paint(PaintInfo& paintInfo, int tx, int ty)
         updateGraphicsContext(context, textFillColor, textStrokeColor, textStrokeWidth, styleToUse->colorSpace());
         if (!paintSelectedTextSeparately || ePos <= sPos) {
             // FIXME: Truncate right-to-left text correctly.
-            paintTextWithShadows(context, font, textRun, 0, length, length, textOrigin, boxRect, textShadow, textStrokeWidth > 0, m_isVertical);
+            paintTextWithShadows(context, font, textRun, 0, length, length, textOrigin, boxRect, textShadow, textStrokeWidth > 0, isHorizontal());
         } else
-            paintTextWithShadows(context, font, textRun, ePos, sPos, length, textOrigin, boxRect, textShadow, textStrokeWidth > 0, m_isVertical);
+            paintTextWithShadows(context, font, textRun, ePos, sPos, length, textOrigin, boxRect, textShadow, textStrokeWidth > 0, isHorizontal());
 
         if (textStrokeWidth > 0)
             context->restore();
@@ -588,7 +588,7 @@ void InlineTextBox::paint(PaintInfo& paintInfo, int tx, int ty)
             context->save();
 
         updateGraphicsContext(context, selectionFillColor, selectionStrokeColor, selectionStrokeWidth, styleToUse->colorSpace());
-        paintTextWithShadows(context, font, textRun, sPos, ePos, length, textOrigin, boxRect, selectionShadow, selectionStrokeWidth > 0, m_isVertical);
+        paintTextWithShadows(context, font, textRun, sPos, ePos, length, textOrigin, boxRect, selectionShadow, selectionStrokeWidth > 0, isHorizontal());
 
         if (selectionStrokeWidth > 0)
             context->restore();
@@ -629,7 +629,7 @@ void InlineTextBox::paint(PaintInfo& paintInfo, int tx, int ty)
         }
     }
     
-    if (m_isVertical)
+    if (!isHorizontal())
         context->restore();
 }
 
@@ -772,8 +772,8 @@ void InlineTextBox::paintDecoration(GraphicsContext* context, const IntPoint& bo
         for (const ShadowData* s = shadow; s; s = s->next()) {
             IntRect shadowRect(localOrigin, IntSize(width, baseline + 2));
             shadowRect.inflate(s->blur());
-            int shadowX = m_isVertical ? s->y() : s->x();
-            int shadowY = m_isVertical ? -s->x() : s->y();
+            int shadowX = isHorizontal() ? s->x() : s->y();
+            int shadowY = isHorizontal() ? s->y() : -s->x();
             shadowRect.move(shadowX, shadowY);
             clipRect.unite(shadowRect);
             extraOffset = max(extraOffset, max(0, shadowY) + s->blur());
@@ -795,8 +795,8 @@ void InlineTextBox::paintDecoration(GraphicsContext* context, const IntPoint& bo
                 localOrigin.move(0, -extraOffset);
                 extraOffset = 0;
             }
-            int shadowX = m_isVertical ? shadow->y() : shadow->x();
-            int shadowY = m_isVertical ? -shadow->x() : shadow->y();
+            int shadowX = isHorizontal() ? shadow->x() : shadow->y();
+            int shadowY = isHorizontal() ? shadow->y() : -shadow->x();
             context->setShadow(IntSize(shadowX, shadowY - extraOffset), shadow->blur(), shadow->color(), colorSpace);
             setShadow = true;
             shadow = shadow->next();
index 9c4c72f..a5a77f0 100644 (file)
@@ -127,7 +127,7 @@ public:
     bool containsCaretOffset(int offset) const; // false for offset after line break
 
     // Needs to be public, so the static paintTextWithShadows() function can use it.
-    static FloatSize applyShadowToGraphicsContext(GraphicsContext*, const ShadowData*, const FloatRect& textRect, bool stroked, bool opaque, bool vertical);
+    static FloatSize applyShadowToGraphicsContext(GraphicsContext*, const ShadowData*, const FloatRect& textRect, bool stroked, bool opaque, bool horizontal);
 
 private:
     InlineTextBox* m_prevTextBox; // The previous box that also uses our RenderObject
index e0c5450..191efe7 100644 (file)
@@ -208,7 +208,7 @@ InlineFlowBox* RenderBlock::createLineBoxes(RenderObject* obj, bool firstLine)
             ASSERT(newBox->isInlineFlowBox());
             parentBox = static_cast<InlineFlowBox*>(newBox);
             parentBox->setFirstLineStyleBit(firstLine);
-            parentBox->setIsVertical(!style()->isHorizontalWritingMode());
+            parentBox->setIsHorizontal(style()->isHorizontalWritingMode());
             constructedNewBox = true;
         }
 
index 8c4b644..45bca17 100644 (file)
@@ -3185,20 +3185,20 @@ int RenderBox::baselinePosition(bool /*firstLine*/, LineDirectionMode direction,
     return 0;
 }
 
-void RenderBox::blockDirectionOverflow(bool isLineVertical, int& logicalTopLayoutOverflow, int& logicalBottomLayoutOverflow,
+void RenderBox::blockDirectionOverflow(bool isLineHorizontal, int& logicalTopLayoutOverflow, int& logicalBottomLayoutOverflow,
                                        int& logicalTopVisualOverflow, int& logicalBottomVisualOverflow)
 {
-    if (isLineVertical) {
-        logicalTopLayoutOverflow = leftLayoutOverflow();
-        logicalBottomLayoutOverflow = rightLayoutOverflow();
-        logicalTopVisualOverflow = leftVisualOverflow();
-        logicalBottomVisualOverflow = rightVisualOverflow();
-    } else {
+    if (isLineHorizontal) {
         logicalTopLayoutOverflow = topLayoutOverflow();
         logicalBottomLayoutOverflow = bottomLayoutOverflow();
         logicalTopVisualOverflow = topVisualOverflow();
         logicalBottomVisualOverflow = bottomVisualOverflow();
-    }
+    } else {
+        logicalTopLayoutOverflow = leftLayoutOverflow();
+        logicalBottomLayoutOverflow = rightLayoutOverflow();
+        logicalTopVisualOverflow = leftVisualOverflow();
+        logicalBottomVisualOverflow = rightVisualOverflow();
+    } 
 }
 
 void RenderBox::adjustForFlippedBlocksWritingMode(RenderBox* child, IntPoint& point, FlippingAdjustment adjustment)
index 348b2f7..f3a3bc1 100644 (file)
@@ -155,7 +155,7 @@ public:
     void addOverflowFromChild(RenderBox* child, const IntSize& delta);
     void clearLayoutOverflow();
 
-    void blockDirectionOverflow(bool isLineVertical, int& logicalTopLayoutOverflow, int& logicalBottomLayoutOverflow,
+    void blockDirectionOverflow(bool isLineHorizontal, int& logicalTopLayoutOverflow, int& logicalBottomLayoutOverflow,
                                 int& logicalTopVisualOverflow, int& logicalBottomVisualOverflow);
 
     int contentWidth() const { return clientWidth() - paddingLeft() - paddingRight(); }
index e83b709..ae89e0a 100644 (file)
@@ -526,17 +526,17 @@ void RenderBoxModelObject::paintFillLayerExtended(const PaintInfo& paintInfo, co
 
         if (!includeLeftEdge) {
             topLeft = IntSize();
-            if (box->isVertical())
-                topRight = IntSize();
-            else
+            if (box->isHorizontal())
                 bottomLeft = IntSize();
+            else
+                topRight = IntSize();
         }
         
         if (!includeRightEdge) {
-            if (box->isVertical())
-                bottomLeft = IntSize();
-            else
+            if (box->isHorizontal())
                 topRight = IntSize();
+            else
+                bottomLeft = IntSize();
             bottomRight = IntSize();
         }
         
index e5fc791..b4e8286 100644 (file)
@@ -278,11 +278,11 @@ bool RenderLineBoxList::hitTest(RenderBoxModelObject* renderer, const HitTestReq
     if (!firstLineBox())
         return false;
 
-    bool isVertical = firstLineBox()->isVertical();
+    bool isHorizontal = firstLineBox()->isHorizontal();
     
-    int logicalPointStart = isVertical ? x - result.leftPadding() : y - result.topPadding();
-    int logicalPointEnd = isVertical ? x + result.rightPadding() : y + result.bottomPadding();
-    int offset = isVertical ? tx : ty;
+    int logicalPointStart = isHorizontal ? y - result.topPadding() : x - result.leftPadding();
+    int logicalPointEnd = isHorizontal ? y + result.bottomPadding() : x + result.rightPadding();
+    int offset = isHorizontal ? ty : tx;
 
     // We can check the first box and last box and avoid hit testing if we don't
     // contain the point.  This is a quick short-circuit that we can take to avoid walking any lines.
index 178b1ad..0955be5 100644 (file)
@@ -48,7 +48,7 @@ RootInlineBox::RootInlineBox(RenderBlock* block)
     , m_paginationStrut(0)
     , m_blockLogicalHeight(0)
 {
-    setIsVertical(!block->style()->isHorizontalWritingMode());
+    setIsHorizontal(block->style()->isHorizontalWritingMode());
 }
 
 
@@ -99,7 +99,7 @@ void RootInlineBox::placeEllipsis(const AtomicString& ellipsisStr,  bool ltr, in
     // Create an ellipsis box.
     EllipsisBox* ellipsisBox = new (renderer()->renderArena()) EllipsisBox(renderer(), ellipsisStr, this,
                                                               ellipsisWidth - (markupBox ? markupBox->logicalWidth() : 0), logicalHeight(),
-                                                              y(), !prevRootBox(), isVertical(), markupBox);
+                                                              y(), !prevRootBox(), isHorizontal(), markupBox);
     
     if (!gEllipsisBoxMap)
         gEllipsisBoxMap = new EllipsisBoxMap();
index 4a0b485..9c09b82 100644 (file)
@@ -88,8 +88,8 @@ public:
 
     virtual void clearTruncation();
 
-    virtual int baselinePosition() const { return boxModelObject()->baselinePosition(m_firstLine, m_isVertical ? VerticalLine : HorizontalLine, PositionOfInteriorLineBoxes); }
-    virtual int lineHeight() const { return boxModelObject()->lineHeight(m_firstLine, m_isVertical ? VerticalLine : HorizontalLine, PositionOfInteriorLineBoxes); }
+    virtual int baselinePosition() const { return boxModelObject()->baselinePosition(m_firstLine, isHorizontal() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes); }
+    virtual int lineHeight() const { return boxModelObject()->lineHeight(m_firstLine, isHorizontal() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes); }
 
 #if PLATFORM(MAC)
     void addHighlightOverflow();