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

Unified Diff: Source/core/css/BasicShapeFunctions.cpp

Issue 115253003: Layout support for new circle shape syntax (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Update virtual/legacy-animations-engine/animations/interpolation/shape-outside-expected.txt Created 7 years 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
Index: Source/core/css/BasicShapeFunctions.cpp
diff --git a/Source/core/css/BasicShapeFunctions.cpp b/Source/core/css/BasicShapeFunctions.cpp
index 8f948ae8eeb4d49654c17aadd78c4d88f106699e..86cd92ea9e189827cdf850bcada7c3b82feb719f 100644
--- a/Source/core/css/BasicShapeFunctions.cpp
+++ b/Source/core/css/BasicShapeFunctions.cpp
@@ -321,4 +321,23 @@ PassRefPtr<BasicShape> basicShapeForValue(const StyleResolverState& state, const
return basicShape.release();
}
+
+float floatValueForCenterCoordinate(const BasicShapeCenterCoordinate& center, float boxDimension)
+{
+ float offset = floatValueForLength(center.length(), boxDimension);
+ switch (center.keyword()) {
+ case BasicShapeCenterCoordinate::None:
+ return offset;
+ case BasicShapeCenterCoordinate::Top:
+ case BasicShapeCenterCoordinate::Left:
+ return offset;
+ case BasicShapeCenterCoordinate::Bottom:
+ case BasicShapeCenterCoordinate::Right:
+ return boxDimension - offset;
+ }
+
+ ASSERT_NOT_REACHED();
+ return 0;
+}
+
}

Powered by Google App Engine
This is Rietveld 408576698