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

Side by Side 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: Rebase master 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 unified diff | Download patch
« no previous file with comments | « Source/core/css/resolver/StyleBuilderConverter.h ('k') | Source/core/frame/UseCounter.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 21 matching lines...) Expand all
32 #include "core/css/CSSFontFeatureValue.h" 32 #include "core/css/CSSFontFeatureValue.h"
33 #include "core/css/CSSFunctionValue.h" 33 #include "core/css/CSSFunctionValue.h"
34 #include "core/css/CSSGridLineNamesValue.h" 34 #include "core/css/CSSGridLineNamesValue.h"
35 #include "core/css/CSSPrimitiveValueMappings.h" 35 #include "core/css/CSSPrimitiveValueMappings.h"
36 #include "core/css/CSSReflectValue.h" 36 #include "core/css/CSSReflectValue.h"
37 #include "core/css/CSSShadowValue.h" 37 #include "core/css/CSSShadowValue.h"
38 #include "core/css/Pair.h" 38 #include "core/css/Pair.h"
39 #include "core/css/Rect.h" 39 #include "core/css/Rect.h"
40 #include "core/svg/SVGElement.h" 40 #include "core/svg/SVGElement.h"
41 #include "core/svg/SVGURIReference.h" 41 #include "core/svg/SVGURIReference.h"
42 #include "platform/transforms/RotateTransformOperation.h"
43 #include "platform/transforms/ScaleTransformOperation.h"
44 #include "platform/transforms/TranslateTransformOperation.h"
42 45
43 namespace blink { 46 namespace blink {
44 47
45 namespace { 48 namespace {
46 49
47 static GridLength convertGridTrackBreadth(const StyleResolverState& state, CSSPr imitiveValue* primitiveValue) 50 static GridLength convertGridTrackBreadth(const StyleResolverState& state, CSSPr imitiveValue* primitiveValue)
48 { 51 {
49 if (primitiveValue->getValueID() == CSSValueMinContent) 52 if (primitiveValue->getValueID() == CSSValueMinContent)
50 return Length(MinContent); 53 return Length(MinContent);
51 54
(...skipping 878 matching lines...) Expand 10 before | Expand all | Expand 10 after
930 933
931 CSSValueList* valueList = toCSSValueList(value); 934 CSSValueList* valueList = toCSSValueList(value);
932 coordinates.reserveInitialCapacity(valueList->length()); 935 coordinates.reserveInitialCapacity(valueList->length());
933 for (auto& snapCoordinate : *valueList) { 936 for (auto& snapCoordinate : *valueList) {
934 coordinates.uncheckedAppend(convertPosition(state, snapCoordinate.get()) ); 937 coordinates.uncheckedAppend(convertPosition(state, snapCoordinate.get()) );
935 } 938 }
936 939
937 return coordinates; 940 return coordinates;
938 } 941 }
939 942
943 PassRefPtr<TranslateTransformOperation> StyleBuilderConverter::convertTranslate( StyleResolverState& state, CSSValue* value)
944 {
945 CSSValueList& list = *toCSSValueList(value);
946 ASSERT(list.length() <= 3);
947 Length tx = convertLength(state, list.item(0));
948 Length ty(0, Fixed);
949 double tz = 0;
950 if (list.length() >= 2)
951 ty = convertLength(state, list.item(1));
952 if (list.length() == 3)
953 tz = toCSSPrimitiveValue(list.item(2))->getDoubleValue();
954
955 return TranslateTransformOperation::create(tx, ty, tz, TransformOperation::T ranslate3D);
956 }
957
958 PassRefPtr<RotateTransformOperation> StyleBuilderConverter::convertRotate(StyleR esolverState& state, CSSValue* value)
959 {
960 CSSValueList& list = *toCSSValueList(value);
961 ASSERT(list.length() == 1 || list.length() == 4);
962 double angle = toCSSPrimitiveValue(list.item(0))->computeDegrees();
963 double x = 0;
964 double y = 0;
965 double z = 1;
966 if (list.length() == 4) {
967 x = toCSSPrimitiveValue(list.item(1))->getDoubleValue();
968 y = toCSSPrimitiveValue(list.item(2))->getDoubleValue();
969 z = toCSSPrimitiveValue(list.item(3))->getDoubleValue();
970 }
971
972 return RotateTransformOperation::create(x, y, z, angle, TransformOperation:: Rotate3D);
973 }
974
975 PassRefPtr<ScaleTransformOperation> StyleBuilderConverter::convertScale(StyleRes olverState& state, CSSValue* value)
976 {
977 CSSValueList& list = *toCSSValueList(value);
978 ASSERT(list.length() <= 3);
979 double sx = toCSSPrimitiveValue(list.item(0))->getDoubleValue();
980 double sy = sx;
981 double sz = 1;
982 if (list.length() >= 2)
983 sy = toCSSPrimitiveValue(list.item(1))->getDoubleValue();
984 if (list.length() == 3)
985 sz = toCSSPrimitiveValue(list.item(2))->getDoubleValue();
986
987 return ScaleTransformOperation::create(sx, sy, sz, TransformOperation::Scale 3D);
988 }
989
940 } // namespace blink 990 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/css/resolver/StyleBuilderConverter.h ('k') | Source/core/frame/UseCounter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698