Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1386)

Unified Diff: Source/core/rendering/RenderBoxModelObject.cpp

Issue 339333002: Removing using declarations that import names in the C++ Standard library. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixing mac error Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/rendering/RenderBox.cpp ('k') | Source/core/rendering/RenderDeprecatedFlexibleBox.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderBoxModelObject.cpp
diff --git a/Source/core/rendering/RenderBoxModelObject.cpp b/Source/core/rendering/RenderBoxModelObject.cpp
index 5e56efce625238c29b1d3b972f33cf1c3d6d31a4..841d94f5d8d45e56fdb3652567f1880f2d9965df 100644
--- a/Source/core/rendering/RenderBoxModelObject.cpp
+++ b/Source/core/rendering/RenderBoxModelObject.cpp
@@ -47,8 +47,6 @@
#include "platform/graphics/Path.h"
#include "wtf/CurrentTime.h"
-using namespace std;
-
namespace WebCore {
using namespace HTMLNames;
@@ -926,8 +924,8 @@ IntSize RenderBoxModelObject::calculateFillTileSize(const FillLayer* fillLayer,
? static_cast<float>(positioningAreaSize.width()) / imageIntrinsicSize.width() : 1;
float verticalScaleFactor = imageIntrinsicSize.height()
? static_cast<float>(positioningAreaSize.height()) / imageIntrinsicSize.height() : 1;
- float scaleFactor = type == Contain ? min(horizontalScaleFactor, verticalScaleFactor) : max(horizontalScaleFactor, verticalScaleFactor);
- return IntSize(max(1l, lround(imageIntrinsicSize.width() * scaleFactor)), max(1l, lround(imageIntrinsicSize.height() * scaleFactor)));
+ float scaleFactor = type == Contain ? std::min(horizontalScaleFactor, verticalScaleFactor) : std::max(horizontalScaleFactor, verticalScaleFactor);
+ return IntSize(std::max(1l, lround(imageIntrinsicSize.width() * scaleFactor)), std::max(1l, lround(imageIntrinsicSize.height() * scaleFactor)));
}
}
@@ -937,21 +935,21 @@ IntSize RenderBoxModelObject::calculateFillTileSize(const FillLayer* fillLayer,
void RenderBoxModelObject::BackgroundImageGeometry::setNoRepeatX(int xOffset)
{
- m_destRect.move(max(xOffset, 0), 0);
- m_phase.setX(-min(xOffset, 0));
- m_destRect.setWidth(m_tileSize.width() + min(xOffset, 0));
+ m_destRect.move(std::max(xOffset, 0), 0);
+ m_phase.setX(-std::min(xOffset, 0));
+ m_destRect.setWidth(m_tileSize.width() + std::min(xOffset, 0));
}
void RenderBoxModelObject::BackgroundImageGeometry::setNoRepeatY(int yOffset)
{
- m_destRect.move(0, max(yOffset, 0));
- m_phase.setY(-min(yOffset, 0));
- m_destRect.setHeight(m_tileSize.height() + min(yOffset, 0));
+ m_destRect.move(0, std::max(yOffset, 0));
+ m_phase.setY(-std::min(yOffset, 0));
+ m_destRect.setHeight(m_tileSize.height() + std::min(yOffset, 0));
}
void RenderBoxModelObject::BackgroundImageGeometry::useFixedAttachment(const IntPoint& attachmentPoint)
{
IntPoint alignedPoint = attachmentPoint;
- m_phase.move(max(alignedPoint.x() - m_destRect.x(), 0), max(alignedPoint.y() - m_destRect.y(), 0));
+ m_phase.move(std::max(alignedPoint.x() - m_destRect.x(), 0), std::max(alignedPoint.y() - m_destRect.y(), 0));
}
void RenderBoxModelObject::BackgroundImageGeometry::clip(const IntRect& clipRect)
@@ -1073,7 +1071,7 @@ void RenderBoxModelObject::calculateBackgroundImageGeometry(const RenderLayerMod
LayoutUnit computedXPosition = roundedMinimumValueForLength(fillLayer->xPosition(), availableWidth);
if (backgroundRepeatX == RoundFill && positioningAreaSize.width() > 0 && fillTileSize.width() > 0) {
- long nrTiles = max(1l, lroundf((float)positioningAreaSize.width() / fillTileSize.width()));
+ long nrTiles = std::max(1l, lroundf((float)positioningAreaSize.width() / fillTileSize.width()));
if (fillLayer->size().size.height().isAuto() && backgroundRepeatY != RoundFill) {
fillTileSize.setHeight(fillTileSize.height() * positioningAreaSize.width() / (nrTiles * fillTileSize.width()));
@@ -1087,7 +1085,7 @@ void RenderBoxModelObject::calculateBackgroundImageGeometry(const RenderLayerMod
LayoutUnit computedYPosition = roundedMinimumValueForLength(fillLayer->yPosition(), availableHeight);
if (backgroundRepeatY == RoundFill && positioningAreaSize.height() > 0 && fillTileSize.height() > 0) {
- long nrTiles = max(1l, lroundf((float)positioningAreaSize.height() / fillTileSize.height()));
+ long nrTiles = std::max(1l, lroundf((float)positioningAreaSize.height() / fillTileSize.height()));
if (fillLayer->size().size.width().isAuto() && backgroundRepeatX != RoundFill) {
fillTileSize.setWidth(fillTileSize.width() * positioningAreaSize.height() / (nrTiles * fillTileSize.height()));
@@ -1185,10 +1183,10 @@ bool RenderBoxModelObject::paintNinePieceImage(GraphicsContext* graphicsContext,
int imageHeight = imageSize.height();
float imageScaleFactor = styleImage->imageScaleFactor();
- int topSlice = min<int>(imageHeight, valueForLength(ninePieceImage.imageSlices().top(), imageHeight)) * imageScaleFactor;
- int rightSlice = min<int>(imageWidth, valueForLength(ninePieceImage.imageSlices().right(), imageWidth)) * imageScaleFactor;
- int bottomSlice = min<int>(imageHeight, valueForLength(ninePieceImage.imageSlices().bottom(), imageHeight)) * imageScaleFactor;
- int leftSlice = min<int>(imageWidth, valueForLength(ninePieceImage.imageSlices().left(), imageWidth)) * imageScaleFactor;
+ int topSlice = std::min<int>(imageHeight, valueForLength(ninePieceImage.imageSlices().top(), imageHeight)) * imageScaleFactor;
+ int rightSlice = std::min<int>(imageWidth, valueForLength(ninePieceImage.imageSlices().right(), imageWidth)) * imageScaleFactor;
+ int bottomSlice = std::min<int>(imageHeight, valueForLength(ninePieceImage.imageSlices().bottom(), imageHeight)) * imageScaleFactor;
+ int leftSlice = std::min<int>(imageWidth, valueForLength(ninePieceImage.imageSlices().left(), imageWidth)) * imageScaleFactor;
ENinePieceImageRule hRule = ninePieceImage.horizontalRule();
ENinePieceImageRule vRule = ninePieceImage.verticalRule();
@@ -1202,9 +1200,9 @@ bool RenderBoxModelObject::paintNinePieceImage(GraphicsContext* graphicsContext,
// The spec says: Given Lwidth as the width of the border image area, Lheight as its height, and Wside as the border image width
// offset for the side, let f = min(Lwidth/(Wleft+Wright), Lheight/(Wtop+Wbottom)). If f < 1, then all W are reduced by
// multiplying them by f.
- int borderSideWidth = max(1, leftWidth + rightWidth);
- int borderSideHeight = max(1, topWidth + bottomWidth);
- float borderSideScaleFactor = min((float)borderImageRect.width() / borderSideWidth, (float)borderImageRect.height() / borderSideHeight);
+ int borderSideWidth = std::max(1, leftWidth + rightWidth);
+ int borderSideHeight = std::max(1, topWidth + bottomWidth);
+ float borderSideScaleFactor = std::min((float)borderImageRect.width() / borderSideWidth, (float)borderImageRect.height() / borderSideHeight);
if (borderSideScaleFactor < 1) {
topWidth *= borderSideScaleFactor;
rightWidth *= borderSideScaleFactor;
@@ -1601,7 +1599,7 @@ void RenderBoxModelObject::paintOneBorderSide(GraphicsContext* graphicsContext,
clipBorderSidePolygon(graphicsContext, outerBorder, innerBorder, side, adjacentSide1StylesMatch, adjacentSide2StylesMatch);
else
clipBorderSideForComplexInnerPath(graphicsContext, outerBorder, innerBorder, side, edges);
- float thickness = max(max(edgeToRender.width, adjacentEdge1.width), adjacentEdge2.width);
+ float thickness = std::max(std::max(edgeToRender.width, adjacentEdge1.width), adjacentEdge2.width);
drawBoxSideFromPath(graphicsContext, outerBorder.rect(), *path, edges, edgeToRender.width, thickness, side, style,
colorToPaint, edgeToRender.style, bleedAvoidance, includeLogicalLeftEdge, includeLogicalRightEdge);
} else {
@@ -2301,7 +2299,7 @@ static RoundedRect calculateAdjustedInnerBorder(const RoundedRect&innerBorder, B
}
newRadii.setBottomLeft(IntSize(0, 0));
newRadii.setBottomRight(IntSize(0, 0));
- maxRadii = max(newRadii.topLeft().height(), newRadii.topRight().height());
+ maxRadii = std::max(newRadii.topLeft().height(), newRadii.topRight().height());
if (maxRadii > newRect.height())
newRect.setHeight(maxRadii);
break;
@@ -2316,7 +2314,7 @@ static RoundedRect calculateAdjustedInnerBorder(const RoundedRect&innerBorder, B
}
newRadii.setTopLeft(IntSize(0, 0));
newRadii.setTopRight(IntSize(0, 0));
- maxRadii = max(newRadii.bottomLeft().height(), newRadii.bottomRight().height());
+ maxRadii = std::max(newRadii.bottomLeft().height(), newRadii.bottomRight().height());
if (maxRadii > newRect.height()) {
newRect.move(0, newRect.height() - maxRadii);
newRect.setHeight(maxRadii);
@@ -2333,7 +2331,7 @@ static RoundedRect calculateAdjustedInnerBorder(const RoundedRect&innerBorder, B
}
newRadii.setTopRight(IntSize(0, 0));
newRadii.setBottomRight(IntSize(0, 0));
- maxRadii = max(newRadii.topLeft().width(), newRadii.bottomLeft().width());
+ maxRadii = std::max(newRadii.topLeft().width(), newRadii.bottomLeft().width());
if (maxRadii > newRect.width())
newRect.setWidth(maxRadii);
break;
@@ -2348,7 +2346,7 @@ static RoundedRect calculateAdjustedInnerBorder(const RoundedRect&innerBorder, B
}
newRadii.setTopLeft(IntSize(0, 0));
newRadii.setBottomLeft(IntSize(0, 0));
- maxRadii = max(newRadii.topRight().width(), newRadii.bottomRight().width());
+ maxRadii = std::max(newRadii.topRight().width(), newRadii.bottomRight().width());
if (maxRadii > newRect.width()) {
newRect.move(newRect.width() - maxRadii, 0);
newRect.setWidth(maxRadii);
@@ -2726,7 +2724,7 @@ LayoutRect RenderBoxModelObject::localCaretRectForEmptyElement(LayoutUnit width,
x -= textIndentOffset;
break;
}
- x = min(x, max<LayoutUnit>(maxX - caretWidth, 0));
+ x = std::min(x, std::max<LayoutUnit>(maxX - caretWidth, 0));
LayoutUnit y = paddingTop() + borderTop();
« no previous file with comments | « Source/core/rendering/RenderBox.cpp ('k') | Source/core/rendering/RenderDeprecatedFlexibleBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698