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

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

Issue 1158603003: CSS Independent Transform Properties (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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/StyleBuilderCustom.cpp
diff --git a/Source/core/css/resolver/StyleBuilderCustom.cpp b/Source/core/css/resolver/StyleBuilderCustom.cpp
index eefd6cc6d4ca7854247e16577902c80b892926b9..a03358fffc67c2b3da7b36412511b44295f86a87 100644
--- a/Source/core/css/resolver/StyleBuilderCustom.cpp
+++ b/Source/core/css/resolver/StyleBuilderCustom.cpp
@@ -833,4 +833,84 @@ void StyleBuilderFunctions::applyValueCSSPropertyBaselineShift(StyleResolverStat
}
}
+void StyleBuilderFunctions::applyInitialCSSPropertyTranslate(StyleResolverState& state)
+{
+ state.style()->setTranslate(Length(0, Fixed), Length(0, Fixed), 0);
+}
+
+void StyleBuilderFunctions::applyInheritCSSPropertyTranslate(StyleResolverState& state)
+{
+ if (state.parentStyle()->hasTranslateProperty()) {
Timothy Loh 2015/06/05 00:55:59 doesn't this work without the check?
soonm 2015/06/10 04:09:32 Done.
+ state.style()->setTranslate(state.parentStyle()->translate());
+ }
Eric Willigers 2015/06/05 01:58:23 otherwise should we clear the translate property?
soonm 2015/06/10 04:09:32 The translate property is initialize to nullptr. I
+}
+
+void StyleBuilderFunctions::applyValueCSSPropertyTranslate(StyleResolverState& state, CSSValue* value)
+{
+ CSSValueList* list = toCSSValueList(value);
+ ASSERT(list->length() >= 1 && list->length() <= 3);
+ Length tx = toCSSPrimitiveValue(list->item(0))->convertToLength(state.cssToLengthConversionData());
+ Length ty = Length(0, Fixed);
Timothy Loh 2015/06/05 00:55:59 Length ty(0, Fixed)
soonm 2015/06/10 04:09:32 Done. Transferred to StyleBuilderConverter
+ double tz = 0;
+ if (list->length() >= 2)
+ ty = toCSSPrimitiveValue(list->item(1))->convertToLength(state.cssToLengthConversionData());
+ if (list->length() == 3)
+ tz = toCSSPrimitiveValue(list->item(2))->getDoubleValue();
+ state.style()->setTranslate(tx, ty, tz);
+}
+
+void StyleBuilderFunctions::applyInitialCSSPropertyRotate(StyleResolverState& state)
+{
+ state.style()->setRotate(0, 0, 0, 1);
+}
+
+void StyleBuilderFunctions::applyInheritCSSPropertyRotate(StyleResolverState& state)
+{
+ if (state.parentStyle()->hasRotateProperty()) {
+ state.style()->setRotate(state.parentStyle()->rotate());
+ }
+}
+
+void StyleBuilderFunctions::applyValueCSSPropertyRotate(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();
+ }
+ state.style()->setRotate(angle, x, y, z);
+}
+
+
+void StyleBuilderFunctions::applyInitialCSSPropertyScale(StyleResolverState& state)
+{
+ state.style()->setScale(1, 1, 1);
+}
+
+void StyleBuilderFunctions::applyInheritCSSPropertyScale(StyleResolverState& state)
+{
+ if (state.parentStyle()->hasScaleProperty()) {
+ state.style()->setScale(state.parentStyle()->scale());
+ }
+}
+void StyleBuilderFunctions::applyValueCSSPropertyScale(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)
+ sy = toCSSPrimitiveValue(list->item(1))->getDoubleValue();
+ if (list->length() == 3)
+ sz = toCSSPrimitiveValue(list->item(2))->getDoubleValue();
+ state.style()->setScale(sx, sy, sz);
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698