Index: Source/core/css/BasicShapeFunctions.cpp |
diff --git a/Source/core/css/BasicShapeFunctions.cpp b/Source/core/css/BasicShapeFunctions.cpp |
index e6bdc103bc85e17a16d0acd89ec8e120f1bb5d2a..b2e5f4fdb46727b78246620d7016d6f96b5677cb 100644 |
--- a/Source/core/css/BasicShapeFunctions.cpp |
+++ b/Source/core/css/BasicShapeFunctions.cpp |
@@ -356,4 +356,37 @@ PassRefPtr<BasicShape> basicShapeForValue(const StyleResolverState& state, const |
return basicShape.release(); |
} |
+ |
+FloatPoint floatPointForCenterCoordinate(const BasicShapeCenterCoordinate& centerX, const BasicShapeCenterCoordinate& centerY, FloatSize boxSize) |
+{ |
+ FloatPoint p; |
+ float offset = floatValueForLength(centerX.length(), boxSize.width()); |
+ switch (centerX.keyword()) { |
leviw_travelin_and_unemployed
2014/01/08 23:07:43
I guess what I was imagining was this single acces
|
+ case BasicShapeCenterCoordinate::None: |
+ case BasicShapeCenterCoordinate::Left: |
+ p.setX(offset); |
+ break; |
+ case BasicShapeCenterCoordinate::Right: |
+ p.setX(boxSize.width() - offset); |
+ break; |
+ default: |
+ ASSERT_NOT_REACHED(); |
+ } |
+ |
+ offset = floatValueForLength(centerY.length(), boxSize.height()); |
+ switch (centerY.keyword()) { |
+ case BasicShapeCenterCoordinate::None: |
+ case BasicShapeCenterCoordinate::Top: |
+ p.setY(offset); |
+ break; |
+ case BasicShapeCenterCoordinate::Bottom: |
+ p.setY(boxSize.height() - offset); |
+ break; |
+ default: |
+ ASSERT_NOT_REACHED(); |
+ } |
+ |
+ return p; |
+} |
+ |
} |