 Chromium Code Reviews
 Chromium Code Reviews Issue 1158603003:
  CSS Independent Transform Properties  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/blink.git@master
    
  
    Issue 1158603003:
  CSS Independent Transform Properties  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/blink.git@master| OLD | NEW | 
|---|---|
| 1 /* | 1 /* | 
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 
| 3 * | 3 * | 
| 4 * * Redistributions of source code must retain the above copyright | 4 * * Redistributions of source code must retain the above copyright | 
| 5 * notice, this list of conditions and the following disclaimer. | 5 * notice, this list of conditions and the following disclaimer. | 
| 6 * * Redistributions in binary form must reproduce the above | 6 * * Redistributions in binary form must reproduce the above | 
| 7 * copyright notice, this list of conditions and the following disclaimer | 7 * copyright notice, this list of conditions and the following disclaimer | 
| 8 * in the documentation and/or other materials provided with the | 8 * in the documentation and/or other materials provided with the | 
| 9 * distribution. | 9 * distribution. | 
| 10 * * Neither the name of Google Inc. nor the names of its | 10 * * Neither the name of Google Inc. nor the names of its | 
| (...skipping 917 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 928 | 928 | 
| 929 CSSValueList* valueList = toCSSValueList(value); | 929 CSSValueList* valueList = toCSSValueList(value); | 
| 930 coordinates.reserveInitialCapacity(valueList->length()); | 930 coordinates.reserveInitialCapacity(valueList->length()); | 
| 931 for (auto& snapCoordinate : *valueList) { | 931 for (auto& snapCoordinate : *valueList) { | 
| 932 coordinates.uncheckedAppend(convertPosition(state, snapCoordinate.get()) ); | 932 coordinates.uncheckedAppend(convertPosition(state, snapCoordinate.get()) ); | 
| 933 } | 933 } | 
| 934 | 934 | 
| 935 return coordinates; | 935 return coordinates; | 
| 936 } | 936 } | 
| 937 | 937 | 
| 938 PassRefPtr<TranslateTransformOperation> StyleBuilderConverter::convertTranslate( StyleResolverState& state, CSSValue* value) | |
| 939 { | |
| 940 CSSValueList* list = toCSSValueList(value); | |
| 941 ASSERT(list->length() >= 1 && list->length() <= 3); | |
| 942 Length tx = convertLength(state, list->item(0)); | |
| 943 Length ty(0, Fixed); | |
| 944 double tz = 0; | |
| 945 if (list->length() >= 2) | |
| 946 ty = convertLength(state, list->item(1)); | |
| 947 if (list->length() == 3) | |
| 948 tz = toCSSPrimitiveValue(list->item(2))->getDoubleValue(); | |
| 949 | |
| 950 return TranslateTransformOperation::create(tx, ty, tz, TransformOperation::T ranslate3D); | |
| 951 } | |
| 952 | |
| 953 PassRefPtr<RotateTransformOperation> StyleBuilderConverter::convertRotate(StyleR esolverState& state, CSSValue* value) | |
| 954 { | |
| 955 CSSValueList* list = toCSSValueList(value); | |
| 956 ASSERT(list->length() == 1 || list->length() == 4); | |
| 957 double angle = toCSSPrimitiveValue(list->item(0))->computeDegrees(); | |
| 958 double x = 0; | |
| 959 double y = 0; | |
| 960 double z = 1; | |
| 961 if (list->length() == 4) { | |
| 962 x = toCSSPrimitiveValue(list->item(1))->getDoubleValue(); | |
| 963 y = toCSSPrimitiveValue(list->item(2))->getDoubleValue(); | |
| 964 z = toCSSPrimitiveValue(list->item(3))->getDoubleValue(); | |
| 965 } | |
| 966 | |
| 967 return RotateTransformOperation::create(x, y, z, angle, TransformOperation:: Rotate3D); | |
| 968 } | |
| 969 | |
| 970 PassRefPtr<ScaleTransformOperation> StyleBuilderConverter::convertScale(StyleRes olverState& state, CSSValue* value) | |
| 971 { | |
| 972 CSSValueList* list = toCSSValueList(value); | |
| 973 ASSERT(list->length() >= 1 && list->length() <= 3); | |
| 974 double sx = toCSSPrimitiveValue(list->item(0))->getDoubleValue(); | |
| 975 double sy = 1; | |
| 976 double sz = 1; | |
| 977 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
 | |
| 978 sy = toCSSPrimitiveValue(list->item(1))->getDoubleValue(); | |
| 979 if (list->length() == 3) | |
| 980 sz = toCSSPrimitiveValue(list->item(2))->getDoubleValue(); | |
| 981 | |
| 982 return ScaleTransformOperation::create(sx, sy, sz, TransformOperation::Scale 3D); | |
| 983 } | |
| 984 | |
| 938 } // namespace blink | 985 } // namespace blink | 
| OLD | NEW |