Changeset 116392 in webkit


Ignore:
Timestamp:
May 7, 2012 9:12:07 PM (12 years ago)
Author:
eae@chromium.org
Message:

Fix performance regression for floats caused by LayoutUnit change
https://bugs.webkit.org/show_bug.cgi?id=85834

Reviewed by Eric Seidel.

Fix performance regression caused by r116009 by disabling the use of
64bit math in FractionalLayoutUnit, simplifying the pixelSnappedMaxX/Y
math, inlining a couple of methods and replacing the literal 0 (zero)
with ZERO_LAYOUT_UNIT.

No new tests, no change in functionality.

  • platform/FractionalLayoutUnit.h:

(WebCore::boundedMultiply):
(WebCore::operator*):
(WebCore::operator/):
Disable the use of 64bit (long long) math in the case where the fraction
is set to 1.

  • platform/graphics/FractionalLayoutRect.h:

(WebCore::FractionalLayoutRect::pixelSnappedMaxX):
(WebCore::FractionalLayoutRect::pixelSnappedMaxY):
Simplify the pixel snapping logic for maxX/maxY.

  • rendering/RenderBlock.cpp:

(WebCore::RenderBlock::isSelfCollapsingBlock):
(WebCore::RenderBlock::layoutBlock):
(WebCore::RenderBlock::computeOverflow):
(WebCore::RenderBlock::clearFloatsIfNeeded):
(WebCore::RenderBlock::paintChildren):
(WebCore::RenderBlock::blockSelectionGap):
(WebCore::RenderBlock::logicalLeftSelectionGap):
(WebCore::RenderBlock::logicalRightSelectionGap):
(WebCore::RenderBlock::computeLogicalLocationForFloat):
(WebCore::RenderBlock::lowestFloatLogicalBottom):
(WebCore::RenderBlock::getClearDelta):
(WebCore::RenderBlock::computeBlockPreferredLogicalWidths):
(WebCore::RenderBlock::addFocusRingRects):
(WebCore::RenderBlock::adjustLinePositionForPagination):

  • rendering/RenderBlock.h:

(WebCore::RenderBlock::availableLogicalWidthForLine):
(WebCore::RenderBlock::availableLogicalWidthForContent):
(WebCore::RenderBlock::FloatingObject::x):
(WebCore::RenderBlock::FloatingObject::maxX):
(WebCore::RenderBlock::FloatingObject::y):
(WebCore::RenderBlock::FloatingObject::maxY):
(WebCore::RenderBlock::FloatingObject::width):
(WebCore::RenderBlock::FloatingObject::height):
(FloatingObject):
(WebCore::RenderBlock::FloatingObject::pixelSnappedX):
(WebCore::RenderBlock::FloatingObject::pixelSnappedMaxX):
(WebCore::RenderBlock::FloatingObject::pixelSnappedY):
(WebCore::RenderBlock::FloatingObject::pixelSnappedMaxY):
(WebCore::RenderBlock::FloatingObject::pixelSnappedWidth):
(WebCore::RenderBlock::FloatingObject::pixelSnappedHeight):
(WebCore::RenderBlock::RenderBlockRareData::positiveMarginBeforeDefault):
(WebCore::RenderBlock::RenderBlockRareData::negativeMarginBeforeDefault):
(WebCore::RenderBlock::RenderBlockRareData::positiveMarginAfterDefault):
(WebCore::RenderBlock::RenderBlockRareData::negativeMarginAfterDefault):

  • rendering/RenderBoxModelObject.cpp:

(WebCore::accumulateRelativePositionOffsets):
(WebCore::RenderBoxModelObject::offsetLeft):
(WebCore::RenderBoxModelObject::offsetTop):
(WebCore::RenderBoxModelObject::computedCSSPaddingTop):
(WebCore::RenderBoxModelObject::computedCSSPaddingBottom):
(WebCore::RenderBoxModelObject::computedCSSPaddingLeft):
(WebCore::RenderBoxModelObject::computedCSSPaddingRight):
(WebCore::RenderBoxModelObject::computedCSSPaddingBefore):
(WebCore::RenderBoxModelObject::computedCSSPaddingAfter):
(WebCore::RenderBoxModelObject::computedCSSPaddingStart):
(WebCore::RenderBoxModelObject::computedCSSPaddingEnd):

Location:
trunk/Source/WebCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r116389 r116392  
     12012-05-07  Emil A Eklund  <eae@chromium.org>
     2
     3        Fix performance regression for floats caused by LayoutUnit change
     4        https://bugs.webkit.org/show_bug.cgi?id=85834
     5
     6        Reviewed by Eric Seidel.
     7
     8        Fix performance regression caused by r116009 by disabling the use of
     9        64bit math in FractionalLayoutUnit, simplifying the pixelSnappedMaxX/Y
     10        math, inlining a couple of methods and replacing the literal 0 (zero)
     11        with ZERO_LAYOUT_UNIT.
     12
     13        No new tests, no change in functionality.
     14
     15        * platform/FractionalLayoutUnit.h:
     16        (WebCore::boundedMultiply):
     17        (WebCore::operator*):
     18        (WebCore::operator/):
     19        Disable the use of 64bit (long long) math in the case where the fraction
     20        is set to 1.
     21       
     22        * platform/graphics/FractionalLayoutRect.h:
     23        (WebCore::FractionalLayoutRect::pixelSnappedMaxX):
     24        (WebCore::FractionalLayoutRect::pixelSnappedMaxY):
     25        Simplify the pixel snapping logic for maxX/maxY.
     26       
     27        * rendering/RenderBlock.cpp:
     28        (WebCore::RenderBlock::isSelfCollapsingBlock):
     29        (WebCore::RenderBlock::layoutBlock):
     30        (WebCore::RenderBlock::computeOverflow):
     31        (WebCore::RenderBlock::clearFloatsIfNeeded):
     32        (WebCore::RenderBlock::paintChildren):
     33        (WebCore::RenderBlock::blockSelectionGap):
     34        (WebCore::RenderBlock::logicalLeftSelectionGap):
     35        (WebCore::RenderBlock::logicalRightSelectionGap):
     36        (WebCore::RenderBlock::computeLogicalLocationForFloat):
     37        (WebCore::RenderBlock::lowestFloatLogicalBottom):
     38        (WebCore::RenderBlock::getClearDelta):
     39        (WebCore::RenderBlock::computeBlockPreferredLogicalWidths):
     40        (WebCore::RenderBlock::addFocusRingRects):
     41        (WebCore::RenderBlock::adjustLinePositionForPagination):
     42        * rendering/RenderBlock.h:
     43        (WebCore::RenderBlock::availableLogicalWidthForLine):
     44        (WebCore::RenderBlock::availableLogicalWidthForContent):
     45        (WebCore::RenderBlock::FloatingObject::x):
     46        (WebCore::RenderBlock::FloatingObject::maxX):
     47        (WebCore::RenderBlock::FloatingObject::y):
     48        (WebCore::RenderBlock::FloatingObject::maxY):
     49        (WebCore::RenderBlock::FloatingObject::width):
     50        (WebCore::RenderBlock::FloatingObject::height):
     51        (FloatingObject):
     52        (WebCore::RenderBlock::FloatingObject::pixelSnappedX):
     53        (WebCore::RenderBlock::FloatingObject::pixelSnappedMaxX):
     54        (WebCore::RenderBlock::FloatingObject::pixelSnappedY):
     55        (WebCore::RenderBlock::FloatingObject::pixelSnappedMaxY):
     56        (WebCore::RenderBlock::FloatingObject::pixelSnappedWidth):
     57        (WebCore::RenderBlock::FloatingObject::pixelSnappedHeight):
     58        (WebCore::RenderBlock::RenderBlockRareData::positiveMarginBeforeDefault):
     59        (WebCore::RenderBlock::RenderBlockRareData::negativeMarginBeforeDefault):
     60        (WebCore::RenderBlock::RenderBlockRareData::positiveMarginAfterDefault):
     61        (WebCore::RenderBlock::RenderBlockRareData::negativeMarginAfterDefault):
     62        * rendering/RenderBoxModelObject.cpp:
     63        (WebCore::accumulateRelativePositionOffsets):
     64        (WebCore::RenderBoxModelObject::offsetLeft):
     65        (WebCore::RenderBoxModelObject::offsetTop):
     66        (WebCore::RenderBoxModelObject::computedCSSPaddingTop):
     67        (WebCore::RenderBoxModelObject::computedCSSPaddingBottom):
     68        (WebCore::RenderBoxModelObject::computedCSSPaddingLeft):
     69        (WebCore::RenderBoxModelObject::computedCSSPaddingRight):
     70        (WebCore::RenderBoxModelObject::computedCSSPaddingBefore):
     71        (WebCore::RenderBoxModelObject::computedCSSPaddingAfter):
     72        (WebCore::RenderBoxModelObject::computedCSSPaddingStart):
     73        (WebCore::RenderBoxModelObject::computedCSSPaddingEnd):
     74
    1752012-05-07  Dongwoo Im  <dw.im@samsung.com>
    276
  • trunk/Source/WebCore/platform/FractionalLayoutUnit.h

    r115928 r116392  
    322322inline FractionalLayoutUnit boundedMultiply(const FractionalLayoutUnit& a, const FractionalLayoutUnit& b)
    323323{
     324#if ENABLE(SUBPIXEL_LAYOUT)
    324325    FractionalLayoutUnit returnVal;
    325326    long long rawVal = static_cast<long long>(a.rawValue()) * b.rawValue() / kFixedPointDenominator;
     
    330331    returnVal.setRawValue(rawVal);
    331332    return returnVal;
     333#else
     334    return a.rawValue() * b.rawValue();
     335#endif
    332336}
    333337
    334338inline FractionalLayoutUnit operator*(const FractionalLayoutUnit& a, const FractionalLayoutUnit& b)
    335339{
     340#if ENABLE(SUBPIXEL_LAYOUT)
    336341    FractionalLayoutUnit returnVal;
    337342    long long rawVal = static_cast<long long>(a.rawValue()) * b.rawValue() / kFixedPointDenominator;
    338343    returnVal.setRawValue(rawVal);
    339344    return returnVal;
     345#else
     346    return a.rawValue() * b.rawValue();
     347#endif
    340348}   
    341349
     
    382390inline FractionalLayoutUnit operator/(const FractionalLayoutUnit& a, const FractionalLayoutUnit& b)
    383391{
     392#if ENABLE(SUBPIXEL_LAYOUT)
    384393    FractionalLayoutUnit returnVal;
    385394    long long rawVal = static_cast<long long>(kFixedPointDenominator) * a.rawValue() / b.rawValue();
    386395    returnVal.setRawValue(rawVal);
    387396    return returnVal;
     397#else
     398    return a.rawValue() / b.rawValue();
     399#endif
    388400}   
    389401
  • trunk/Source/WebCore/platform/graphics/FractionalLayoutRect.h

    r113030 r116392  
    7373    int pixelSnappedWidth() const { return snapSizeToPixel(width(), x()); }
    7474    int pixelSnappedHeight() const { return snapSizeToPixel(height(), y()); }
    75     int pixelSnappedMaxX() const { return pixelSnappedX() + pixelSnappedWidth(); }
    76     int pixelSnappedMaxY() const { return pixelSnappedY() + pixelSnappedHeight(); }
     75    int pixelSnappedMaxX() const { return (m_location.x() + m_size.width()).round(); }
     76    int pixelSnappedMaxY() const { return (m_location.y() + m_size.height()).round(); }
    7777
    7878    void setX(FractionalLayoutUnit x) { m_location.setX(x); }
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r116357 r116392  
    12371237    // (d) have a min-height
    12381238    // (e) have specified that one of our margins can't collapse using a CSS extension
    1239     if (logicalHeight() > 0
     1239    if (logicalHeight() > ZERO_LAYOUT_UNIT
    12401240        || isTable() || borderAndPaddingLogicalHeight()
    12411241        || style()->logicalMinHeight().isPositive()
     
    13821382
    13831383    LayoutUnit previousHeight = logicalHeight();
    1384     setLogicalHeight(0);
     1384    setLogicalHeight(ZERO_LAYOUT_UNIT);
    13851385    bool hasSpecifiedPageLogicalHeight = false;
    13861386    bool pageLogicalHeightChanged = false;
     
    13921392            computeLogicalHeight();
    13931393            LayoutUnit columnHeight = contentLogicalHeight();
    1394             if (columnHeight > 0) {
     1394            if (columnHeight > ZERO_LAYOUT_UNIT) {
    13951395                pageLogicalHeight = columnHeight;
    13961396                hasSpecifiedPageLogicalHeight = true;
    13971397            }
    1398             setLogicalHeight(0);
     1398            setLogicalHeight(ZERO_LAYOUT_UNIT);
    13991399        }
    14001400        if (colInfo->columnHeight() != pageLogicalHeight && everHadLayout()) {
     
    14551455    }
    14561456
    1457     LayoutUnit repaintLogicalTop = 0;
    1458     LayoutUnit repaintLogicalBottom = 0;
    1459     LayoutUnit maxFloatLogicalBottom = 0;
     1457    LayoutUnit repaintLogicalTop = ZERO_LAYOUT_UNIT;
     1458    LayoutUnit repaintLogicalBottom = ZERO_LAYOUT_UNIT;
     1459    LayoutUnit maxFloatLogicalBottom = ZERO_LAYOUT_UNIT;
    14601460    if (!firstChild() && !isAnonymousBlock())
    14611461        setChildrenInline(true);
     
    15941594        LayoutRect rectToApply;
    15951595        if (isHorizontalWritingMode())
    1596             rectToApply = LayoutRect(clientRect.x(), clientRect.y(), 1, max<LayoutUnit>(0, oldClientAfterEdge - clientRect.y()));
     1596            rectToApply = LayoutRect(clientRect.x(), clientRect.y(), 1, max(ZERO_LAYOUT_UNIT, oldClientAfterEdge - clientRect.y()));
    15971597        else
    1598             rectToApply = LayoutRect(clientRect.x(), clientRect.y(), max<LayoutUnit>(0, oldClientAfterEdge - clientRect.x()), 1);
     1598            rectToApply = LayoutRect(clientRect.x(), clientRect.y(), max(ZERO_LAYOUT_UNIT, oldClientAfterEdge - clientRect.x()), 1);
    15991599        addLayoutOverflow(rectToApply);
    16001600    }
     
    19571957        // Adjust our height such that we are ready to be collapsed with subsequent siblings (or the bottom
    19581958        // of the parent block).
    1959         setLogicalHeight(child->y() - max<LayoutUnit>(0, marginInfo.margin()));
     1959        setLogicalHeight(child->y() - max(ZERO_LAYOUT_UNIT, marginInfo.margin()));
    19601960    } else
    19611961        // Increase our height by the amount we had to clear.
     
    27212721            && (absoluteChildY + child->height()) > paintInfo.rect.y()
    27222722            && (absoluteChildY + child->height()) < paintInfo.rect.maxY()) {
    2723             view()->setBestTruncatedAt(absoluteChildY + child->height() + max<LayoutUnit>(0, child->collapsedMarginAfter()), this, true);
     2723            view()->setBestTruncatedAt(absoluteChildY + child->height() + max(ZERO_LAYOUT_UNIT, child->collapsedMarginAfter()), this, true);
    27242724            return;
    27252725        }
     
    32693269    LayoutUnit logicalTop = lastLogicalTop;
    32703270    LayoutUnit logicalHeight = blockDirectionOffset(rootBlock, offsetFromRootBlock) + logicalBottom - logicalTop;
    3271     if (logicalHeight <= static_cast<LayoutUnit>(0))
     3271    if (logicalHeight <= ZERO_LAYOUT_UNIT)
    32723272        return LayoutRect();
    32733273
     
    32763276    LayoutUnit logicalRight = min(lastLogicalRight, logicalRightSelectionOffset(rootBlock, logicalBottom));
    32773277    LayoutUnit logicalWidth = logicalRight - logicalLeft;
    3278     if (logicalWidth <= static_cast<LayoutUnit>(0))
     3278    if (logicalWidth <= ZERO_LAYOUT_UNIT)
    32793279        return LayoutRect();
    32803280
     
    32923292    LayoutUnit rootBlockLogicalRight = min(inlineDirectionOffset(rootBlock, offsetFromRootBlock) + logicalLeft, min(logicalRightSelectionOffset(rootBlock, logicalTop), logicalRightSelectionOffset(rootBlock, logicalTop + logicalHeight)));
    32933293    LayoutUnit rootBlockLogicalWidth = rootBlockLogicalRight - rootBlockLogicalLeft;
    3294     if (rootBlockLogicalWidth <= static_cast<LayoutUnit>(0))
     3294    if (rootBlockLogicalWidth <= ZERO_LAYOUT_UNIT)
    32953295        return LayoutRect();
    32963296
     
    33083308    LayoutUnit rootBlockLogicalRight = min(logicalRightSelectionOffset(rootBlock, logicalTop), logicalRightSelectionOffset(rootBlock, logicalTop + logicalHeight));
    33093309    LayoutUnit rootBlockLogicalWidth = rootBlockLogicalRight - rootBlockLogicalLeft;
    3310     if (rootBlockLogicalWidth <= static_cast<LayoutUnit>(0))
     3310    if (rootBlockLogicalWidth <= ZERO_LAYOUT_UNIT)
    33113311        return LayoutRect();
    33123312
     
    35763576            }
    35773577        }
    3578         floatLogicalLeft = max<LayoutUnit>(logicalLeftOffset - borderAndPaddingLogicalLeft(), floatLogicalLeft);
     3578        floatLogicalLeft = max(logicalLeftOffset - borderAndPaddingLogicalLeft(), floatLogicalLeft);
    35793579    } else {
    35803580        LayoutUnit heightRemainingLeft = 1;
     
    39703970{
    39713971    if (!m_floatingObjects)
    3972         return 0;
    3973     LayoutUnit lowestFloatBottom = 0;
     3972        return ZERO_LAYOUT_UNIT;
     3973    LayoutUnit lowestFloatBottom = ZERO_LAYOUT_UNIT;
    39743974    const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
    39753975    FloatingObjectSetIterator end = floatingObjectSet.end();
     
    43484348
    43494349    // 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).
    4350     LayoutUnit result = clearSet ? max<LayoutUnit>(0, logicalBottom - logicalTop) : ZERO_LAYOUT_UNIT;
     4350    LayoutUnit result = clearSet ? max(ZERO_LAYOUT_UNIT, logicalBottom - logicalTop) : ZERO_LAYOUT_UNIT;
    43514351    if (!result && child->avoidsFloats()) {
    43524352        LayoutUnit newLogicalTop = logicalTop;
     
    56915691
    56925692    // Always make sure these values are non-negative.
    5693     m_minPreferredLogicalWidth = max<LayoutUnit>(0, m_minPreferredLogicalWidth);
    5694     m_maxPreferredLogicalWidth = max<LayoutUnit>(0, m_maxPreferredLogicalWidth);
     5693    m_minPreferredLogicalWidth = max(ZERO_LAYOUT_UNIT, m_minPreferredLogicalWidth);
     5694    m_maxPreferredLogicalWidth = max(ZERO_LAYOUT_UNIT, m_maxPreferredLogicalWidth);
    56955695
    56965696    m_maxPreferredLogicalWidth = max(floatLeftWidth + floatRightWidth, m_maxPreferredLogicalWidth);
     
    64916491        // https://bugs.webkit.org/show_bug.cgi?id=46781
    64926492        bool prevInlineHasLineBox = toRenderInline(inlineElementContinuation()->node()->renderer())->firstLineBox();
    6493         float topMargin = prevInlineHasLineBox ? collapsedMarginBefore() : static_cast<LayoutUnit>(0);
    6494         float bottomMargin = nextInlineHasLineBox ? collapsedMarginAfter() : static_cast<LayoutUnit>(0);
     6493        float topMargin = prevInlineHasLineBox ? collapsedMarginBefore() : ZERO_LAYOUT_UNIT;
     6494        float bottomMargin = nextInlineHasLineBox ? collapsedMarginAfter() : ZERO_LAYOUT_UNIT;
    64956495        LayoutRect rect(additionalOffset.x(), additionalOffset.y() - topMargin, width(), height() + topMargin + bottomMargin);
    64966496        if (!rect.isEmpty())
     
    67446744        if (!hasUniformPageLogicalHeight && !pushToNextPageWithMinimumLogicalHeight(remainingLogicalHeight, logicalOffset, lineHeight))
    67456745            return;
    6746         LayoutUnit totalLogicalHeight = lineHeight + max<LayoutUnit>(0, logicalOffset);
     6746        LayoutUnit totalLogicalHeight = lineHeight + max(ZERO_LAYOUT_UNIT, logicalOffset);
    67476747        LayoutUnit pageLogicalHeightAtNewOffset = hasUniformPageLogicalHeight ? pageLogicalHeight : pageLogicalHeightForOffset(logicalOffset + remainingLogicalHeight);
    67486748        if (lineBox == firstRootBox() && totalLogicalHeight < pageLogicalHeightAtNewOffset && !isPositioned() && !isTableCell())
    6749             setPaginationStrut(remainingLogicalHeight + max<LayoutUnit>(0, logicalOffset));
     6749            setPaginationStrut(remainingLogicalHeight + max(ZERO_LAYOUT_UNIT, logicalOffset));
    67506750        else {
    67516751            delta += remainingLogicalHeight;
  • trunk/Source/WebCore/rendering/RenderBlock.h

    r116298 r116392  
    132132    LayoutUnit availableLogicalWidthForLine(LayoutUnit position, bool firstLine, RenderRegion* region, LayoutUnit offsetFromLogicalTopOfFirstPage) const
    133133    {
    134         return max<LayoutUnit>(0, logicalRightOffsetForLine(position, firstLine, region, offsetFromLogicalTopOfFirstPage)
     134        return max(ZERO_LAYOUT_UNIT, logicalRightOffsetForLine(position, firstLine, region, offsetFromLogicalTopOfFirstPage)
    135135            - logicalLeftOffsetForLine(position, firstLine, region, offsetFromLogicalTopOfFirstPage));
    136136    }
     
    333333    LayoutUnit availableLogicalWidthForContent(RenderRegion* region, LayoutUnit offsetFromLogicalTopOfFirstPage) const
    334334    {
    335         return max<LayoutUnit>(0, logicalRightOffsetForContent(region, offsetFromLogicalTopOfFirstPage) -
     335        return max(ZERO_LAYOUT_UNIT, logicalRightOffsetForContent(region, offsetFromLogicalTopOfFirstPage) -
    336336            logicalLeftOffsetForContent(region, offsetFromLogicalTopOfFirstPage)); }
    337337    LayoutUnit startOffsetForContent(RenderRegion* region, LayoutUnit offsetFromLogicalTopOfFirstPage) const
     
    565565        void setIsPlaced(bool placed = true) { m_isPlaced = placed; }
    566566
    567         LayoutUnit x() const { ASSERT(isPlaced()); return m_frameRect.x(); }
    568         LayoutUnit maxX() const { ASSERT(isPlaced()); return m_frameRect.maxX(); }
    569         LayoutUnit y() const { ASSERT(isPlaced()); return m_frameRect.y(); }
    570         LayoutUnit maxY() const { ASSERT(isPlaced()); return m_frameRect.maxY(); }
    571         LayoutUnit width() const { return m_frameRect.width(); }
    572         LayoutUnit height() const { return m_frameRect.height(); }
    573 
    574         int pixelSnappedX() const { ASSERT(isPlaced()); return m_frameRect.pixelSnappedX(); }
    575         int pixelSnappedMaxX() const { ASSERT(isPlaced()); return m_frameRect.pixelSnappedMaxX(); }
    576         int pixelSnappedY() const { ASSERT(isPlaced()); return m_frameRect.pixelSnappedY(); }
    577         int pixelSnappedMaxY() const { ASSERT(isPlaced()); return m_frameRect.pixelSnappedMaxY(); }
    578         int pixelSnappedWidth() const { return m_frameRect.pixelSnappedWidth(); }
    579         int pixelSnappedHeight() const { return m_frameRect.pixelSnappedHeight(); }
     567        inline LayoutUnit x() const { ASSERT(isPlaced()); return m_frameRect.x(); }
     568        inline LayoutUnit maxX() const { ASSERT(isPlaced()); return m_frameRect.maxX(); }
     569        inline LayoutUnit y() const { ASSERT(isPlaced()); return m_frameRect.y(); }
     570        inline LayoutUnit maxY() const { ASSERT(isPlaced()); return m_frameRect.maxY(); }
     571        inline LayoutUnit width() const { return m_frameRect.width(); }
     572        inline LayoutUnit height() const { return m_frameRect.height(); }
     573
     574        inline int pixelSnappedX() const { ASSERT(isPlaced()); return m_frameRect.pixelSnappedX(); }
     575        inline int pixelSnappedMaxX() const { ASSERT(isPlaced()); return m_frameRect.pixelSnappedMaxX(); }
     576        inline int pixelSnappedY() const { ASSERT(isPlaced()); return m_frameRect.pixelSnappedY(); }
     577        inline int pixelSnappedMaxY() const { ASSERT(isPlaced()); return m_frameRect.pixelSnappedMaxY(); }
     578        inline int pixelSnappedWidth() const { return m_frameRect.pixelSnappedWidth(); }
     579        inline int pixelSnappedHeight() const { return m_frameRect.pixelSnappedHeight(); }
    580580
    581581        void setX(LayoutUnit x) { ASSERT(!isInPlacedTree()); m_frameRect.setX(x); }
     
    10731073        static LayoutUnit positiveMarginBeforeDefault(const RenderBlock* block)
    10741074        {
    1075             return std::max<LayoutUnit>(block->marginBefore(), 0);
     1075            return std::max(block->marginBefore(), ZERO_LAYOUT_UNIT);
    10761076        }
    10771077       
    10781078        static LayoutUnit negativeMarginBeforeDefault(const RenderBlock* block)
    10791079        {
    1080             return std::max<LayoutUnit>(-block->marginBefore(), 0);
     1080            return std::max(-block->marginBefore(), ZERO_LAYOUT_UNIT);
    10811081        }
    10821082        static LayoutUnit positiveMarginAfterDefault(const RenderBlock* block)
    10831083        {
    1084             return std::max<LayoutUnit>(block->marginAfter(), 0);
     1084            return std::max(block->marginAfter(), ZERO_LAYOUT_UNIT);
    10851085        }
    10861086        static LayoutUnit negativeMarginAfterDefault(const RenderBlock* block)
    10871087        {
    1088             return std::max<LayoutUnit>(-block->marginAfter(), 0);
     1088            return std::max(-block->marginAfter(), ZERO_LAYOUT_UNIT);
    10891089        }
    10901090       
  • trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp

    r116069 r116392  
    479479    if (!child->isAnonymousBlock() || !child->isRelPositioned())
    480480        return 0;
    481     LayoutUnit offset = 0;
     481    LayoutUnit offset = ZERO_LAYOUT_UNIT;
    482482    RenderObject* p = toRenderBlock(child)->inlineElementContinuation();
    483483    while (p && p->isRenderInline()) {
     
    541541    // return 0 and stop this algorithm.
    542542    if (isBody())
    543         return 0;
     543        return ZERO_LAYOUT_UNIT;
    544544   
    545545    RenderBoxModelObject* offsetPar = offsetParent();
     
    575575    // return 0 and stop this algorithm.
    576576    if (isBody())
    577         return 0;
     577        return ZERO_LAYOUT_UNIT;
    578578   
    579579    RenderBoxModelObject* offsetPar = offsetParent();
     
    615615LayoutUnit RenderBoxModelObject::computedCSSPaddingTop() const
    616616{
    617     LayoutUnit w = 0;
     617    LayoutUnit w = ZERO_LAYOUT_UNIT;
    618618    RenderView* renderView = 0;
    619619    Length padding = style()->paddingTop();
     
    627627LayoutUnit RenderBoxModelObject::computedCSSPaddingBottom() const
    628628{
    629     LayoutUnit w = 0;
     629    LayoutUnit w = ZERO_LAYOUT_UNIT;
    630630    RenderView* renderView = 0;
    631631    Length padding = style()->paddingBottom();
     
    639639LayoutUnit RenderBoxModelObject::computedCSSPaddingLeft() const
    640640{
    641     LayoutUnit w = 0;
     641    LayoutUnit w = ZERO_LAYOUT_UNIT;
    642642    RenderView* renderView = 0;
    643643    Length padding = style()->paddingLeft();
     
    651651LayoutUnit RenderBoxModelObject::computedCSSPaddingRight() const
    652652{
    653     LayoutUnit w = 0;
     653    LayoutUnit w = ZERO_LAYOUT_UNIT;
    654654    RenderView* renderView = 0;
    655655    Length padding = style()->paddingRight();
     
    663663LayoutUnit RenderBoxModelObject::computedCSSPaddingBefore() const
    664664{
    665     LayoutUnit w = 0;
     665    LayoutUnit w = ZERO_LAYOUT_UNIT;
    666666    RenderView* renderView = 0;
    667667    Length padding = style()->paddingBefore();
     
    675675LayoutUnit RenderBoxModelObject::computedCSSPaddingAfter() const
    676676{
    677     LayoutUnit w = 0;
     677    LayoutUnit w = ZERO_LAYOUT_UNIT;
    678678    RenderView* renderView = 0;
    679679    Length padding = style()->paddingAfter();
     
    687687LayoutUnit RenderBoxModelObject::computedCSSPaddingStart() const
    688688{
    689     LayoutUnit w = 0;
     689    LayoutUnit w = ZERO_LAYOUT_UNIT;
    690690    RenderView* renderView = 0;
    691691    Length padding = style()->paddingStart();
     
    699699LayoutUnit RenderBoxModelObject::computedCSSPaddingEnd() const
    700700{
    701     LayoutUnit w = 0;
     701    LayoutUnit w = ZERO_LAYOUT_UNIT;
    702702    RenderView* renderView = 0;
    703703    Length padding = style()->paddingEnd();
Note: See TracChangeset for help on using the changeset viewer.