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

Unified Diff: Source/core/css/resolver/StyleBuilderConverter.cpp

Issue 1158603003: CSS Independent Transform Properties (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add combined tests with motion-path and transform Created 5 years, 6 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
Index: Source/core/css/resolver/StyleBuilderConverter.cpp
diff --git a/Source/core/css/resolver/StyleBuilderConverter.cpp b/Source/core/css/resolver/StyleBuilderConverter.cpp
index ce5f709da7bbfb671930d1f24eb580c82ea40550..d138ae2069eaafbfab0f043566375a790b1910b2 100644
--- a/Source/core/css/resolver/StyleBuilderConverter.cpp
+++ b/Source/core/css/resolver/StyleBuilderConverter.cpp
@@ -935,4 +935,51 @@ Vector<LengthPoint> StyleBuilderConverter::convertSnapCoordinates(StyleResolverS
return coordinates;
}
+PassRefPtr<TranslateTransformOperation> StyleBuilderConverter::convertTranslate(StyleResolverState& state, CSSValue* value)
+{
+ CSSValueList* list = toCSSValueList(value);
+ ASSERT(list->length() >= 1 && list->length() <= 3);
+ Length tx = convertLength(state, list->item(0));
+ Length ty(0, Fixed);
+ double tz = 0;
+ if (list->length() >= 2)
+ ty = convertLength(state, list->item(1));
+ if (list->length() == 3)
+ tz = toCSSPrimitiveValue(list->item(2))->getDoubleValue();
+
+ return TranslateTransformOperation::create(tx, ty, tz, TransformOperation::Translate3D);
+}
+
+PassRefPtr<RotateTransformOperation> StyleBuilderConverter::convertRotate(StyleResolverState& state, CSSValue* value)
+{
+ CSSValueList* list = toCSSValueList(value);
+ ASSERT(list->length() == 1 || list->length() == 4);
+ double angle = toCSSPrimitiveValue(list->item(0))->computeDegrees();
+ double x = 0;
+ double y = 0;
+ double z = 1;
+ if (list->length() == 4) {
+ x = toCSSPrimitiveValue(list->item(1))->getDoubleValue();
+ y = toCSSPrimitiveValue(list->item(2))->getDoubleValue();
+ z = toCSSPrimitiveValue(list->item(3))->getDoubleValue();
+ }
+
+ return RotateTransformOperation::create(x, y, z, angle, TransformOperation::Rotate3D);
+}
+
+PassRefPtr<ScaleTransformOperation> StyleBuilderConverter::convertScale(StyleResolverState& state, CSSValue* value)
+{
+ CSSValueList* list = toCSSValueList(value);
+ ASSERT(list->length() >= 1 && list->length() <= 3);
+ double sx = toCSSPrimitiveValue(list->item(0))->getDoubleValue();
+ double sy = 1;
+ double sz = 1;
+ if (list->length() >= 2 && list->length() <= 3)
Timothy Loh 2015/06/15 06:17:34 why check against 3?
soonm 2015/06/15 06:59:18 Do not need to - Removed
+ sy = toCSSPrimitiveValue(list->item(1))->getDoubleValue();
+ if (list->length() == 3)
+ sz = toCSSPrimitiveValue(list->item(2))->getDoubleValue();
+
+ return ScaleTransformOperation::create(sx, sy, sz, TransformOperation::Scale3D);
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698