Index: Source/core/rendering/RenderBlockFlow.cpp |
diff --git a/Source/core/rendering/RenderBlockFlow.cpp b/Source/core/rendering/RenderBlockFlow.cpp |
index 3a20f5a8f94cb13b3b41f658ee5acf0b4e8747a5..0762afc94900c69c51cad649dee2c1454d741a2d 100644 |
--- a/Source/core/rendering/RenderBlockFlow.cpp |
+++ b/Source/core/rendering/RenderBlockFlow.cpp |
@@ -45,8 +45,6 @@ |
#include "core/rendering/svg/SVGTextRunRenderingContext.h" |
#include "platform/text/BidiTextRun.h" |
-using namespace std; |
- |
namespace WebCore { |
bool RenderBlockFlow::s_canPropagateFloatIntoSibling = false; |
@@ -252,13 +250,13 @@ bool RenderBlockFlow::shouldRelayoutForPagination(LayoutUnit& pageLogicalHeight, |
// The forced page breaks are in control of the balancing. Just set the column height to the |
// maximum page break distance. |
if (!pageLogicalHeight) { |
- LayoutUnit distanceBetweenBreaks = max<LayoutUnit>(colInfo->maximumDistanceBetweenForcedBreaks(), |
+ LayoutUnit distanceBetweenBreaks = std::max<LayoutUnit>(colInfo->maximumDistanceBetweenForcedBreaks(), |
view()->layoutState()->pageLogicalOffset(*this, borderBefore() + paddingBefore() + layoutOverflowLogicalBottom) - colInfo->forcedBreakOffset()); |
- columnHeight = max(colInfo->minimumColumnHeight(), distanceBetweenBreaks); |
+ columnHeight = std::max(colInfo->minimumColumnHeight(), distanceBetweenBreaks); |
} |
} else if (layoutOverflowLogicalBottom > boundedMultiply(pageLogicalHeight, desiredColumnCount)) { |
// Now that we know the intrinsic height of the columns, we have to rebalance them. |
- columnHeight = max<LayoutUnit>(colInfo->minimumColumnHeight(), ceilf(layoutOverflowLogicalBottom.toFloat() / desiredColumnCount)); |
+ columnHeight = std::max<LayoutUnit>(colInfo->minimumColumnHeight(), ceilf(layoutOverflowLogicalBottom.toFloat() / desiredColumnCount)); |
} |
if (columnHeight && columnHeight != pageLogicalHeight) { |
@@ -531,7 +529,7 @@ void RenderBlockFlow::layoutBlockChild(RenderBox* child, MarginInfo& marginInfo, |
} else if (!child->avoidsFloats() || child->shrinkToAvoidFloats()) { |
// If an element might be affected by the presence of floats, then always mark it for |
// layout. |
- LayoutUnit fb = max(previousFloatLogicalBottom, lowestFloatLogicalBottom()); |
+ LayoutUnit fb = std::max(previousFloatLogicalBottom, lowestFloatLogicalBottom()); |
if (fb > logicalTopEstimate) |
markDescendantsWithFloats = true; |
} |
@@ -540,7 +538,7 @@ void RenderBlockFlow::layoutBlockChild(RenderBox* child, MarginInfo& marginInfo, |
if (markDescendantsWithFloats) |
childRenderBlockFlow->markAllDescendantsWithFloatsForLayout(); |
if (!child->isWritingModeRoot()) |
- previousFloatLogicalBottom = max(previousFloatLogicalBottom, oldLogicalTop + childRenderBlockFlow->lowestFloatLogicalBottom()); |
+ previousFloatLogicalBottom = std::max(previousFloatLogicalBottom, oldLogicalTop + childRenderBlockFlow->lowestFloatLogicalBottom()); |
} |
SubtreeLayoutScope layoutScope(*child); |
@@ -829,17 +827,17 @@ void RenderBlockFlow::rebuildFloatsFromIntruding() |
LayoutUnit oldLogicalBottom = logicalBottomForFloat(oldFloatingObject); |
if (logicalWidthForFloat(floatingObject) != logicalWidthForFloat(oldFloatingObject) || logicalLeftForFloat(floatingObject) != logicalLeftForFloat(oldFloatingObject)) { |
changeLogicalTop = 0; |
- changeLogicalBottom = max(changeLogicalBottom, max(logicalBottom, oldLogicalBottom)); |
+ changeLogicalBottom = std::max(changeLogicalBottom, std::max(logicalBottom, oldLogicalBottom)); |
} else { |
if (logicalBottom != oldLogicalBottom) { |
- changeLogicalTop = min(changeLogicalTop, min(logicalBottom, oldLogicalBottom)); |
- changeLogicalBottom = max(changeLogicalBottom, max(logicalBottom, oldLogicalBottom)); |
+ changeLogicalTop = std::min(changeLogicalTop, std::min(logicalBottom, oldLogicalBottom)); |
+ changeLogicalBottom = std::max(changeLogicalBottom, std::max(logicalBottom, oldLogicalBottom)); |
} |
LayoutUnit logicalTop = logicalTopForFloat(floatingObject); |
LayoutUnit oldLogicalTop = logicalTopForFloat(oldFloatingObject); |
if (logicalTop != oldLogicalTop) { |
- changeLogicalTop = min(changeLogicalTop, min(logicalTop, oldLogicalTop)); |
- changeLogicalBottom = max(changeLogicalBottom, max(logicalTop, oldLogicalTop)); |
+ changeLogicalTop = std::min(changeLogicalTop, std::min(logicalTop, oldLogicalTop)); |
+ changeLogicalBottom = std::max(changeLogicalBottom, std::max(logicalTop, oldLogicalTop)); |
} |
} |
@@ -851,7 +849,7 @@ void RenderBlockFlow::rebuildFloatsFromIntruding() |
floatMap.remove(floatingObject->renderer()); |
} else { |
changeLogicalTop = 0; |
- changeLogicalBottom = max(changeLogicalBottom, logicalBottom); |
+ changeLogicalBottom = std::max(changeLogicalBottom, logicalBottom); |
} |
} |
} |
@@ -861,7 +859,7 @@ void RenderBlockFlow::rebuildFloatsFromIntruding() |
OwnPtr<FloatingObject>& floatingObject = it->value; |
if (!floatingObject->isDescendant()) { |
changeLogicalTop = 0; |
- changeLogicalBottom = max(changeLogicalBottom, logicalBottomForFloat(floatingObject.get())); |
+ changeLogicalBottom = std::max(changeLogicalBottom, logicalBottomForFloat(floatingObject.get())); |
} |
} |
@@ -1041,8 +1039,8 @@ LayoutUnit RenderBlockFlow::collapseMargins(RenderBox* child, MarginInfo& margin |
// For self-collapsing blocks, collapse our bottom margins into our |
// top to get new posTop and negTop values. |
if (childIsSelfCollapsing) { |
- posTop = max(posTop, childMargins.positiveMarginAfter()); |
- negTop = max(negTop, childMargins.negativeMarginAfter()); |
+ posTop = std::max(posTop, childMargins.positiveMarginAfter()); |
+ negTop = std::max(negTop, childMargins.negativeMarginAfter()); |
} |
// See if the top margin is quirky. We only care if this child has |
@@ -1055,7 +1053,7 @@ LayoutUnit RenderBlockFlow::collapseMargins(RenderBox* child, MarginInfo& margin |
// block. If it has larger margin values, then we need to update |
// our own maximal values. |
if (!document().inQuirksMode() || !marginInfo.quirkContainer() || !topQuirk) |
- setMaxMarginBeforeValues(max(posTop, maxPositiveMarginBefore()), max(negTop, maxNegativeMarginBefore())); |
+ setMaxMarginBeforeValues(std::max(posTop, maxPositiveMarginBefore()), std::max(negTop, maxNegativeMarginBefore())); |
// The minute any of the margins involved isn't a quirk, don't |
// collapse it away, even if the margin is smaller (www.webreference.com |
@@ -1110,8 +1108,8 @@ LayoutUnit RenderBlockFlow::collapseMargins(RenderBox* child, MarginInfo& margin |
// This child has no height. We need to compute our |
// position before we collapse the child's margins together, |
// so that we can get an accurate position for the zero-height block. |
- LayoutUnit collapsedBeforePos = max(marginInfo.positiveMargin(), childMargins.positiveMarginBefore()); |
- LayoutUnit collapsedBeforeNeg = max(marginInfo.negativeMargin(), childMargins.negativeMarginBefore()); |
+ LayoutUnit collapsedBeforePos = std::max(marginInfo.positiveMargin(), childMargins.positiveMarginBefore()); |
+ LayoutUnit collapsedBeforeNeg = std::max(marginInfo.negativeMargin(), childMargins.negativeMarginBefore()); |
marginInfo.setMargin(collapsedBeforePos, collapsedBeforeNeg); |
// Now collapse the child's margins together, which means examining our |
@@ -1141,7 +1139,7 @@ LayoutUnit RenderBlockFlow::collapseMargins(RenderBox* child, MarginInfo& margin |
&& (!document().inQuirksMode() || !marginInfo.quirkContainer() || !marginInfo.hasMarginBeforeQuirk())))) { |
// We're collapsing with a previous sibling's margins and not |
// with the top of the block. |
- setLogicalHeight(logicalHeight() + max(marginInfo.positiveMargin(), posTop) - max(marginInfo.negativeMargin(), negTop)); |
+ setLogicalHeight(logicalHeight() + std::max(marginInfo.positiveMargin(), posTop) - std::max(marginInfo.negativeMargin(), negTop)); |
logicalTop = logicalHeight(); |
} |
@@ -1163,7 +1161,7 @@ LayoutUnit RenderBlockFlow::collapseMargins(RenderBox* child, MarginInfo& margin |
LayoutState* layoutState = view()->layoutState(); |
if (layoutState->isPaginated() && layoutState->pageLogicalHeight() && logicalTop > beforeCollapseLogicalTop) { |
LayoutUnit oldLogicalTop = logicalTop; |
- logicalTop = min(logicalTop, nextPageLogicalTop(beforeCollapseLogicalTop)); |
+ logicalTop = std::min(logicalTop, nextPageLogicalTop(beforeCollapseLogicalTop)); |
setLogicalHeight(logicalHeight() + (logicalTop - oldLogicalTop)); |
} |
@@ -1225,7 +1223,7 @@ LayoutUnit RenderBlockFlow::computeStartPositionDeltaForChildAvoidingFloats(cons |
if (style()->textAlign() != WEBKIT_CENTER && !child->style()->marginStartUsing(style()).isAuto()) { |
if (childMarginStart < 0) |
startOff += childMarginStart; |
- newPosition = max(newPosition, startOff); // Let the float sit in the child's margin if it can fit. |
+ newPosition = std::max(newPosition, startOff); // Let the float sit in the child's margin if it can fit. |
} else if (startOff != startPosition) { |
newPosition = startOff + childMarginStart; |
} |
@@ -1248,8 +1246,8 @@ LayoutUnit RenderBlockFlow::clearFloatsIfNeeded(RenderBox* child, MarginInfo& ma |
// If DISCARD is specified for -webkit-margin-collapse, reset the margin values. |
RenderBlockFlow::MarginValues childMargins = marginValuesForChild(child); |
if (!childDiscardMargin) { |
- marginInfo.setPositiveMargin(max(childMargins.positiveMarginBefore(), childMargins.positiveMarginAfter())); |
- marginInfo.setNegativeMargin(max(childMargins.negativeMarginBefore(), childMargins.negativeMarginAfter())); |
+ marginInfo.setPositiveMargin(std::max(childMargins.positiveMarginBefore(), childMargins.positiveMarginAfter())); |
+ marginInfo.setNegativeMargin(std::max(childMargins.negativeMarginBefore(), childMargins.negativeMarginAfter())); |
} else { |
marginInfo.clearMargin(); |
} |
@@ -1300,7 +1298,7 @@ void RenderBlockFlow::setCollapsedBottomMargin(const MarginInfo& marginInfo) |
// Update our max pos/neg bottom margins, since we collapsed our bottom margins |
// with our children. |
- setMaxMarginAfterValues(max(maxPositiveMarginAfter(), marginInfo.positiveMargin()), max(maxNegativeMarginAfter(), marginInfo.negativeMargin())); |
+ setMaxMarginAfterValues(std::max(maxPositiveMarginAfter(), marginInfo.positiveMargin()), std::max(maxNegativeMarginAfter(), marginInfo.negativeMargin())); |
if (!marginInfo.hasMarginAfterQuirk()) |
setHasMarginAfterQuirk(false); |
@@ -1332,8 +1330,8 @@ void RenderBlockFlow::marginBeforeEstimateForChild(RenderBox* child, LayoutUnit& |
} |
LayoutUnit beforeChildMargin = marginBeforeForChild(child); |
- positiveMarginBefore = max(positiveMarginBefore, beforeChildMargin); |
- negativeMarginBefore = max(negativeMarginBefore, -beforeChildMargin); |
+ positiveMarginBefore = std::max(positiveMarginBefore, beforeChildMargin); |
+ negativeMarginBefore = std::max(negativeMarginBefore, -beforeChildMargin); |
if (!child->isRenderBlockFlow()) |
return; |
@@ -1386,21 +1384,21 @@ LayoutUnit RenderBlockFlow::estimateLogicalTopPosition(RenderBox* child, const M |
// Use the cached collapsed margin values from a previous layout. Most of the time they |
// will be right. |
RenderBlockFlow::MarginValues marginValues = marginValuesForChild(child); |
- positiveMarginBefore = max(positiveMarginBefore, marginValues.positiveMarginBefore()); |
- negativeMarginBefore = max(negativeMarginBefore, marginValues.negativeMarginBefore()); |
+ positiveMarginBefore = std::max(positiveMarginBefore, marginValues.positiveMarginBefore()); |
+ negativeMarginBefore = std::max(negativeMarginBefore, marginValues.negativeMarginBefore()); |
discardMarginBefore = mustDiscardMarginBeforeForChild(child); |
} |
// Collapse the result with our current margins. |
if (!discardMarginBefore) |
- logicalTopEstimate += max(marginInfo.positiveMargin(), positiveMarginBefore) - max(marginInfo.negativeMargin(), negativeMarginBefore); |
+ logicalTopEstimate += std::max(marginInfo.positiveMargin(), positiveMarginBefore) - std::max(marginInfo.negativeMargin(), negativeMarginBefore); |
} |
// Adjust logicalTopEstimate down to the next page if the margins are so large that we don't fit on the current |
// page. |
LayoutState* layoutState = view()->layoutState(); |
if (layoutState->isPaginated() && layoutState->pageLogicalHeight() && logicalTopEstimate > logicalHeight()) |
- logicalTopEstimate = min(logicalTopEstimate, nextPageLogicalTop(logicalHeight())); |
+ logicalTopEstimate = std::min(logicalTopEstimate, nextPageLogicalTop(logicalHeight())); |
logicalTopEstimate += getClearDelta(child, logicalTopEstimate); |
@@ -1473,7 +1471,7 @@ void RenderBlockFlow::handleAfterSideOfBlock(RenderBox* lastChild, LayoutUnit be |
// Negative margins can cause our height to shrink below our minimal height (border/padding). |
// If this happens, ensure that the computed height is increased to the minimal height. |
- setLogicalHeight(max(logicalHeight(), beforeSide + afterSide)); |
+ setLogicalHeight(std::max(logicalHeight(), beforeSide + afterSide)); |
// Update our bottom collapsed margin info. |
setCollapsedBottomMargin(marginInfo); |
@@ -1764,7 +1762,7 @@ LayoutUnit RenderBlockFlow::getClearDelta(RenderBox* child, LayoutUnit logicalTo |
} |
// 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) : LayoutUnit(); |
+ LayoutUnit result = clearSet ? std::max<LayoutUnit>(0, logicalBottom - logicalTop) : LayoutUnit(); |
if (!result && child->avoidsFloats()) { |
LayoutUnit newLogicalTop = logicalTop; |
while (true) { |
@@ -1970,8 +1968,8 @@ void RenderBlockFlow::invalidatePaintForOverflow() |
// If we have clipped overflow, we should use layout overflow as well, since visual overflow from lines didn't propagate to our block's overflow. |
// Note the old code did this as well but even for overflow:visible. The addition of hasOverflowClip() at least tightens up the hack a bit. |
// layoutInlineChildren should be patched to compute the entire repaint rect. |
- repaintLogicalLeft = min(repaintLogicalLeft, logicalLeftLayoutOverflow()); |
- repaintLogicalRight = max(repaintLogicalRight, logicalRightLayoutOverflow()); |
+ repaintLogicalLeft = std::min(repaintLogicalLeft, logicalLeftLayoutOverflow()); |
+ repaintLogicalRight = std::max(repaintLogicalRight, logicalRightLayoutOverflow()); |
} |
LayoutRect repaintRect; |
@@ -2144,7 +2142,7 @@ LayoutPoint RenderBlockFlow::computeLogicalLocationForFloat(const FloatingObject |
LayoutUnit logicalRightOffset; // Constant part of right offset. |
logicalRightOffset = logicalRightOffsetForContent(); |
- LayoutUnit floatLogicalWidth = min(logicalWidthForFloat(floatingObject), logicalRightOffset - logicalLeftOffset); // The width we look for. |
+ LayoutUnit floatLogicalWidth = std::min(logicalWidthForFloat(floatingObject), logicalRightOffset - logicalLeftOffset); // The width we look for. |
LayoutUnit floatLogicalLeft; |
@@ -2155,28 +2153,28 @@ LayoutPoint RenderBlockFlow::computeLogicalLocationForFloat(const FloatingObject |
LayoutUnit heightRemainingRight = 1; |
floatLogicalLeft = logicalLeftOffsetForPositioningFloat(logicalTopOffset, logicalLeftOffset, false, &heightRemainingLeft); |
while (logicalRightOffsetForPositioningFloat(logicalTopOffset, logicalRightOffset, false, &heightRemainingRight) - floatLogicalLeft < floatLogicalWidth) { |
- logicalTopOffset += min(heightRemainingLeft, heightRemainingRight); |
+ logicalTopOffset += std::min(heightRemainingLeft, heightRemainingRight); |
floatLogicalLeft = logicalLeftOffsetForPositioningFloat(logicalTopOffset, logicalLeftOffset, false, &heightRemainingLeft); |
if (insideFlowThread) { |
// Have to re-evaluate all of our offsets, since they may have changed. |
logicalRightOffset = logicalRightOffsetForContent(); // Constant part of right offset. |
logicalLeftOffset = logicalLeftOffsetForContent(); // Constant part of left offset. |
- floatLogicalWidth = min(logicalWidthForFloat(floatingObject), logicalRightOffset - logicalLeftOffset); |
+ floatLogicalWidth = std::min(logicalWidthForFloat(floatingObject), logicalRightOffset - logicalLeftOffset); |
} |
} |
- floatLogicalLeft = max(logicalLeftOffset - borderAndPaddingLogicalLeft(), floatLogicalLeft); |
+ floatLogicalLeft = std::max(logicalLeftOffset - borderAndPaddingLogicalLeft(), floatLogicalLeft); |
} else { |
LayoutUnit heightRemainingLeft = 1; |
LayoutUnit heightRemainingRight = 1; |
floatLogicalLeft = logicalRightOffsetForPositioningFloat(logicalTopOffset, logicalRightOffset, false, &heightRemainingRight); |
while (floatLogicalLeft - logicalLeftOffsetForPositioningFloat(logicalTopOffset, logicalLeftOffset, false, &heightRemainingLeft) < floatLogicalWidth) { |
- logicalTopOffset += min(heightRemainingLeft, heightRemainingRight); |
+ logicalTopOffset += std::min(heightRemainingLeft, heightRemainingRight); |
floatLogicalLeft = logicalRightOffsetForPositioningFloat(logicalTopOffset, logicalRightOffset, false, &heightRemainingRight); |
if (insideFlowThread) { |
// Have to re-evaluate all of our offsets, since they may have changed. |
logicalRightOffset = logicalRightOffsetForContent(); // Constant part of right offset. |
logicalLeftOffset = logicalLeftOffsetForContent(); // Constant part of left offset. |
- floatLogicalWidth = min(logicalWidthForFloat(floatingObject), logicalRightOffset - logicalLeftOffset); |
+ floatLogicalWidth = std::min(logicalWidthForFloat(floatingObject), logicalRightOffset - logicalLeftOffset); |
} |
} |
// Use the original width of the float here, since the local variable |
@@ -2244,7 +2242,7 @@ void RenderBlockFlow::removeFloatingObject(RenderBox* floatBox) |
// Special-case zero- and less-than-zero-height floats: those don't touch |
// the line that they're on, but it still needs to be dirtied. This is |
// accomplished by pretending they have a height of 1. |
- logicalBottom = max(logicalBottom, logicalTop + 1); |
+ logicalBottom = std::max(logicalBottom, logicalTop + 1); |
} |
if (floatingObject->originatingLine()) { |
if (!selfNeedsLayout()) { |
@@ -2310,7 +2308,7 @@ bool RenderBlockFlow::positionNewFloats() |
// The float cannot start above the top position of the last positioned float. |
if (lastPlacedFloatingObject) |
- logicalTop = max(logicalTopForFloat(lastPlacedFloatingObject), logicalTop); |
+ logicalTop = std::max(logicalTopForFloat(lastPlacedFloatingObject), logicalTop); |
FloatingObjectSetIterator end = floatingObjectSet.end(); |
// Now walk through the set of unpositioned floats and place them. |
@@ -2330,9 +2328,9 @@ bool RenderBlockFlow::positionNewFloats() |
LayoutRect oldRect = childBox->frameRect(); |
if (childBox->style()->clear() & CLEFT) |
- logicalTop = max(lowestFloatLogicalBottom(FloatingObject::FloatLeft), logicalTop); |
+ logicalTop = std::max(lowestFloatLogicalBottom(FloatingObject::FloatLeft), logicalTop); |
if (childBox->style()->clear() & CRIGHT) |
- logicalTop = max(lowestFloatLogicalBottom(FloatingObject::FloatRight), logicalTop); |
+ logicalTop = std::max(lowestFloatLogicalBottom(FloatingObject::FloatRight), logicalTop); |
LayoutPoint floatLogicalLocation = computeLogicalLocationForFloat(floatingObject, logicalTop); |
@@ -2461,7 +2459,7 @@ void RenderBlockFlow::addOverhangingFloats(RenderBlockFlow* child, bool makeChil |
FloatingObjectSetIterator childEnd = child->m_floatingObjects->set().end(); |
for (FloatingObjectSetIterator childIt = child->m_floatingObjects->set().begin(); childIt != childEnd; ++childIt) { |
FloatingObject* floatingObject = childIt->get(); |
- LayoutUnit logicalBottomForFloat = min(this->logicalBottomForFloat(floatingObject), LayoutUnit::max() - childLogicalTop); |
+ LayoutUnit logicalBottomForFloat = std::min(this->logicalBottomForFloat(floatingObject), LayoutUnit::max() - childLogicalTop); |
LayoutUnit logicalBottom = childLogicalTop + logicalBottomForFloat; |
if (logicalBottom > logicalHeight()) { |
@@ -2530,7 +2528,7 @@ LayoutUnit RenderBlockFlow::nextFloatLogicalBottomBelow(LayoutUnit logicalHeight |
floatLogicalBottom = shapeLogicalBottom; |
} |
if (floatLogicalBottom > logicalHeight) |
- logicalBottom = logicalBottom ? min(floatLogicalBottom, logicalBottom) : floatLogicalBottom; |
+ logicalBottom = logicalBottom ? std::min(floatLogicalBottom, logicalBottom) : floatLogicalBottom; |
} |
return logicalBottom; |
@@ -2577,8 +2575,8 @@ void RenderBlockFlow::adjustForBorderFit(LayoutUnit x, LayoutUnit& left, LayoutU |
if (floatingObject->shouldPaint()) { |
LayoutUnit floatLeft = xPositionForFloatIncludingMargin(floatingObject) - floatingObject->renderer()->x(); |
LayoutUnit floatRight = floatLeft + floatingObject->renderer()->width(); |
- left = min(left, floatLeft); |
- right = max(right, floatRight); |
+ left = std::min(left, floatLeft); |
+ right = std::max(right, floatRight); |
} |
} |
} |