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

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: Use FloatSize/FloatPoint's more Created 6 years, 11 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 | « Source/core/css/BasicShapeFunctions.h ('k') | Source/core/rendering/shapes/Shape.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
+}
+
}
« no previous file with comments | « Source/core/css/BasicShapeFunctions.h ('k') | Source/core/rendering/shapes/Shape.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698