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

Unified Diff: Source/core/layout/style/BasicShapes.cpp

Issue 923533004: [CSS Shapes] Normalize distances to closest/farthest side (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Abbreviate delta calculations Created 5 years, 10 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 | « LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-center-coord-positioning-crash-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..94a6b2ad8c0f3e62923eafd75277b97c642b0c36 100644
--- a/Source/core/layout/style/BasicShapes.cpp
+++ b/Source/core/layout/style/BasicShapes.cpp
@@ -80,11 +80,13 @@ float BasicShapeCircle::floatValueForRadiusInBox(FloatSize boxSize) const
FloatPoint center = floatPointForCenterCoordinate(m_centerX, m_centerY, boxSize);
+ float widthDelta = std::abs(boxSize.width() - center.x());
+ float heightDelta = std::abs(boxSize.height() - center.y());
Bem Jones-Bey (adobe) 2015/02/19 23:06:29 I don't seem to me that these variables make anyth
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 +128,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);
leviw_travelin_and_unemployed 2015/02/19 22:56:53 Same applies here?
ASSERT(radius.type() == BasicShapeRadius::FarthestSide);
- return std::max(center, boxWidthOrHeight - center);
+ return std::max(center, boxWidthOrHeight > center ? boxWidthOrHeight - center : center - boxWidthOrHeight);
leviw_travelin_and_unemployed 2015/02/19 22:56:53 Ditto?
}
void BasicShapeEllipse::path(Path& path, const FloatRect& boundingBox)
« no previous file with comments | « LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-center-coord-positioning-crash-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698