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; |
+} |
+ |
} |