Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (116391 => 116392)
--- trunk/Source/WebCore/rendering/RenderBlock.cpp 2012-05-08 04:11:08 UTC (rev 116391)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp 2012-05-08 04:12:07 UTC (rev 116392)
@@ -1236,7 +1236,7 @@
// (c) have border/padding,
// (d) have a min-height
// (e) have specified that one of our margins can't collapse using a CSS extension
- if (logicalHeight() > 0
+ if (logicalHeight() > ZERO_LAYOUT_UNIT
|| isTable() || borderAndPaddingLogicalHeight()
|| style()->logicalMinHeight().isPositive()
|| style()->marginBeforeCollapse() == MSEPARATE || style()->marginAfterCollapse() == MSEPARATE)
@@ -1381,7 +1381,7 @@
clearFloats();
LayoutUnit previousHeight = logicalHeight();
- setLogicalHeight(0);
+ setLogicalHeight(ZERO_LAYOUT_UNIT);
bool hasSpecifiedPageLogicalHeight = false;
bool pageLogicalHeightChanged = false;
ColumnInfo* colInfo = columnInfo();
@@ -1391,11 +1391,11 @@
// avoid doing two layout passes.
computeLogicalHeight();
LayoutUnit columnHeight = contentLogicalHeight();
- if (columnHeight > 0) {
+ if (columnHeight > ZERO_LAYOUT_UNIT) {
pageLogicalHeight = columnHeight;
hasSpecifiedPageLogicalHeight = true;
}
- setLogicalHeight(0);
+ setLogicalHeight(ZERO_LAYOUT_UNIT);
}
if (colInfo->columnHeight() != pageLogicalHeight && everHadLayout()) {
colInfo->setColumnHeight(pageLogicalHeight);
@@ -1454,9 +1454,9 @@
layer()->setHasVerticalScrollbar(true);
}
- LayoutUnit repaintLogicalTop = 0;
- LayoutUnit repaintLogicalBottom = 0;
- LayoutUnit maxFloatLogicalBottom = 0;
+ LayoutUnit repaintLogicalTop = ZERO_LAYOUT_UNIT;
+ LayoutUnit repaintLogicalBottom = ZERO_LAYOUT_UNIT;
+ LayoutUnit maxFloatLogicalBottom = ZERO_LAYOUT_UNIT;
if (!firstChild() && !isAnonymousBlock())
setChildrenInline(true);
if (childrenInline())
@@ -1593,9 +1593,9 @@
LayoutRect clientRect(clientBoxRect());
LayoutRect rectToApply;
if (isHorizontalWritingMode())
- rectToApply = LayoutRect(clientRect.x(), clientRect.y(), 1, max<LayoutUnit>(0, oldClientAfterEdge - clientRect.y()));
+ rectToApply = LayoutRect(clientRect.x(), clientRect.y(), 1, max(ZERO_LAYOUT_UNIT, oldClientAfterEdge - clientRect.y()));
else
- rectToApply = LayoutRect(clientRect.x(), clientRect.y(), max<LayoutUnit>(0, oldClientAfterEdge - clientRect.x()), 1);
+ rectToApply = LayoutRect(clientRect.x(), clientRect.y(), max(ZERO_LAYOUT_UNIT, oldClientAfterEdge - clientRect.x()), 1);
addLayoutOverflow(rectToApply);
}
@@ -1956,7 +1956,7 @@
// Adjust our height such that we are ready to be collapsed with subsequent siblings (or the bottom
// of the parent block).
- setLogicalHeight(child->y() - max<LayoutUnit>(0, marginInfo.margin()));
+ setLogicalHeight(child->y() - max(ZERO_LAYOUT_UNIT, marginInfo.margin()));
} else
// Increase our height by the amount we had to clear.
setLogicalHeight(height() + heightIncrease);
@@ -2720,7 +2720,7 @@
if (checkAfterAlways
&& (absoluteChildY + child->height()) > paintInfo.rect.y()
&& (absoluteChildY + child->height()) < paintInfo.rect.maxY()) {
- view()->setBestTruncatedAt(absoluteChildY + child->height() + max<LayoutUnit>(0, child->collapsedMarginAfter()), this, true);
+ view()->setBestTruncatedAt(absoluteChildY + child->height() + max(ZERO_LAYOUT_UNIT, child->collapsedMarginAfter()), this, true);
return;
}
}
@@ -3268,14 +3268,14 @@
{
LayoutUnit logicalTop = lastLogicalTop;
LayoutUnit logicalHeight = blockDirectionOffset(rootBlock, offsetFromRootBlock) + logicalBottom - logicalTop;
- if (logicalHeight <= static_cast<LayoutUnit>(0))
+ if (logicalHeight <= ZERO_LAYOUT_UNIT)
return LayoutRect();
// Get the selection offsets for the bottom of the gap
LayoutUnit logicalLeft = max(lastLogicalLeft, logicalLeftSelectionOffset(rootBlock, logicalBottom));
LayoutUnit logicalRight = min(lastLogicalRight, logicalRightSelectionOffset(rootBlock, logicalBottom));
LayoutUnit logicalWidth = logicalRight - logicalLeft;
- if (logicalWidth <= static_cast<LayoutUnit>(0))
+ if (logicalWidth <= ZERO_LAYOUT_UNIT)
return LayoutRect();
LayoutRect gapRect = rootBlock->logicalRectToPhysicalRect(rootBlockPhysicalPosition, LayoutRect(logicalLeft, logicalTop, logicalWidth, logicalHeight));
@@ -3291,7 +3291,7 @@
LayoutUnit rootBlockLogicalLeft = max(logicalLeftSelectionOffset(rootBlock, logicalTop), logicalLeftSelectionOffset(rootBlock, logicalTop + logicalHeight));
LayoutUnit rootBlockLogicalRight = min(inlineDirectionOffset(rootBlock, offsetFromRootBlock) + logicalLeft, min(logicalRightSelectionOffset(rootBlock, logicalTop), logicalRightSelectionOffset(rootBlock, logicalTop + logicalHeight)));
LayoutUnit rootBlockLogicalWidth = rootBlockLogicalRight - rootBlockLogicalLeft;
- if (rootBlockLogicalWidth <= static_cast<LayoutUnit>(0))
+ if (rootBlockLogicalWidth <= ZERO_LAYOUT_UNIT)
return LayoutRect();
LayoutRect gapRect = rootBlock->logicalRectToPhysicalRect(rootBlockPhysicalPosition, LayoutRect(rootBlockLogicalLeft, rootBlockLogicalTop, rootBlockLogicalWidth, logicalHeight));
@@ -3307,7 +3307,7 @@
LayoutUnit rootBlockLogicalLeft = max(inlineDirectionOffset(rootBlock, offsetFromRootBlock) + logicalRight, max(logicalLeftSelectionOffset(rootBlock, logicalTop), logicalLeftSelectionOffset(rootBlock, logicalTop + logicalHeight)));
LayoutUnit rootBlockLogicalRight = min(logicalRightSelectionOffset(rootBlock, logicalTop), logicalRightSelectionOffset(rootBlock, logicalTop + logicalHeight));
LayoutUnit rootBlockLogicalWidth = rootBlockLogicalRight - rootBlockLogicalLeft;
- if (rootBlockLogicalWidth <= static_cast<LayoutUnit>(0))
+ if (rootBlockLogicalWidth <= ZERO_LAYOUT_UNIT)
return LayoutRect();
LayoutRect gapRect = rootBlock->logicalRectToPhysicalRect(rootBlockPhysicalPosition, LayoutRect(rootBlockLogicalLeft, rootBlockLogicalTop, rootBlockLogicalWidth, logicalHeight));
@@ -3575,7 +3575,7 @@
floatLogicalWidth = min(logicalWidthForFloat(floatingObject), logicalRightOffset - logicalLeftOffset);
}
}
- floatLogicalLeft = max<LayoutUnit>(logicalLeftOffset - borderAndPaddingLogicalLeft(), floatLogicalLeft);
+ floatLogicalLeft = max(logicalLeftOffset - borderAndPaddingLogicalLeft(), floatLogicalLeft);
} else {
LayoutUnit heightRemainingLeft = 1;
LayoutUnit heightRemainingRight = 1;
@@ -3969,8 +3969,8 @@
LayoutUnit RenderBlock::lowestFloatLogicalBottom(FloatingObject::Type floatType) const
{
if (!m_floatingObjects)
- return 0;
- LayoutUnit lowestFloatBottom = 0;
+ return ZERO_LAYOUT_UNIT;
+ LayoutUnit lowestFloatBottom = ZERO_LAYOUT_UNIT;
const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
FloatingObjectSetIterator end = floatingObjectSet.end();
for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++it) {
@@ -4347,7 +4347,7 @@
}
// 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).
- LayoutUnit result = clearSet ? max<LayoutUnit>(0, logicalBottom - logicalTop) : ZERO_LAYOUT_UNIT;
+ LayoutUnit result = clearSet ? max(ZERO_LAYOUT_UNIT, logicalBottom - logicalTop) : ZERO_LAYOUT_UNIT;
if (!result && child->avoidsFloats()) {
LayoutUnit newLogicalTop = logicalTop;
while (true) {
@@ -5690,8 +5690,8 @@
}
// Always make sure these values are non-negative.
- m_minPreferredLogicalWidth = max<LayoutUnit>(0, m_minPreferredLogicalWidth);
- m_maxPreferredLogicalWidth = max<LayoutUnit>(0, m_maxPreferredLogicalWidth);
+ m_minPreferredLogicalWidth = max(ZERO_LAYOUT_UNIT, m_minPreferredLogicalWidth);
+ m_maxPreferredLogicalWidth = max(ZERO_LAYOUT_UNIT, m_maxPreferredLogicalWidth);
m_maxPreferredLogicalWidth = max(floatLeftWidth + floatRightWidth, m_maxPreferredLogicalWidth);
}
@@ -6490,8 +6490,8 @@
// FIXME: This is wrong for block-flows that are horizontal.
// https://bugs.webkit.org/show_bug.cgi?id=46781
bool prevInlineHasLineBox = toRenderInline(inlineElementContinuation()->node()->renderer())->firstLineBox();
- float topMargin = prevInlineHasLineBox ? collapsedMarginBefore() : static_cast<LayoutUnit>(0);
- float bottomMargin = nextInlineHasLineBox ? collapsedMarginAfter() : static_cast<LayoutUnit>(0);
+ float topMargin = prevInlineHasLineBox ? collapsedMarginBefore() : ZERO_LAYOUT_UNIT;
+ float bottomMargin = nextInlineHasLineBox ? collapsedMarginAfter() : ZERO_LAYOUT_UNIT;
LayoutRect rect(additionalOffset.x(), additionalOffset.y() - topMargin, width(), height() + topMargin + bottomMargin);
if (!rect.isEmpty())
rects.append(pixelSnappedIntRect(rect));
@@ -6743,10 +6743,10 @@
// If we have a non-uniform page height, then we have to shift further possibly.
if (!hasUniformPageLogicalHeight && !pushToNextPageWithMinimumLogicalHeight(remainingLogicalHeight, logicalOffset, lineHeight))
return;
- LayoutUnit totalLogicalHeight = lineHeight + max<LayoutUnit>(0, logicalOffset);
+ LayoutUnit totalLogicalHeight = lineHeight + max(ZERO_LAYOUT_UNIT, logicalOffset);
LayoutUnit pageLogicalHeightAtNewOffset = hasUniformPageLogicalHeight ? pageLogicalHeight : pageLogicalHeightForOffset(logicalOffset + remainingLogicalHeight);
if (lineBox == firstRootBox() && totalLogicalHeight < pageLogicalHeightAtNewOffset && !isPositioned() && !isTableCell())
- setPaginationStrut(remainingLogicalHeight + max<LayoutUnit>(0, logicalOffset));
+ setPaginationStrut(remainingLogicalHeight + max(ZERO_LAYOUT_UNIT, logicalOffset));
else {
delta += remainingLogicalHeight;
lineBox->setPaginationStrut(remainingLogicalHeight);
Modified: trunk/Source/WebCore/rendering/RenderBlock.h (116391 => 116392)
--- trunk/Source/WebCore/rendering/RenderBlock.h 2012-05-08 04:11:08 UTC (rev 116391)
+++ trunk/Source/WebCore/rendering/RenderBlock.h 2012-05-08 04:12:07 UTC (rev 116392)
@@ -131,7 +131,7 @@
// compute the region all over again when you already know it.
LayoutUnit availableLogicalWidthForLine(LayoutUnit position, bool firstLine, RenderRegion* region, LayoutUnit offsetFromLogicalTopOfFirstPage) const
{
- return max<LayoutUnit>(0, logicalRightOffsetForLine(position, firstLine, region, offsetFromLogicalTopOfFirstPage)
+ return max(ZERO_LAYOUT_UNIT, logicalRightOffsetForLine(position, firstLine, region, offsetFromLogicalTopOfFirstPage)
- logicalLeftOffsetForLine(position, firstLine, region, offsetFromLogicalTopOfFirstPage));
}
LayoutUnit logicalRightOffsetForLine(LayoutUnit position, bool firstLine, RenderRegion* region, LayoutUnit offsetFromLogicalTopOfFirstPage) const
@@ -332,7 +332,7 @@
LayoutUnit logicalRightOffsetForContent(RenderRegion*, LayoutUnit offsetFromLogicalTopOfFirstPage) const;
LayoutUnit availableLogicalWidthForContent(RenderRegion* region, LayoutUnit offsetFromLogicalTopOfFirstPage) const
{
- return max<LayoutUnit>(0, logicalRightOffsetForContent(region, offsetFromLogicalTopOfFirstPage) -
+ return max(ZERO_LAYOUT_UNIT, logicalRightOffsetForContent(region, offsetFromLogicalTopOfFirstPage) -
logicalLeftOffsetForContent(region, offsetFromLogicalTopOfFirstPage)); }
LayoutUnit startOffsetForContent(RenderRegion* region, LayoutUnit offsetFromLogicalTopOfFirstPage) const
{
@@ -564,19 +564,19 @@
bool isPlaced() const { return m_isPlaced; }
void setIsPlaced(bool placed = true) { m_isPlaced = placed; }
- LayoutUnit x() const { ASSERT(isPlaced()); return m_frameRect.x(); }
- LayoutUnit maxX() const { ASSERT(isPlaced()); return m_frameRect.maxX(); }
- LayoutUnit y() const { ASSERT(isPlaced()); return m_frameRect.y(); }
- LayoutUnit maxY() const { ASSERT(isPlaced()); return m_frameRect.maxY(); }
- LayoutUnit width() const { return m_frameRect.width(); }
- LayoutUnit height() const { return m_frameRect.height(); }
+ inline LayoutUnit x() const { ASSERT(isPlaced()); return m_frameRect.x(); }
+ inline LayoutUnit maxX() const { ASSERT(isPlaced()); return m_frameRect.maxX(); }
+ inline LayoutUnit y() const { ASSERT(isPlaced()); return m_frameRect.y(); }
+ inline LayoutUnit maxY() const { ASSERT(isPlaced()); return m_frameRect.maxY(); }
+ inline LayoutUnit width() const { return m_frameRect.width(); }
+ inline LayoutUnit height() const { return m_frameRect.height(); }
- int pixelSnappedX() const { ASSERT(isPlaced()); return m_frameRect.pixelSnappedX(); }
- int pixelSnappedMaxX() const { ASSERT(isPlaced()); return m_frameRect.pixelSnappedMaxX(); }
- int pixelSnappedY() const { ASSERT(isPlaced()); return m_frameRect.pixelSnappedY(); }
- int pixelSnappedMaxY() const { ASSERT(isPlaced()); return m_frameRect.pixelSnappedMaxY(); }
- int pixelSnappedWidth() const { return m_frameRect.pixelSnappedWidth(); }
- int pixelSnappedHeight() const { return m_frameRect.pixelSnappedHeight(); }
+ inline int pixelSnappedX() const { ASSERT(isPlaced()); return m_frameRect.pixelSnappedX(); }
+ inline int pixelSnappedMaxX() const { ASSERT(isPlaced()); return m_frameRect.pixelSnappedMaxX(); }
+ inline int pixelSnappedY() const { ASSERT(isPlaced()); return m_frameRect.pixelSnappedY(); }
+ inline int pixelSnappedMaxY() const { ASSERT(isPlaced()); return m_frameRect.pixelSnappedMaxY(); }
+ inline int pixelSnappedWidth() const { return m_frameRect.pixelSnappedWidth(); }
+ inline int pixelSnappedHeight() const { return m_frameRect.pixelSnappedHeight(); }
void setX(LayoutUnit x) { ASSERT(!isInPlacedTree()); m_frameRect.setX(x); }
void setY(LayoutUnit y) { ASSERT(!isInPlacedTree()); m_frameRect.setY(y); }
@@ -1072,20 +1072,20 @@
static LayoutUnit positiveMarginBeforeDefault(const RenderBlock* block)
{
- return std::max<LayoutUnit>(block->marginBefore(), 0);
+ return std::max(block->marginBefore(), ZERO_LAYOUT_UNIT);
}
static LayoutUnit negativeMarginBeforeDefault(const RenderBlock* block)
{
- return std::max<LayoutUnit>(-block->marginBefore(), 0);
+ return std::max(-block->marginBefore(), ZERO_LAYOUT_UNIT);
}
static LayoutUnit positiveMarginAfterDefault(const RenderBlock* block)
{
- return std::max<LayoutUnit>(block->marginAfter(), 0);
+ return std::max(block->marginAfter(), ZERO_LAYOUT_UNIT);
}
static LayoutUnit negativeMarginAfterDefault(const RenderBlock* block)
{
- return std::max<LayoutUnit>(-block->marginAfter(), 0);
+ return std::max(-block->marginAfter(), ZERO_LAYOUT_UNIT);
}
MarginValues m_margins;
Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp (116391 => 116392)
--- trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp 2012-05-08 04:11:08 UTC (rev 116391)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp 2012-05-08 04:12:07 UTC (rev 116392)
@@ -478,7 +478,7 @@
{
if (!child->isAnonymousBlock() || !child->isRelPositioned())
return 0;
- LayoutUnit offset = 0;
+ LayoutUnit offset = ZERO_LAYOUT_UNIT;
RenderObject* p = toRenderBlock(child)->inlineElementContinuation();
while (p && p->isRenderInline()) {
if (p->isRelPositioned())
@@ -540,7 +540,7 @@
// If the element is the HTML body element or does not have an associated box
// return 0 and stop this algorithm.
if (isBody())
- return 0;
+ return ZERO_LAYOUT_UNIT;
RenderBoxModelObject* offsetPar = offsetParent();
LayoutUnit xPos = (isBox() ? toRenderBox(this)->left() : ZERO_LAYOUT_UNIT);
@@ -574,7 +574,7 @@
// If the element is the HTML body element or does not have an associated box
// return 0 and stop this algorithm.
if (isBody())
- return 0;
+ return ZERO_LAYOUT_UNIT;
RenderBoxModelObject* offsetPar = offsetParent();
LayoutUnit yPos = (isBox() ? toRenderBox(this)->top() : ZERO_LAYOUT_UNIT);
@@ -614,7 +614,7 @@
LayoutUnit RenderBoxModelObject::computedCSSPaddingTop() const
{
- LayoutUnit w = 0;
+ LayoutUnit w = ZERO_LAYOUT_UNIT;
RenderView* renderView = 0;
Length padding = style()->paddingTop();
if (padding.isPercent())
@@ -626,7 +626,7 @@
LayoutUnit RenderBoxModelObject::computedCSSPaddingBottom() const
{
- LayoutUnit w = 0;
+ LayoutUnit w = ZERO_LAYOUT_UNIT;
RenderView* renderView = 0;
Length padding = style()->paddingBottom();
if (padding.isPercent())
@@ -638,7 +638,7 @@
LayoutUnit RenderBoxModelObject::computedCSSPaddingLeft() const
{
- LayoutUnit w = 0;
+ LayoutUnit w = ZERO_LAYOUT_UNIT;
RenderView* renderView = 0;
Length padding = style()->paddingLeft();
if (padding.isPercent())
@@ -650,7 +650,7 @@
LayoutUnit RenderBoxModelObject::computedCSSPaddingRight() const
{
- LayoutUnit w = 0;
+ LayoutUnit w = ZERO_LAYOUT_UNIT;
RenderView* renderView = 0;
Length padding = style()->paddingRight();
if (padding.isPercent())
@@ -662,7 +662,7 @@
LayoutUnit RenderBoxModelObject::computedCSSPaddingBefore() const
{
- LayoutUnit w = 0;
+ LayoutUnit w = ZERO_LAYOUT_UNIT;
RenderView* renderView = 0;
Length padding = style()->paddingBefore();
if (padding.isPercent())
@@ -674,7 +674,7 @@
LayoutUnit RenderBoxModelObject::computedCSSPaddingAfter() const
{
- LayoutUnit w = 0;
+ LayoutUnit w = ZERO_LAYOUT_UNIT;
RenderView* renderView = 0;
Length padding = style()->paddingAfter();
if (padding.isPercent())
@@ -686,7 +686,7 @@
LayoutUnit RenderBoxModelObject::computedCSSPaddingStart() const
{
- LayoutUnit w = 0;
+ LayoutUnit w = ZERO_LAYOUT_UNIT;
RenderView* renderView = 0;
Length padding = style()->paddingStart();
if (padding.isPercent())
@@ -698,7 +698,7 @@
LayoutUnit RenderBoxModelObject::computedCSSPaddingEnd() const
{
- LayoutUnit w = 0;
+ LayoutUnit w = ZERO_LAYOUT_UNIT;
RenderView* renderView = 0;
Length padding = style()->paddingEnd();
if (padding.isPercent())