Chromium Code Reviews| 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 |