Chromium Code Reviews| Index: Source/core/layout/style/BasicShapes.cpp |
| diff --git a/Source/core/layout/style/BasicShapes.cpp b/Source/core/layout/style/BasicShapes.cpp |
| index 8317bfcc91fe0a829e626eac24e591ce8981552a..fee150e59c6dc0e9eec39a99b5f104270a6897de 100644 |
| --- a/Source/core/layout/style/BasicShapes.cpp |
| +++ b/Source/core/layout/style/BasicShapes.cpp |
| @@ -80,11 +80,20 @@ float BasicShapeCircle::floatValueForRadiusInBox(FloatSize boxSize) const |
| FloatPoint center = floatPointForCenterCoordinate(m_centerX, m_centerY, boxSize); |
| + float widthDelta, heightDelta; |
| + if (center.x() < boxSize.width()) |
| + widthDelta = boxSize.width() - center.x(); |
| + else |
| + widthDelta = center.x() - boxSize.width(); |
| + if (center.y() < boxSize.height()) |
| + heightDelta = boxSize.height() - center.y(); |
| + else |
| + heightDelta = center.y() - boxSize.height(); |
|
leviw_travelin_and_unemployed
2015/02/19 21:59:44
Will heightDelta ever not be the same as std::abs(
|
| if (m_radius.type() == BasicShapeRadius::ClosestSide) |
| - return std::min(std::min(center.x(), boxSize.width() - center.x()), std::min(center.y(), boxSize.height() - center.y())); |
| + return std::min(std::min(std::abs(center.x()), widthDelta), std::min(std::abs(center.y()), heightDelta)); |
| // If radius.type() == BasicShapeRadius::FarthestSide. |
| - return std::max(std::max(center.x(), boxSize.width() - center.x()), std::max(center.y(), boxSize.height() - center.y())); |
| + return std::max(std::max(center.x(), widthDelta), std::max(center.y(), heightDelta)); |
| } |
| void BasicShapeCircle::path(Path& path, const FloatRect& boundingBox) |
| @@ -126,10 +135,10 @@ float BasicShapeEllipse::floatValueForRadiusInBox(const BasicShapeRadius& radius |
| return floatValueForLength(radius.value(), boxWidthOrHeight); |
| if (radius.type() == BasicShapeRadius::ClosestSide) |
| - return std::min(center, boxWidthOrHeight - center); |
| + return std::min(std::abs(center), boxWidthOrHeight > center ? boxWidthOrHeight - center : center - boxWidthOrHeight); |
| ASSERT(radius.type() == BasicShapeRadius::FarthestSide); |
| - return std::max(center, boxWidthOrHeight - center); |
| + return std::max(center, boxWidthOrHeight > center ? boxWidthOrHeight - center : center - boxWidthOrHeight); |
| } |
| void BasicShapeEllipse::path(Path& path, const FloatRect& boundingBox) |