Index: Source/core/rendering/InlineFlowBox.cpp |
diff --git a/Source/core/rendering/InlineFlowBox.cpp b/Source/core/rendering/InlineFlowBox.cpp |
index ad2a883b9a7a45db8baded3f6d613bb74ac83c70..5346e4b526a642458a36c42413e9aa5d1a01d4ca 100644 |
--- a/Source/core/rendering/InlineFlowBox.cpp |
+++ b/Source/core/rendering/InlineFlowBox.cpp |
@@ -38,8 +38,6 @@ |
#include <math.h> |
-using namespace std; |
- |
namespace WebCore { |
struct SameSizeAsInlineFlowBox : public InlineBox { |
@@ -389,10 +387,10 @@ float InlineFlowBox::placeBoxRangeInInlineDirection(InlineBox* firstChild, Inlin |
} |
text->setLogicalLeft(logicalLeft); |
if (knownToHaveNoOverflow()) |
- minLogicalLeft = min(logicalLeft, minLogicalLeft); |
+ minLogicalLeft = std::min(logicalLeft, minLogicalLeft); |
logicalLeft += text->logicalWidth(); |
if (knownToHaveNoOverflow()) |
- maxLogicalRight = max(logicalLeft, maxLogicalRight); |
+ maxLogicalRight = std::max(logicalLeft, maxLogicalRight); |
} else { |
if (curr->renderer().isOutOfFlowPositioned()) { |
if (curr->renderer().parent()->style()->isLeftToRightDirection()) { |
@@ -409,10 +407,10 @@ float InlineFlowBox::placeBoxRangeInInlineDirection(InlineBox* firstChild, Inlin |
InlineFlowBox* flow = toInlineFlowBox(curr); |
logicalLeft += flow->marginLogicalLeft(); |
if (knownToHaveNoOverflow()) |
- minLogicalLeft = min(logicalLeft, minLogicalLeft); |
+ minLogicalLeft = std::min(logicalLeft, minLogicalLeft); |
logicalLeft = flow->placeBoxesInInlineDirection(logicalLeft, needsWordSpacing, textBoxDataMap); |
if (knownToHaveNoOverflow()) |
- maxLogicalRight = max(logicalLeft, maxLogicalRight); |
+ maxLogicalRight = std::max(logicalLeft, maxLogicalRight); |
logicalLeft += flow->marginLogicalRight(); |
} else if (!curr->renderer().isListMarker() || toRenderListMarker(curr->renderer()).isInside()) { |
// The box can have a different writing-mode than the overall line, so this is a bit complicated. |
@@ -423,10 +421,10 @@ float InlineFlowBox::placeBoxRangeInInlineDirection(InlineBox* firstChild, Inlin |
logicalLeft += logicalLeftMargin; |
curr->setLogicalLeft(logicalLeft); |
if (knownToHaveNoOverflow()) |
- minLogicalLeft = min(logicalLeft, minLogicalLeft); |
+ minLogicalLeft = std::min(logicalLeft, minLogicalLeft); |
logicalLeft += curr->logicalWidth(); |
if (knownToHaveNoOverflow()) |
- maxLogicalRight = max(logicalLeft, maxLogicalRight); |
+ maxLogicalRight = std::max(logicalLeft, maxLogicalRight); |
logicalLeft += logicalRightMargin; |
// If we encounter any space after this inline block then ensure it is treated as the space between two words. |
needsWordSpacing = true; |
@@ -492,7 +490,7 @@ void InlineFlowBox::adjustMaxAscentAndDescent(int& maxAscent, int& maxDescent, i |
maxAscent = lineHeight - maxDescent; |
} |
- if (maxAscent + maxDescent >= max(maxPositionTop, maxPositionBottom)) |
+ if (maxAscent + maxDescent >= std::max(maxPositionTop, maxPositionBottom)) |
break; |
} |
@@ -697,14 +695,14 @@ void InlineFlowBox::placeBoxesInBlockDirection(LayoutUnit top, LayoutUnit maxHei |
if (!setLineTop) { |
setLineTop = true; |
lineTop = newLogicalTop; |
- lineTopIncludingMargins = min(lineTop, newLogicalTopIncludingMargins); |
+ lineTopIncludingMargins = std::min(lineTop, newLogicalTopIncludingMargins); |
} else { |
- lineTop = min(lineTop, newLogicalTop); |
- lineTopIncludingMargins = min(lineTop, min(lineTopIncludingMargins, newLogicalTopIncludingMargins)); |
+ lineTop = std::min(lineTop, newLogicalTop); |
+ lineTopIncludingMargins = std::min(lineTop, std::min(lineTopIncludingMargins, newLogicalTopIncludingMargins)); |
} |
- selectionBottom = max(selectionBottom, newLogicalTop + boxHeight - borderPaddingHeight); |
- lineBottom = max(lineBottom, newLogicalTop + boxHeight); |
- lineBottomIncludingMargins = max(lineBottom, max(lineBottomIncludingMargins, newLogicalTopIncludingMargins + boxHeightIncludingMargins)); |
+ selectionBottom = std::max(selectionBottom, newLogicalTop + boxHeight - borderPaddingHeight); |
+ lineBottom = std::max(lineBottom, newLogicalTop + boxHeight); |
+ lineBottomIncludingMargins = std::max(lineBottom, std::max(lineBottomIncludingMargins, newLogicalTopIncludingMargins + boxHeightIncludingMargins)); |
} |
// Adjust boxes to use their real box y/height and not the logical height (as dictated by |
@@ -721,12 +719,12 @@ void InlineFlowBox::placeBoxesInBlockDirection(LayoutUnit top, LayoutUnit maxHei |
lineTop = pixelSnappedLogicalTop(); |
lineTopIncludingMargins = lineTop; |
} else { |
- lineTop = min<LayoutUnit>(lineTop, pixelSnappedLogicalTop()); |
- lineTopIncludingMargins = min(lineTop, lineTopIncludingMargins); |
+ lineTop = std::min<LayoutUnit>(lineTop, pixelSnappedLogicalTop()); |
+ lineTopIncludingMargins = std::min(lineTop, lineTopIncludingMargins); |
} |
- selectionBottom = max<LayoutUnit>(selectionBottom, pixelSnappedLogicalBottom()); |
- lineBottom = max<LayoutUnit>(lineBottom, pixelSnappedLogicalBottom()); |
- lineBottomIncludingMargins = max(lineBottom, lineBottomIncludingMargins); |
+ selectionBottom = std::max<LayoutUnit>(selectionBottom, pixelSnappedLogicalBottom()); |
+ lineBottom = std::max<LayoutUnit>(lineBottom, pixelSnappedLogicalBottom()); |
+ lineBottomIncludingMargins = std::max(lineBottom, lineBottomIncludingMargins); |
} |
if (renderer().style()->isFlippedLinesWritingMode()) |
@@ -743,11 +741,11 @@ void InlineFlowBox::computeMaxLogicalTop(float& maxLogicalTop) const |
if (descendantsHaveSameLineHeightAndBaseline()) |
continue; |
- maxLogicalTop = max<float>(maxLogicalTop, curr->y()); |
+ maxLogicalTop = std::max<float>(maxLogicalTop, curr->y()); |
float localMaxLogicalTop = 0; |
if (curr->isInlineFlowBox()) |
toInlineFlowBox(curr)->computeMaxLogicalTop(localMaxLogicalTop); |
- maxLogicalTop = max<float>(maxLogicalTop, localMaxLogicalTop); |
+ maxLogicalTop = std::max<float>(maxLogicalTop, localMaxLogicalTop); |
} |
} |
@@ -786,15 +784,15 @@ inline void InlineFlowBox::addBoxShadowVisualOverflow(LayoutRect& logicalVisualO |
LayoutUnit shadowLogicalTop = style->isFlippedLinesWritingMode() ? -boxShadowLogicalBottom : boxShadowLogicalTop; |
LayoutUnit shadowLogicalBottom = style->isFlippedLinesWritingMode() ? -boxShadowLogicalTop : boxShadowLogicalBottom; |
- LayoutUnit logicalTopVisualOverflow = min(pixelSnappedLogicalTop() + shadowLogicalTop, logicalVisualOverflow.y()); |
- LayoutUnit logicalBottomVisualOverflow = max(pixelSnappedLogicalBottom() + shadowLogicalBottom, logicalVisualOverflow.maxY()); |
+ LayoutUnit logicalTopVisualOverflow = std::min(pixelSnappedLogicalTop() + shadowLogicalTop, logicalVisualOverflow.y()); |
+ LayoutUnit logicalBottomVisualOverflow = std::max(pixelSnappedLogicalBottom() + shadowLogicalBottom, logicalVisualOverflow.maxY()); |
LayoutUnit boxShadowLogicalLeft; |
LayoutUnit boxShadowLogicalRight; |
style->getBoxShadowInlineDirectionExtent(boxShadowLogicalLeft, boxShadowLogicalRight); |
- LayoutUnit logicalLeftVisualOverflow = min(pixelSnappedLogicalLeft() + boxShadowLogicalLeft, logicalVisualOverflow.x()); |
- LayoutUnit logicalRightVisualOverflow = max(pixelSnappedLogicalRight() + boxShadowLogicalRight, logicalVisualOverflow.maxX()); |
+ LayoutUnit logicalLeftVisualOverflow = std::min(pixelSnappedLogicalLeft() + boxShadowLogicalLeft, logicalVisualOverflow.x()); |
+ LayoutUnit logicalRightVisualOverflow = std::max(pixelSnappedLogicalRight() + boxShadowLogicalRight, logicalVisualOverflow.maxX()); |
logicalVisualOverflow = LayoutRect(logicalLeftVisualOverflow, logicalTopVisualOverflow, |
logicalRightVisualOverflow - logicalLeftVisualOverflow, logicalBottomVisualOverflow - logicalTopVisualOverflow); |
@@ -822,14 +820,14 @@ inline void InlineFlowBox::addBorderOutsetVisualOverflow(LayoutRect& logicalVisu |
LayoutUnit outsetLogicalTop = style->isFlippedLinesWritingMode() ? borderOutsetLogicalBottom : borderOutsetLogicalTop; |
LayoutUnit outsetLogicalBottom = style->isFlippedLinesWritingMode() ? borderOutsetLogicalTop : borderOutsetLogicalBottom; |
- LayoutUnit logicalTopVisualOverflow = min(pixelSnappedLogicalTop() - outsetLogicalTop, logicalVisualOverflow.y()); |
- LayoutUnit logicalBottomVisualOverflow = max(pixelSnappedLogicalBottom() + outsetLogicalBottom, logicalVisualOverflow.maxY()); |
+ LayoutUnit logicalTopVisualOverflow = std::min(pixelSnappedLogicalTop() - outsetLogicalTop, logicalVisualOverflow.y()); |
+ LayoutUnit logicalBottomVisualOverflow = std::max(pixelSnappedLogicalBottom() + outsetLogicalBottom, logicalVisualOverflow.maxY()); |
LayoutUnit outsetLogicalLeft = includeLogicalLeftEdge() ? borderOutsetLogicalLeft : LayoutUnit(); |
LayoutUnit outsetLogicalRight = includeLogicalRightEdge() ? borderOutsetLogicalRight : LayoutUnit(); |
- LayoutUnit logicalLeftVisualOverflow = min(pixelSnappedLogicalLeft() - outsetLogicalLeft, logicalVisualOverflow.x()); |
- LayoutUnit logicalRightVisualOverflow = max(pixelSnappedLogicalRight() + outsetLogicalRight, logicalVisualOverflow.maxX()); |
+ LayoutUnit logicalLeftVisualOverflow = std::min(pixelSnappedLogicalLeft() - outsetLogicalLeft, logicalVisualOverflow.x()); |
+ LayoutUnit logicalRightVisualOverflow = std::max(pixelSnappedLogicalRight() + outsetLogicalRight, logicalVisualOverflow.maxX()); |
logicalVisualOverflow = LayoutRect(logicalLeftVisualOverflow, logicalTopVisualOverflow, |
logicalRightVisualOverflow - logicalLeftVisualOverflow, logicalBottomVisualOverflow - logicalTopVisualOverflow); |
@@ -874,33 +872,33 @@ inline void InlineFlowBox::addTextBoxVisualOverflow(InlineTextBox* textBox, Glyp |
if (style->textEmphasisMark() != TextEmphasisMarkNone && textBox->getEmphasisMarkPosition(style, emphasisMarkPosition)) { |
int emphasisMarkHeight = style->font().emphasisMarkHeight(style->textEmphasisMarkString()); |
if ((emphasisMarkPosition == TextEmphasisPositionOver) == (!style->isFlippedLinesWritingMode())) |
- topGlyphOverflow = min(topGlyphOverflow, -emphasisMarkHeight); |
+ topGlyphOverflow = std::min(topGlyphOverflow, -emphasisMarkHeight); |
else |
- bottomGlyphOverflow = max(bottomGlyphOverflow, emphasisMarkHeight); |
+ bottomGlyphOverflow = std::max(bottomGlyphOverflow, emphasisMarkHeight); |
} |
// If letter-spacing is negative, we should factor that into right layout overflow. (Even in RTL, letter-spacing is |
// applied to the right, so this is not an issue with left overflow. |
- rightGlyphOverflow -= min(0, (int)style->font().fontDescription().letterSpacing()); |
+ rightGlyphOverflow -= std::min(0, (int)style->font().fontDescription().letterSpacing()); |
LayoutUnit textShadowLogicalTop; |
LayoutUnit textShadowLogicalBottom; |
style->getTextShadowBlockDirectionExtent(textShadowLogicalTop, textShadowLogicalBottom); |
- LayoutUnit childOverflowLogicalTop = min<LayoutUnit>(textShadowLogicalTop + topGlyphOverflow, topGlyphOverflow); |
- LayoutUnit childOverflowLogicalBottom = max<LayoutUnit>(textShadowLogicalBottom + bottomGlyphOverflow, bottomGlyphOverflow); |
+ LayoutUnit childOverflowLogicalTop = std::min<LayoutUnit>(textShadowLogicalTop + topGlyphOverflow, topGlyphOverflow); |
+ LayoutUnit childOverflowLogicalBottom = std::max<LayoutUnit>(textShadowLogicalBottom + bottomGlyphOverflow, bottomGlyphOverflow); |
LayoutUnit textShadowLogicalLeft; |
LayoutUnit textShadowLogicalRight; |
style->getTextShadowInlineDirectionExtent(textShadowLogicalLeft, textShadowLogicalRight); |
- LayoutUnit childOverflowLogicalLeft = min<LayoutUnit>(textShadowLogicalLeft + leftGlyphOverflow, leftGlyphOverflow); |
- LayoutUnit childOverflowLogicalRight = max<LayoutUnit>(textShadowLogicalRight + rightGlyphOverflow, rightGlyphOverflow); |
+ LayoutUnit childOverflowLogicalLeft = std::min<LayoutUnit>(textShadowLogicalLeft + leftGlyphOverflow, leftGlyphOverflow); |
+ LayoutUnit childOverflowLogicalRight = std::max<LayoutUnit>(textShadowLogicalRight + rightGlyphOverflow, rightGlyphOverflow); |
- LayoutUnit logicalTopVisualOverflow = min(textBox->pixelSnappedLogicalTop() + childOverflowLogicalTop, logicalVisualOverflow.y()); |
- LayoutUnit logicalBottomVisualOverflow = max(textBox->pixelSnappedLogicalBottom() + childOverflowLogicalBottom, logicalVisualOverflow.maxY()); |
- LayoutUnit logicalLeftVisualOverflow = min(textBox->pixelSnappedLogicalLeft() + childOverflowLogicalLeft, logicalVisualOverflow.x()); |
- LayoutUnit logicalRightVisualOverflow = max(textBox->pixelSnappedLogicalRight() + childOverflowLogicalRight, logicalVisualOverflow.maxX()); |
+ LayoutUnit logicalTopVisualOverflow = std::min(textBox->pixelSnappedLogicalTop() + childOverflowLogicalTop, logicalVisualOverflow.y()); |
+ LayoutUnit logicalBottomVisualOverflow = std::max(textBox->pixelSnappedLogicalBottom() + childOverflowLogicalBottom, logicalVisualOverflow.maxY()); |
+ LayoutUnit logicalLeftVisualOverflow = std::min(textBox->pixelSnappedLogicalLeft() + childOverflowLogicalLeft, logicalVisualOverflow.x()); |
+ LayoutUnit logicalRightVisualOverflow = std::max(textBox->pixelSnappedLogicalRight() + childOverflowLogicalRight, logicalVisualOverflow.maxX()); |
logicalVisualOverflow = LayoutRect(logicalLeftVisualOverflow, logicalTopVisualOverflow, |
logicalRightVisualOverflow - logicalLeftVisualOverflow, logicalBottomVisualOverflow - logicalTopVisualOverflow); |
@@ -1069,8 +1067,8 @@ bool InlineFlowBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& re |
RootInlineBox& rootBox = root(); |
LayoutUnit& top = isHorizontal() ? minY : minX; |
LayoutUnit& logicalHeight = isHorizontal() ? height : width; |
- LayoutUnit bottom = min(rootBox.lineBottom(), top + logicalHeight); |
- top = max(rootBox.lineTop(), top); |
+ LayoutUnit bottom = std::min(rootBox.lineBottom(), top + logicalHeight); |
+ top = std::max(rootBox.lineTop(), top); |
logicalHeight = bottom - top; |
} |
@@ -1236,8 +1234,8 @@ void InlineFlowBox::constrainToLineTopAndBottomIfNeeded(LayoutRect& rect) const |
const RootInlineBox& rootBox = root(); |
LayoutUnit logicalTop = isHorizontal() ? rect.y() : rect.x(); |
LayoutUnit logicalHeight = isHorizontal() ? rect.height() : rect.width(); |
- LayoutUnit bottom = min(rootBox.lineBottom(), logicalTop + logicalHeight); |
- logicalTop = max(rootBox.lineTop(), logicalTop); |
+ LayoutUnit bottom = std::min(rootBox.lineBottom(), logicalTop + logicalHeight); |
+ logicalTop = std::max(rootBox.lineTop(), logicalTop); |
logicalHeight = bottom - logicalTop; |
if (isHorizontal()) { |
rect.setY(logicalTop); |
@@ -1495,7 +1493,7 @@ LayoutUnit InlineFlowBox::computeOverAnnotationAdjustment(LayoutUnit allowedPosi |
continue; // Positioned placeholders don't affect calculations. |
if (curr->isInlineFlowBox()) |
- result = max(result, toInlineFlowBox(curr)->computeOverAnnotationAdjustment(allowedPosition)); |
+ result = std::max(result, toInlineFlowBox(curr)->computeOverAnnotationAdjustment(allowedPosition)); |
if (curr->renderer().isReplaced() && curr->renderer().isRubyRun() && curr->renderer().style()->rubyPosition() == RubyPositionBefore) { |
RenderRubyRun& rubyRun = toRenderRubyRun(curr->renderer()); |
@@ -1508,13 +1506,13 @@ LayoutUnit InlineFlowBox::computeOverAnnotationAdjustment(LayoutUnit allowedPosi |
if (topOfFirstRubyTextLine >= 0) |
continue; |
topOfFirstRubyTextLine += curr->logicalTop(); |
- result = max(result, allowedPosition - topOfFirstRubyTextLine); |
+ result = std::max(result, allowedPosition - topOfFirstRubyTextLine); |
} else { |
LayoutUnit bottomOfLastRubyTextLine = rubyText->logicalTop() + (rubyText->lastRootBox() ? rubyText->lastRootBox()->lineBottom() : rubyText->logicalHeight()); |
if (bottomOfLastRubyTextLine <= curr->logicalHeight()) |
continue; |
bottomOfLastRubyTextLine += curr->logicalTop(); |
- result = max(result, bottomOfLastRubyTextLine - allowedPosition); |
+ result = std::max(result, bottomOfLastRubyTextLine - allowedPosition); |
} |
} |
@@ -1524,10 +1522,10 @@ LayoutUnit InlineFlowBox::computeOverAnnotationAdjustment(LayoutUnit allowedPosi |
if (style->textEmphasisMark() != TextEmphasisMarkNone && toInlineTextBox(curr)->getEmphasisMarkPosition(style, emphasisMarkPosition) && emphasisMarkPosition == TextEmphasisPositionOver) { |
if (!style->isFlippedLinesWritingMode()) { |
int topOfEmphasisMark = curr->logicalTop() - style->font().emphasisMarkHeight(style->textEmphasisMarkString()); |
- result = max(result, allowedPosition - topOfEmphasisMark); |
+ result = std::max(result, allowedPosition - topOfEmphasisMark); |
} else { |
int bottomOfEmphasisMark = curr->logicalBottom() + style->font().emphasisMarkHeight(style->textEmphasisMarkString()); |
- result = max(result, bottomOfEmphasisMark - allowedPosition); |
+ result = std::max(result, bottomOfEmphasisMark - allowedPosition); |
} |
} |
} |
@@ -1543,7 +1541,7 @@ LayoutUnit InlineFlowBox::computeUnderAnnotationAdjustment(LayoutUnit allowedPos |
continue; // Positioned placeholders don't affect calculations. |
if (curr->isInlineFlowBox()) |
- result = max(result, toInlineFlowBox(curr)->computeUnderAnnotationAdjustment(allowedPosition)); |
+ result = std::max(result, toInlineFlowBox(curr)->computeUnderAnnotationAdjustment(allowedPosition)); |
if (curr->renderer().isReplaced() && curr->renderer().isRubyRun() && curr->renderer().style()->rubyPosition() == RubyPositionAfter) { |
RenderRubyRun& rubyRun = toRenderRubyRun(curr->renderer()); |
@@ -1556,13 +1554,13 @@ LayoutUnit InlineFlowBox::computeUnderAnnotationAdjustment(LayoutUnit allowedPos |
if (topOfFirstRubyTextLine >= 0) |
continue; |
topOfFirstRubyTextLine += curr->logicalTop(); |
- result = max(result, allowedPosition - topOfFirstRubyTextLine); |
+ result = std::max(result, allowedPosition - topOfFirstRubyTextLine); |
} else { |
LayoutUnit bottomOfLastRubyTextLine = rubyText->logicalTop() + (rubyText->lastRootBox() ? rubyText->lastRootBox()->lineBottom() : rubyText->logicalHeight()); |
if (bottomOfLastRubyTextLine <= curr->logicalHeight()) |
continue; |
bottomOfLastRubyTextLine += curr->logicalTop(); |
- result = max(result, bottomOfLastRubyTextLine - allowedPosition); |
+ result = std::max(result, bottomOfLastRubyTextLine - allowedPosition); |
} |
} |
@@ -1571,10 +1569,10 @@ LayoutUnit InlineFlowBox::computeUnderAnnotationAdjustment(LayoutUnit allowedPos |
if (style->textEmphasisMark() != TextEmphasisMarkNone && style->textEmphasisPosition() == TextEmphasisPositionUnder) { |
if (!style->isFlippedLinesWritingMode()) { |
LayoutUnit bottomOfEmphasisMark = curr->logicalBottom() + style->font().emphasisMarkHeight(style->textEmphasisMarkString()); |
- result = max(result, bottomOfEmphasisMark - allowedPosition); |
+ result = std::max(result, bottomOfEmphasisMark - allowedPosition); |
} else { |
LayoutUnit topOfEmphasisMark = curr->logicalTop() - style->font().emphasisMarkHeight(style->textEmphasisMarkString()); |
- result = max(result, allowedPosition - topOfEmphasisMark); |
+ result = std::max(result, allowedPosition - topOfEmphasisMark); |
} |
} |
} |
@@ -1593,8 +1591,8 @@ void InlineFlowBox::collectLeafBoxesInLogicalOrder(Vector<InlineBox*>& leafBoxes |
// First find highest and lowest levels, and initialize leafBoxesInLogicalOrder with the leaf boxes in visual order. |
for (; leaf; leaf = leaf->nextLeafChild()) { |
- minLevel = min(minLevel, leaf->bidiLevel()); |
- maxLevel = max(maxLevel, leaf->bidiLevel()); |
+ minLevel = std::min(minLevel, leaf->bidiLevel()); |
+ maxLevel = std::max(maxLevel, leaf->bidiLevel()); |
leafBoxesInLogicalOrder.append(leaf); |
} |