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

Side by Side Diff: third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp

Issue 2531753002: CSS Independent Transform Properties: support rotate: <axes> <angle> (Closed)
Patch Set: tests Created 4 years 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 | « third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp ('k') | no next file » | 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 1198 matching lines...) Expand 10 before | Expand all | Expand 10 after
1209 tz = toCSSPrimitiveValue(list.item(2)) 1209 tz = toCSSPrimitiveValue(list.item(2))
1210 .computeLength<double>(state.cssToLengthConversionData()); 1210 .computeLength<double>(state.cssToLengthConversionData());
1211 1211
1212 return TranslateTransformOperation::create(tx, ty, tz, 1212 return TranslateTransformOperation::create(tx, ty, tz,
1213 TransformOperation::Translate3D); 1213 TransformOperation::Translate3D);
1214 } 1214 }
1215 1215
1216 Rotation StyleBuilderConverter::convertRotation(const CSSValue& value) { 1216 Rotation StyleBuilderConverter::convertRotation(const CSSValue& value) {
1217 const CSSValueList& list = toCSSValueList(value); 1217 const CSSValueList& list = toCSSValueList(value);
1218 ASSERT(list.length() == 1 || list.length() == 4); 1218 ASSERT(list.length() == 1 || list.length() == 4);
1219 double angle = toCSSPrimitiveValue(list.item(0)).computeDegrees();
1220 double x = 0; 1219 double x = 0;
1221 double y = 0; 1220 double y = 0;
1222 double z = 1; 1221 double z = 1;
1223 if (list.length() == 4) { 1222 if (list.length() == 4) {
1224 x = toCSSPrimitiveValue(list.item(1)).getDoubleValue(); 1223 x = toCSSPrimitiveValue(list.item(0)).getDoubleValue();
1225 y = toCSSPrimitiveValue(list.item(2)).getDoubleValue(); 1224 y = toCSSPrimitiveValue(list.item(1)).getDoubleValue();
1226 z = toCSSPrimitiveValue(list.item(3)).getDoubleValue(); 1225 z = toCSSPrimitiveValue(list.item(2)).getDoubleValue();
1227 } 1226 }
1227 double angle =
1228 toCSSPrimitiveValue(list.item(list.length() - 1)).computeDegrees();
1228 return Rotation(FloatPoint3D(x, y, z), angle); 1229 return Rotation(FloatPoint3D(x, y, z), angle);
1229 } 1230 }
1230 1231
1231 PassRefPtr<RotateTransformOperation> StyleBuilderConverter::convertRotate( 1232 PassRefPtr<RotateTransformOperation> StyleBuilderConverter::convertRotate(
1232 StyleResolverState& state, 1233 StyleResolverState& state,
1233 const CSSValue& value) { 1234 const CSSValue& value) {
1234 return RotateTransformOperation::create(convertRotation(value), 1235 return RotateTransformOperation::create(convertRotation(value),
1235 TransformOperation::Rotate3D); 1236 TransformOperation::Rotate3D);
1236 } 1237 }
1237 1238
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
1290 // Instead of the actual zoom, use 1 to avoid potential rounding errors 1291 // Instead of the actual zoom, use 1 to avoid potential rounding errors
1291 Length length = primitiveValue.convertToLength( 1292 Length length = primitiveValue.convertToLength(
1292 state.cssToLengthConversionData().copyWithAdjustedZoom(1)); 1293 state.cssToLengthConversionData().copyWithAdjustedZoom(1));
1293 return *CSSPrimitiveValue::create(length, 1); 1294 return *CSSPrimitiveValue::create(length, 1);
1294 } 1295 }
1295 } 1296 }
1296 return value; 1297 return value;
1297 } 1298 }
1298 1299
1299 } // namespace blink 1300 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698