Changeset 107880 in webkit


Ignore:
Timestamp:
Feb 15, 2012 8:49:03 PM (12 years ago)
Author:
leviw@chromium.org
Message:

Add zeroLayoutUnit constant.
https://bugs.webkit.org/show_bug.cgi?id=78747

Reviewed by Eric Seidel.

Converting call sites where LayoutUnits and raw zeros are in ternary operations
and templatized function calls (like std::max and min) to use a new zeroLayoutUnit
constant instead of the raw zero.

No new tests. No change in behavior.

  • rendering/InlineFlowBox.cpp:

(WebCore::InlineFlowBox::placeBoxesInBlockDirection):
(WebCore::InlineFlowBox::addBorderOutsetVisualOverflow):
(WebCore::InlineFlowBox::paintFillLayer):
(WebCore::InlineFlowBox::paintBoxDecorations):
(WebCore::InlineFlowBox::paintMask):
(WebCore::InlineFlowBox::computeOverAnnotationAdjustment):

  • rendering/LayoutTypes.h:

(WebCore):

  • rendering/RenderBlock.cpp:

(WebCore::RenderBlock::MarginInfo::MarginInfo):
(WebCore::RenderBlock::adjustFloatingBlock):
(WebCore::RenderBlock::paintColumnRules):
(WebCore::RenderBlock::nextFloatLogicalBottomBelow):
(WebCore::RenderBlock::getClearDelta):
(WebCore::RenderBlock::computeInlinePreferredLogicalWidths):
(WebCore::getHeightForLineCount):
(WebCore::RenderBlock::adjustForUnsplittableChild):

  • rendering/RenderBlock.h:

(WebCore::RenderBlock::paginationStrut):
(WebCore::RenderBlock::pageLogicalOffset):

  • rendering/RenderBlockLineLayout.cpp:

(WebCore::LineLayoutState::updateRepaintRangeFromBox):
(WebCore::RenderBlock::addOverflowFromInlineChildren):

  • rendering/RenderBox.cpp:

(WebCore::RenderBox::positionForPoint):

  • rendering/RenderBox.h:

(WebCore::RenderBox::minYVisualOverflow):
(WebCore::RenderBox::minXVisualOverflow):
(RenderBox):

  • rendering/RenderBoxModelObject.cpp:

(WebCore::RenderBoxModelObject::offsetLeft):
(WebCore::RenderBoxModelObject::offsetTop):
(WebCore::RenderBoxModelObject::paintFillLayerExtended):

  • rendering/RenderFieldset.cpp:

(WebCore::RenderFieldset::paintBoxDecorations):

  • rendering/RenderFileUploadControl.cpp:

(WebCore::nodeWidth):

  • rendering/RenderFlowThread.cpp:

(WebCore::RenderFlowThread::layout):
(WebCore::RenderFlowThread::computeLogicalWidth):

  • rendering/RenderInline.cpp:

(WebCore::RenderInline::paintOutlineForLine):

  • rendering/RenderLayer.cpp:

(WebCore::RenderLayer::resize):

  • rendering/RenderListBox.cpp:

(WebCore::RenderListBox::listIndexAtOffset):
(WebCore::RenderListBox::verticalScrollbarWidth):

  • rendering/RenderMarquee.cpp:

(WebCore::RenderMarquee::computePosition):

  • rendering/RenderObject.cpp:

(WebCore::RenderObject::repaintAfterLayoutIfNeeded):

  • rendering/RenderReplaced.cpp:

(WebCore::RenderReplaced::computePreferredLogicalWidths):

  • rendering/RenderTable.cpp:

(WebCore::RenderTable::convertStyleLogicalWidthToComputedWidth):
(WebCore::RenderTable::layout):

  • rendering/RenderTable.h:

(WebCore::RenderTable::bordersPaddingAndSpacingInRowDirection):

  • rendering/mathml/RenderMathMLSubSup.cpp:

(WebCore::RenderMathMLSubSup::layout):

Location:
trunk/Source/WebCore
Files:
21 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r107879 r107880  
     12012-02-15  Levi Weintraub  <leviw@chromium.org>
     2
     3        Add zeroLayoutUnit constant.
     4        https://bugs.webkit.org/show_bug.cgi?id=78747
     5
     6        Reviewed by Eric Seidel.
     7
     8        Converting call sites where LayoutUnits and raw zeros are in ternary operations
     9        and templatized function calls (like std::max and min) to use a new zeroLayoutUnit
     10        constant instead of the raw zero.
     11
     12        No new tests. No change in behavior.
     13
     14        * rendering/InlineFlowBox.cpp:
     15        (WebCore::InlineFlowBox::placeBoxesInBlockDirection):
     16        (WebCore::InlineFlowBox::addBorderOutsetVisualOverflow):
     17        (WebCore::InlineFlowBox::paintFillLayer):
     18        (WebCore::InlineFlowBox::paintBoxDecorations):
     19        (WebCore::InlineFlowBox::paintMask):
     20        (WebCore::InlineFlowBox::computeOverAnnotationAdjustment):
     21        * rendering/LayoutTypes.h:
     22        (WebCore):
     23        * rendering/RenderBlock.cpp:
     24        (WebCore::RenderBlock::MarginInfo::MarginInfo):
     25        (WebCore::RenderBlock::adjustFloatingBlock):
     26        (WebCore::RenderBlock::paintColumnRules):
     27        (WebCore::RenderBlock::nextFloatLogicalBottomBelow):
     28        (WebCore::RenderBlock::getClearDelta):
     29        (WebCore::RenderBlock::computeInlinePreferredLogicalWidths):
     30        (WebCore::getHeightForLineCount):
     31        (WebCore::RenderBlock::adjustForUnsplittableChild):
     32        * rendering/RenderBlock.h:
     33        (WebCore::RenderBlock::paginationStrut):
     34        (WebCore::RenderBlock::pageLogicalOffset):
     35        * rendering/RenderBlockLineLayout.cpp:
     36        (WebCore::LineLayoutState::updateRepaintRangeFromBox):
     37        (WebCore::RenderBlock::addOverflowFromInlineChildren):
     38        * rendering/RenderBox.cpp:
     39        (WebCore::RenderBox::positionForPoint):
     40        * rendering/RenderBox.h:
     41        (WebCore::RenderBox::minYVisualOverflow):
     42        (WebCore::RenderBox::minXVisualOverflow):
     43        (RenderBox):
     44        * rendering/RenderBoxModelObject.cpp:
     45        (WebCore::RenderBoxModelObject::offsetLeft):
     46        (WebCore::RenderBoxModelObject::offsetTop):
     47        (WebCore::RenderBoxModelObject::paintFillLayerExtended):
     48        * rendering/RenderFieldset.cpp:
     49        (WebCore::RenderFieldset::paintBoxDecorations):
     50        * rendering/RenderFileUploadControl.cpp:
     51        (WebCore::nodeWidth):
     52        * rendering/RenderFlowThread.cpp:
     53        (WebCore::RenderFlowThread::layout):
     54        (WebCore::RenderFlowThread::computeLogicalWidth):
     55        * rendering/RenderInline.cpp:
     56        (WebCore::RenderInline::paintOutlineForLine):
     57        * rendering/RenderLayer.cpp:
     58        (WebCore::RenderLayer::resize):
     59        * rendering/RenderListBox.cpp:
     60        (WebCore::RenderListBox::listIndexAtOffset):
     61        (WebCore::RenderListBox::verticalScrollbarWidth):
     62        * rendering/RenderMarquee.cpp:
     63        (WebCore::RenderMarquee::computePosition):
     64        * rendering/RenderObject.cpp:
     65        (WebCore::RenderObject::repaintAfterLayoutIfNeeded):
     66        * rendering/RenderReplaced.cpp:
     67        (WebCore::RenderReplaced::computePreferredLogicalWidths):
     68        * rendering/RenderTable.cpp:
     69        (WebCore::RenderTable::convertStyleLogicalWidthToComputedWidth):
     70        (WebCore::RenderTable::layout):
     71        * rendering/RenderTable.h:
     72        (WebCore::RenderTable::bordersPaddingAndSpacingInRowDirection):
     73        * rendering/mathml/RenderMathMLSubSup.cpp:
     74        (WebCore::RenderMathMLSubSup::layout):
     75
    1762012-02-15  Alexey Proskuryakov  <ap@apple.com>
    277
  • trunk/Source/WebCore/rendering/InlineFlowBox.cpp

    r107874 r107880  
    658658                RenderRubyRun* rubyRun = toRenderRubyRun(curr->renderer());
    659659                if (RenderRubyBase* rubyBase = rubyRun->rubyBase()) {
    660                     LayoutUnit bottomRubyBaseLeading = (curr->logicalHeight() - rubyBase->logicalBottom()) + rubyBase->logicalHeight() - (rubyBase->lastRootBox() ? rubyBase->lastRootBox()->lineBottom() : 0);
    661                     LayoutUnit topRubyBaseLeading = rubyBase->logicalTop() + (rubyBase->firstRootBox() ? rubyBase->firstRootBox()->lineTop() : 0);
     660                    LayoutUnit bottomRubyBaseLeading = (curr->logicalHeight() - rubyBase->logicalBottom()) + rubyBase->logicalHeight() - (rubyBase->lastRootBox() ? rubyBase->lastRootBox()->lineBottom() : zeroLayoutUnit);
     661                    LayoutUnit topRubyBaseLeading = rubyBase->logicalTop() + (rubyBase->firstRootBox() ? rubyBase->firstRootBox()->lineTop() : zeroLayoutUnit);
    662662                    newLogicalTop += !renderer()->style()->isFlippedLinesWritingMode() ? topRubyBaseLeading : bottomRubyBaseLeading;
    663663                    boxHeight -= (topRubyBaseLeading + bottomRubyBaseLeading);
     
    788788    style->getBorderImageInlineDirectionOutsets(borderOutsetLogicalLeft, borderOutsetLogicalRight);
    789789
    790     LayoutUnit outsetLogicalLeft = includeLogicalLeftEdge() ? borderOutsetLogicalLeft : 0;
    791     LayoutUnit outsetLogicalRight = includeLogicalRightEdge() ? borderOutsetLogicalRight : 0;
     790    LayoutUnit outsetLogicalLeft = includeLogicalLeftEdge() ? borderOutsetLogicalLeft : zeroLayoutUnit;
     791    LayoutUnit outsetLogicalRight = includeLogicalRightEdge() ? borderOutsetLogicalRight : zeroLayoutUnit;
    792792
    793793    LayoutUnit logicalLeftVisualOverflow = min(pixelSnappedLogicalLeft() - outsetLogicalLeft, logicalVisualOverflow.x());
     
    11171117                totalLogicalWidth += curr->logicalWidth();
    11181118        }
    1119         LayoutUnit stripX = rect.x() - (isHorizontal() ? logicalOffsetOnLine : 0);
    1120         LayoutUnit stripY = rect.y() - (isHorizontal() ? 0 : logicalOffsetOnLine);
     1119        LayoutUnit stripX = rect.x() - (isHorizontal() ? logicalOffsetOnLine : zeroLayoutUnit);
     1120        LayoutUnit stripY = rect.y() - (isHorizontal() ? zeroLayoutUnit : logicalOffsetOnLine);
    11211121        LayoutUnit stripWidth = isHorizontal() ? totalLogicalWidth : width();
    11221122        LayoutUnit stripHeight = isHorizontal() ? height() : totalLogicalWidth;
     
    12481248                for (InlineFlowBox* curr = this; curr; curr = curr->nextLineBox())
    12491249                    totalLogicalWidth += curr->logicalWidth();
    1250                 LayoutUnit stripX = adjustedPaintoffset.x() - (isHorizontal() ? logicalOffsetOnLine : 0);
    1251                 LayoutUnit stripY = adjustedPaintoffset.y() - (isHorizontal() ? 0 : logicalOffsetOnLine);
     1250                LayoutUnit stripX = adjustedPaintoffset.x() - (isHorizontal() ? logicalOffsetOnLine : zeroLayoutUnit);
     1251                LayoutUnit stripY = adjustedPaintoffset.y() - (isHorizontal() ? zeroLayoutUnit : logicalOffsetOnLine);
    12521252                LayoutUnit stripWidth = isHorizontal() ? totalLogicalWidth : frameRect.width();
    12531253                LayoutUnit stripHeight = isHorizontal() ? frameRect.height() : totalLogicalWidth;
     
    13191319        for (InlineFlowBox* curr = this; curr; curr = curr->nextLineBox())
    13201320            totalLogicalWidth += curr->logicalWidth();
    1321         LayoutUnit stripX = adjustedPaintOffset.x() - (isHorizontal() ? logicalOffsetOnLine : 0);
    1322         LayoutUnit stripY = adjustedPaintOffset.y() - (isHorizontal() ? 0 : logicalOffsetOnLine);
     1321        LayoutUnit stripX = adjustedPaintOffset.x() - (isHorizontal() ? logicalOffsetOnLine : zeroLayoutUnit);
     1322        LayoutUnit stripY = adjustedPaintOffset.y() - (isHorizontal() ? zeroLayoutUnit : logicalOffsetOnLine);
    13231323        LayoutUnit stripWidth = isHorizontal() ? totalLogicalWidth : frameRect.width();
    13241324        LayoutUnit stripHeight = isHorizontal() ? frameRect.height() : totalLogicalWidth;
     
    14171417           
    14181418            if (!rubyRun->style()->isFlippedLinesWritingMode()) {
    1419                 LayoutUnit topOfFirstRubyTextLine = rubyText->logicalTop() + (rubyText->firstRootBox() ? rubyText->firstRootBox()->lineTop() : 0);
     1419                LayoutUnit topOfFirstRubyTextLine = rubyText->logicalTop() + (rubyText->firstRootBox() ? rubyText->firstRootBox()->lineTop() : zeroLayoutUnit);
    14201420                if (topOfFirstRubyTextLine >= 0)
    14211421                    continue;
  • trunk/Source/WebCore/rendering/LayoutTypes.h

    r107731 r107880  
    4646typedef IntSize LayoutSize;
    4747typedef IntRect LayoutRect;
     48
     49const LayoutUnit zeroLayoutUnit = 0;
    4850
    4951inline LayoutRect enclosingLayoutRect(const FloatRect& rect)
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r107650 r107880  
    115115        || blockStyle->marginAfterCollapse() == MDISCARD;
    116116
    117     m_positiveMargin = m_canCollapseMarginBeforeWithChildren ? block->maxPositiveMarginBefore() : 0;
    118     m_negativeMargin = m_canCollapseMarginBeforeWithChildren ? block->maxNegativeMarginBefore() : 0;
     117    m_positiveMargin = m_canCollapseMarginBeforeWithChildren ? block->maxPositiveMarginBefore() : zeroLayoutUnit;
     118    m_negativeMargin = m_canCollapseMarginBeforeWithChildren ? block->maxNegativeMarginBefore() : zeroLayoutUnit;
    119119}
    120120
     
    16121612    // http://www.hixie.ch/tests/adhoc/css/box/block/margin-collapse/046.html for
    16131613    // an example of this scenario.
    1614     LayoutUnit marginOffset = marginInfo.canCollapseWithMarginBefore() ? 0 : marginInfo.margin();
     1614    LayoutUnit marginOffset = marginInfo.canCollapseWithMarginBefore() ? zeroLayoutUnit : marginInfo.margin();
    16151615    setLogicalHeight(logicalHeight() + marginOffset);
    16161616    positionNewFloats();
     
    24842484
    24852485    if (colInfo->progressionAxis() == ColumnInfo::InlineAxis) {
    2486         LayoutUnit currLogicalLeftOffset = style()->isLeftToRightDirection() ? 0 : contentLogicalWidth();
     2486        LayoutUnit currLogicalLeftOffset = style()->isLeftToRightDirection() ? zeroLayoutUnit : contentLogicalWidth();
    24872487        LayoutUnit ruleAdd = logicalLeftOffsetForContent();
    2488         LayoutUnit ruleLogicalLeft = style()->isLeftToRightDirection() ? 0 : contentLogicalWidth();
     2488        LayoutUnit ruleLogicalLeft = style()->isLeftToRightDirection() ? zeroLayoutUnit : contentLogicalWidth();
    24892489        LayoutUnit inlineDirectionSize = colInfo->desiredColumnWidth();
    24902490        BoxSide boxSide = isHorizontalWritingMode()
     
    37903790    }
    37913791
    3792     return bottom == numeric_limits<LayoutUnit>::max() ? 0 : bottom;
     3792    return bottom == numeric_limits<LayoutUnit>::max() ? zeroLayoutUnit : bottom;
    37933793}
    37943794
     
    41874187
    41884188    // We also clear floats if we are too big to sit on the same line as a float (and wish to avoid floats by default).
    4189     LayoutUnit result = clearSet ? max<LayoutUnit>(0, logicalBottom - logicalTop) : 0;
     4189    LayoutUnit result = clearSet ? max<LayoutUnit>(0, logicalBottom - logicalTop) : zeroLayoutUnit;
    41904190    if (!result && child->avoidsFloats()) {
    41914191        LayoutUnit newLogicalTop = logicalTop;
     
    51735173    RenderStyle* styleToUse = style();
    51745174    RenderBlock* containingBlock = this->containingBlock();
    5175     LayoutUnit cw = containingBlock ? containingBlock->contentLogicalWidth() : 0;
     5175    LayoutUnit cw = containingBlock ? containingBlock->contentLogicalWidth() : zeroLayoutUnit;
    51765176
    51775177    // If we are at the start of a line, we want to ignore all white-space.
     
    59455945            for (RootInlineBox* box = block->firstRootBox(); box; box = box->nextRootBox()) {
    59465946                if (++count == l)
    5947                     return box->lineBottom() + (includeBottom ? (block->borderBottom() + block->paddingBottom()) : 0);
     5947                    return box->lineBottom() + (includeBottom ? (block->borderBottom() + block->paddingBottom()) : zeroLayoutUnit);
    59485948            }
    59495949        }
     
    59545954                    int result = getHeightForLineCount(toRenderBlock(obj), l, false, count);
    59555955                    if (result != -1)
    5956                         return result + obj->y() + (includeBottom ? (block->borderBottom() + block->paddingBottom()) : 0);
     5956                        return result + obj->y() + (includeBottom ? (block->borderBottom() + block->paddingBottom()) : zeroLayoutUnit);
    59575957                }
    59585958                else if (!obj->isFloatingOrPositioned() && !obj->isRunIn())
     
    65226522    if (!isUnsplittable)
    65236523        return logicalOffset;
    6524     LayoutUnit childLogicalHeight = logicalHeightForChild(child) + (includeMargins ? marginBeforeForChild(child) + marginAfterForChild(child) : 0);
     6524    LayoutUnit childLogicalHeight = logicalHeightForChild(child) + (includeMargins ? marginBeforeForChild(child) + marginAfterForChild(child) : zeroLayoutUnit);
    65256525    LayoutState* layoutState = view()->layoutState();
    65266526    if (layoutState->m_columnInfo)
  • trunk/Source/WebCore/rendering/RenderBlock.h

    r107613 r107880  
    243243    LayoutRect columnRectAt(ColumnInfo*, unsigned) const;
    244244
    245     LayoutUnit paginationStrut() const { return m_rareData ? m_rareData->m_paginationStrut : 0; }
     245    LayoutUnit paginationStrut() const { return m_rareData ? m_rareData->m_paginationStrut : zeroLayoutUnit; }
    246246    void setPaginationStrut(LayoutUnit);
    247247   
    248248    // The page logical offset is the object's offset from the top of the page in the page progression
    249249    // direction (so an x-offset in vertical text and a y-offset for horizontal text).
    250     int pageLogicalOffset() const { return m_rareData ? m_rareData->m_pageLogicalOffset : 0; }
     250    LayoutUnit pageLogicalOffset() const { return m_rareData ? m_rareData->m_pageLogicalOffset : zeroLayoutUnit; }
    251251    void setPageLogicalOffset(int);
    252252
  • trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp

    r107733 r107880  
    10941094    {
    10951095        m_usesRepaintBounds = true;
    1096         m_repaintLogicalTop = min(m_repaintLogicalTop, box->logicalTopVisualOverflow() + min(paginationDelta, 0));
    1097         m_repaintLogicalBottom = max(m_repaintLogicalBottom, box->logicalBottomVisualOverflow() + max(paginationDelta, 0));
     1096        m_repaintLogicalTop = min(m_repaintLogicalTop, box->logicalTopVisualOverflow() + min(paginationDelta, zeroLayoutUnit));
     1097        m_repaintLogicalBottom = max(m_repaintLogicalBottom, box->logicalBottomVisualOverflow() + max(paginationDelta, zeroLayoutUnit));
    10981098    }
    10991099   
     
    26522652void RenderBlock::addOverflowFromInlineChildren()
    26532653{
    2654     LayoutUnit endPadding = hasOverflowClip() ? paddingEnd() : 0;
     2654    LayoutUnit endPadding = hasOverflowClip() ? paddingEnd() : zeroLayoutUnit;
    26552655    // FIXME: Need to find another way to do this, since scrollbars could show when we don't want them to.
    26562656    if (hasOverflowClip() && !endPadding && node() && node()->rendererIsEditable() && node() == node()->rootEditableElement() && style()->isLeftToRightDirection())
  • trunk/Source/WebCore/rendering/RenderBox.cpp

    r107836 r107880  
    34463446        RenderBox* renderer = toRenderBox(renderObject);
    34473447
    3448         LayoutUnit top = renderer->borderTop() + renderer->paddingTop() + (isTableRow() ? 0 : renderer->y());
     3448        LayoutUnit top = renderer->borderTop() + renderer->paddingTop() + (isTableRow() ? zeroLayoutUnit : renderer->y());
    34493449        LayoutUnit bottom = top + renderer->contentHeight();
    3450         LayoutUnit left = renderer->borderLeft() + renderer->paddingLeft() + (isTableRow() ? 0 : renderer->x());
     3450        LayoutUnit left = renderer->borderLeft() + renderer->paddingLeft() + (isTableRow() ? zeroLayoutUnit : renderer->x());
    34513451        LayoutUnit right = left + renderer->contentWidth();
    34523452       
  • trunk/Source/WebCore/rendering/RenderBox.h

    r107836 r107880  
    162162   
    163163    virtual LayoutRect visualOverflowRect() const { return m_overflow ? m_overflow->visualOverflowRect() : borderBoxRect(); }
    164     LayoutUnit minYVisualOverflow() const { return m_overflow? m_overflow->minYVisualOverflow() : 0; }
     164    LayoutUnit minYVisualOverflow() const { return m_overflow? m_overflow->minYVisualOverflow() : zeroLayoutUnit; }
    165165    LayoutUnit maxYVisualOverflow() const { return m_overflow ? m_overflow->maxYVisualOverflow() : height(); }
    166     LayoutUnit minXVisualOverflow() const { return m_overflow ? m_overflow->minXVisualOverflow() : 0; }
     166    LayoutUnit minXVisualOverflow() const { return m_overflow ? m_overflow->minXVisualOverflow() : zeroLayoutUnit; }
    167167    LayoutUnit maxXVisualOverflow() const { return m_overflow ? m_overflow->maxXVisualOverflow() : width(); }
    168168    LayoutUnit logicalLeftVisualOverflow() const { return style()->isHorizontalWritingMode() ? minXVisualOverflow() : minYVisualOverflow(); }
     
    315315
    316316    RenderBoxRegionInfo* renderBoxRegionInfo(RenderRegion*, LayoutUnit offsetFromLogicalTopOfFirstPage, RenderBoxRegionInfoFlags = CacheRenderBoxRegionInfo) const;
    317     void computeLogicalWidthInRegion(RenderRegion* = 0, LayoutUnit offsetFromLogicalTopOfFirstPage = 0);
     317    void computeLogicalWidthInRegion(RenderRegion* = 0, LayoutUnit offsetFromLogicalTopOfFirstPage = zeroLayoutUnit);
    318318
    319319    bool stretchesToViewport() const
  • trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp

    r107874 r107880  
    454454   
    455455    RenderBoxModelObject* offsetPar = offsetParent();
    456     LayoutUnit xPos = (isBox() ? toRenderBox(this)->left() : 0);
     456    LayoutUnit xPos = (isBox() ? toRenderBox(this)->left() : zeroLayoutUnit);
    457457   
    458458    // If the offsetParent of the element is null, or is the HTML body element,
     
    488488   
    489489    RenderBoxModelObject* offsetPar = offsetParent();
    490     LayoutUnit yPos = (isBox() ? toRenderBox(this)->top() : 0);
     490    LayoutUnit yPos = (isBox() ? toRenderBox(this)->top() : zeroLayoutUnit);
    491491   
    492492    // If the offsetParent of the element is null, or is the HTML body element,
     
    704704    }
    705705   
    706     LayoutUnit bLeft = includeLeftEdge ? borderLeft() : 0;
    707     LayoutUnit bRight = includeRightEdge ? borderRight() : 0;
    708     LayoutUnit pLeft = includeLeftEdge ? paddingLeft() : 0;
    709     LayoutUnit pRight = includeRightEdge ? paddingRight() : 0;
     706    LayoutUnit bLeft = includeLeftEdge ? borderLeft() : zeroLayoutUnit;
     707    LayoutUnit bRight = includeRightEdge ? borderRight() : zeroLayoutUnit;
     708    LayoutUnit pLeft = includeLeftEdge ? paddingLeft() : zeroLayoutUnit;
     709    LayoutUnit pRight = includeRightEdge ? paddingRight() : zeroLayoutUnit;
    710710
    711711    GraphicsContextStateSaver clipWithScrollingStateSaver(*context, clippedWithLocalScrolling);
     
    726726        // Clip to the padding or content boxes as necessary.
    727727        bool includePadding = bgLayer->clip() == ContentFillBox;
    728         LayoutRect clipRect = LayoutRect(scrolledPaintRect.x() + bLeft + (includePadding ? pLeft : 0),
    729                                    scrolledPaintRect.y() + borderTop() + (includePadding ? paddingTop() : 0),
    730                                    scrolledPaintRect.width() - bLeft - bRight - (includePadding ? pLeft + pRight : 0),
    731                                    scrolledPaintRect.height() - borderTop() - borderBottom() - (includePadding ? paddingTop() + paddingBottom() : 0));
     728        LayoutRect clipRect = LayoutRect(scrolledPaintRect.x() + bLeft + (includePadding ? pLeft : zeroLayoutUnit),
     729                                   scrolledPaintRect.y() + borderTop() + (includePadding ? paddingTop() : zeroLayoutUnit),
     730                                   scrolledPaintRect.width() - bLeft - bRight - (includePadding ? pLeft + pRight : zeroLayoutUnit),
     731                                   scrolledPaintRect.height() - borderTop() - borderBottom() - (includePadding ? paddingTop() + paddingBottom() : zeroLayoutUnit));
    732732        backgroundClipStateSaver.save();
    733733        context->clip(clipRect);
  • trunk/Source/WebCore/rendering/RenderFieldset.cpp

    r107836 r107880  
    133133    // https://bugs.webkit.org/show_bug.cgi?id=47236
    134134    if (style()->isHorizontalWritingMode()) {
    135         LayoutUnit yOff = (legend->y() > 0) ? 0 : (legend->height() - borderTop()) / 2;
     135        LayoutUnit yOff = (legend->y() > 0) ? zeroLayoutUnit : (legend->height() - borderTop()) / 2;
    136136        paintRect.setHeight(paintRect.height() - yOff);
    137137        paintRect.setY(paintRect.y() + yOff);
    138138    } else {
    139         LayoutUnit xOff = (legend->x() > 0) ? 0 : (legend->width() - borderLeft()) / 2;
     139        LayoutUnit xOff = (legend->x() > 0) ? zeroLayoutUnit : (legend->width() - borderLeft()) / 2;
    140140        paintRect.setWidth(paintRect.width() - xOff);
    141141        paintRect.setX(paintRect.x() + xOff);
  • trunk/Source/WebCore/rendering/RenderFileUploadControl.cpp

    r107706 r107880  
    8787static int nodeWidth(Node* node)
    8888{
    89     return node ? node->renderBox()->width() : 0;
     89    return node ? node->renderBox()->width() : zeroLayoutUnit;
    9090}
    9191
  • trunk/Source/WebCore/rendering/RenderFlowThread.cpp

    r107650 r107880  
    383383                LayoutRect regionRect;
    384384                if (isHorizontalWritingMode()) {
    385                     regionRect = LayoutRect(style()->direction() == LTR ? 0 : logicalWidth() - region->contentWidth(), logicalHeight, region->contentWidth(), region->contentHeight());
     385                    regionRect = LayoutRect(style()->direction() == LTR ? zeroLayoutUnit : logicalWidth() - region->contentWidth(), logicalHeight, region->contentWidth(), region->contentHeight());
    386386                    logicalHeight += regionRect.height();
    387387                } else {
    388                     regionRect = LayoutRect(logicalHeight, style()->direction() == LTR ? 0 : logicalWidth() - region->contentHeight(), region->contentWidth(), region->contentHeight());
     388                    regionRect = LayoutRect(logicalHeight, style()->direction() == LTR ? zeroLayoutUnit : logicalWidth() - region->contentHeight(), region->contentWidth(), region->contentHeight());
    389389                    logicalHeight += regionRect.width();
    390390                }
     
    420420        LayoutUnit regionLogicalWidth = isHorizontalWritingMode() ? region->contentWidth() : region->contentHeight();
    421421        if (regionLogicalWidth != logicalWidth) {
    422             LayoutUnit logicalLeft = style()->direction() == LTR ? 0 : logicalWidth - regionLogicalWidth;
     422            LayoutUnit logicalLeft = style()->direction() == LTR ? zeroLayoutUnit : logicalWidth - regionLogicalWidth;
    423423            region->setRenderBoxRegionInfo(this, logicalLeft, regionLogicalWidth, false);
    424424        }
  • trunk/Source/WebCore/rendering/RenderInline.cpp

    r106968 r107880  
    14191419    drawLineForBoxSide(graphicsContext,
    14201420        left - outlineWidth,
    1421         top - (lastline.isEmpty() || thisline.x() < lastline.x() || (lastline.maxX() - 1) <= thisline.x() ? outlineWidth : 0),
     1421        top - (lastline.isEmpty() || thisline.x() < lastline.x() || (lastline.maxX() - 1) <= thisline.x() ? outlineWidth : zeroLayoutUnit),
    14221422        left,
    1423         bottom + (nextline.isEmpty() || thisline.x() <= nextline.x() || (nextline.maxX() - 1) <= thisline.x() ? outlineWidth : 0),
     1423        bottom + (nextline.isEmpty() || thisline.x() <= nextline.x() || (nextline.maxX() - 1) <= thisline.x() ? outlineWidth : zeroLayoutUnit),
    14241424        BSLeft,
    14251425        outlineColor, outlineStyle,
     
    14311431    drawLineForBoxSide(graphicsContext,
    14321432        right,
    1433         top - (lastline.isEmpty() || lastline.maxX() < thisline.maxX() || (thisline.maxX() - 1) <= lastline.x() ? outlineWidth : 0),
     1433        top - (lastline.isEmpty() || lastline.maxX() < thisline.maxX() || (thisline.maxX() - 1) <= lastline.x() ? outlineWidth : zeroLayoutUnit),
    14341434        right + outlineWidth,
    1435         bottom + (nextline.isEmpty() || nextline.maxX() <= thisline.maxX() || (thisline.maxX() - 1) <= nextline.x() ? outlineWidth : 0),
     1435        bottom + (nextline.isEmpty() || nextline.maxX() <= thisline.maxX() || (thisline.maxX() - 1) <= nextline.x() ? outlineWidth : zeroLayoutUnit),
    14361436        BSRight,
    14371437        outlineColor, outlineStyle,
  • trunk/Source/WebCore/rendering/RenderLayer.cpp

    r107731 r107880  
    17481748            styleDeclaration->setProperty(CSSPropertyMarginRight, String::number(renderer->marginRight() / zoomFactor) + "px", false);
    17491749        }
    1750         LayoutUnit baseWidth = renderer->width() - (isBoxSizingBorder ? 0 : renderer->borderAndPaddingWidth());
     1750        LayoutUnit baseWidth = renderer->width() - (isBoxSizingBorder ? zeroLayoutUnit : renderer->borderAndPaddingWidth());
    17511751        baseWidth = baseWidth / zoomFactor;
    17521752        styleDeclaration->setProperty(CSSPropertyWidth, String::number(baseWidth + difference.width()) + "px", false);
     
    17591759            styleDeclaration->setProperty(CSSPropertyMarginBottom, String::number(renderer->marginBottom() / zoomFactor) + "px", false);
    17601760        }
    1761         LayoutUnit baseHeight = renderer->height() - (isBoxSizingBorder ? 0 : renderer->borderAndPaddingHeight());
     1761        LayoutUnit baseHeight = renderer->height() - (isBoxSizingBorder ? zeroLayoutUnit : renderer->borderAndPaddingHeight());
    17621762        baseHeight = baseHeight / zoomFactor;
    17631763        styleDeclaration->setProperty(CSSPropertyHeight, String::number(baseHeight + difference.height()) + "px", false);
  • trunk/Source/WebCore/rendering/RenderListBox.cpp

    r107429 r107880  
    474474        return -1;
    475475
    476     LayoutUnit scrollbarWidth = m_vBar ? m_vBar->width() : LayoutUnit(0);
     476    int scrollbarWidth = m_vBar ? m_vBar->width() : 0;
    477477    if (offset.width() < borderLeft() + paddingLeft() || offset.width() > width() - borderRight() - paddingRight() - scrollbarWidth)
    478478        return -1;
     
    639639int RenderListBox::verticalScrollbarWidth() const
    640640{
    641     return m_vBar && !m_vBar->isOverlayScrollbar() ? m_vBar->width() : LayoutUnit(0);
     641    return m_vBar && !m_vBar->isOverlayScrollbar() ? m_vBar->width() : 0;
    642642}
    643643
  • trunk/Source/WebCore/rendering/RenderMarquee.cpp

    r105772 r107880  
    126126        if (dir == MRIGHT) {
    127127            if (stopAtContentEdge)
    128                 return max(0, ltr ? (contentWidth - clientWidth) : (clientWidth - contentWidth));
     128                return max(zeroLayoutUnit, ltr ? (contentWidth - clientWidth) : (clientWidth - contentWidth));
    129129            else
    130130                return ltr ? contentWidth : clientWidth;
     
    132132        else {
    133133            if (stopAtContentEdge)
    134                 return min(0, ltr ? (contentWidth - clientWidth) : (clientWidth - contentWidth));
     134                return min(zeroLayoutUnit, ltr ? (contentWidth - clientWidth) : (clientWidth - contentWidth));
    135135            else
    136136                return ltr ? -clientWidth : -contentWidth;
  • trunk/Source/WebCore/rendering/RenderObject.cpp

    r107622 r107880  
    14181418        style()->getBoxShadowHorizontalExtent(shadowLeft, shadowRight);
    14191419
    1420         LayoutUnit borderRight = isBox() ? toRenderBox(this)->borderRight() : LayoutUnit(0);
    1421         LayoutUnit boxWidth = isBox() ? toRenderBox(this)->width() : LayoutUnit(0);
     1420        LayoutUnit borderRight = isBox() ? toRenderBox(this)->borderRight() : zeroLayoutUnit;
     1421        LayoutUnit boxWidth = isBox() ? toRenderBox(this)->width() : zeroLayoutUnit;
    14221422        LayoutUnit borderWidth = max<LayoutUnit>(-outlineStyle->outlineOffset(), max(borderRight, max<LayoutUnit>(style()->borderTopRightRadius().width().calcValue(boxWidth), style()->borderBottomRightRadius().width().calcValue(boxWidth)))) + max(ow, shadowRight);
    14231423        LayoutRect rightRect(newOutlineBox.x() + min(newOutlineBox.width(), oldOutlineBox.width()) - borderWidth,
     
    14371437        style()->getBoxShadowVerticalExtent(shadowTop, shadowBottom);
    14381438
    1439         LayoutUnit borderBottom = isBox() ? toRenderBox(this)->borderBottom() : LayoutUnit(0);
    1440         LayoutUnit boxHeight = isBox() ? toRenderBox(this)->height() : LayoutUnit(0);
     1439        LayoutUnit borderBottom = isBox() ? toRenderBox(this)->borderBottom() : zeroLayoutUnit;
     1440        LayoutUnit boxHeight = isBox() ? toRenderBox(this)->height() : zeroLayoutUnit;
    14411441        LayoutUnit borderHeight = max<LayoutUnit>(-outlineStyle->outlineOffset(), max(borderBottom, max<LayoutUnit>(style()->borderBottomLeftRadius().height().calcValue(boxHeight), style()->borderBottomRightRadius().height().calcValue(boxHeight)))) + max(ow, shadowBottom);
    14421442        LayoutRect bottomRect(newOutlineBox.x(),
  • trunk/Source/WebCore/rendering/RenderReplaced.cpp

    r106492 r107880  
    439439
    440440    if (style()->maxWidth().isFixed())
    441         m_maxPreferredLogicalWidth = min(m_maxPreferredLogicalWidth, style()->maxWidth().value() + (style()->boxSizing() == CONTENT_BOX ? borderAndPadding : 0));
     441        m_maxPreferredLogicalWidth = min(m_maxPreferredLogicalWidth, style()->maxWidth().value() + (style()->boxSizing() == CONTENT_BOX ? borderAndPadding : zeroLayoutUnit));
    442442
    443443    if (style()->width().isPercent() || style()->height().isPercent()
  • trunk/Source/WebCore/rendering/RenderTable.cpp

    r107836 r107880  
    273273    if (isCSSTable && styleLogicalWidth.isFixed() && styleLogicalWidth.isPositive()) {
    274274        recalcBordersInRowDirection();
    275         borders = borderStart() + borderEnd() + (collapseBorders() ? 0 : paddingStart() + paddingEnd());
     275        borders = borderStart() + borderEnd() + (collapseBorders() ? zeroLayoutUnit : paddingStart() + paddingEnd());
    276276    }
    277277    return styleLogicalWidth.calcMinValue(availableWidth) + borders;
     
    371371    }
    372372
    373     LayoutUnit borderAndPaddingBefore = borderBefore() + (collapsing ? 0 : paddingBefore());
    374     LayoutUnit borderAndPaddingAfter = borderAfter() + (collapsing ? 0 : paddingAfter());
     373    LayoutUnit borderAndPaddingBefore = borderBefore() + (collapsing ? zeroLayoutUnit : paddingBefore());
     374    LayoutUnit borderAndPaddingAfter = borderAfter() + (collapsing ? zeroLayoutUnit : paddingAfter());
    375375
    376376    setLogicalHeight(logicalHeight() + borderAndPaddingBefore);
     
    383383    if (logicalHeightLength.isFixed()) {
    384384        // HTML tables size as though CSS height includes border/padding, CSS tables do not.
    385         LayoutUnit borders = node() && node()->hasTagName(tableTag) ? (borderAndPaddingBefore + borderAndPaddingAfter) : 0;
     385        LayoutUnit borders = node() && node()->hasTagName(tableTag) ? (borderAndPaddingBefore + borderAndPaddingAfter) : zeroLayoutUnit;
    386386        computedLogicalHeight = logicalHeightLength.value() - borders;
    387387    } else if (logicalHeightLength.isPercent())
  • trunk/Source/WebCore/rendering/RenderTable.h

    r106479 r107880  
    173173    {
    174174        return borderStart() + borderEnd() +
    175                (collapseBorders() ? 0 : (paddingStart() + paddingEnd() + (numEffCols() + 1) * hBorderSpacing()));
     175               (collapseBorders() ? zeroLayoutUnit : (paddingStart() + paddingEnd() + (numEffCols() + 1) * hBorderSpacing()));
    176176    }
    177177
  • trunk/Source/WebCore/rendering/mathml/RenderMathMLSubSup.cpp

    r107473 r107880  
    163163                current = current->nextSibling();
    164164            }
    165             LayoutUnit heightDiff = m_scripts ? (m_scripts->offsetHeight() - maxHeight) / 2 : 0;
     165            LayoutUnit heightDiff = m_scripts ? (m_scripts->offsetHeight() - maxHeight) / 2 : zeroLayoutUnit;
    166166            if (heightDiff < 0)
    167167                heightDiff = 0;
Note: See TracChangeset for help on using the changeset viewer.