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

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

Issue 2435413002: Use a converter for building style value for 'transform' (Closed)
Patch Set: Created 4 years, 1 month 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
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 27 matching lines...) Expand all
38 #include "core/css/CSSIdentifierValue.h" 38 #include "core/css/CSSIdentifierValue.h"
39 #include "core/css/CSSPathValue.h" 39 #include "core/css/CSSPathValue.h"
40 #include "core/css/CSSPrimitiveValueMappings.h" 40 #include "core/css/CSSPrimitiveValueMappings.h"
41 #include "core/css/CSSQuadValue.h" 41 #include "core/css/CSSQuadValue.h"
42 #include "core/css/CSSReflectValue.h" 42 #include "core/css/CSSReflectValue.h"
43 #include "core/css/CSSShadowValue.h" 43 #include "core/css/CSSShadowValue.h"
44 #include "core/css/CSSStringValue.h" 44 #include "core/css/CSSStringValue.h"
45 #include "core/css/CSSURIValue.h" 45 #include "core/css/CSSURIValue.h"
46 #include "core/css/CSSValuePair.h" 46 #include "core/css/CSSValuePair.h"
47 #include "core/css/resolver/FilterOperationResolver.h" 47 #include "core/css/resolver/FilterOperationResolver.h"
48 #include "core/css/resolver/TransformBuilder.h"
48 #include "core/frame/LocalFrame.h" 49 #include "core/frame/LocalFrame.h"
49 #include "core/frame/UseCounter.h" 50 #include "core/frame/UseCounter.h"
50 #include "core/style/ClipPathOperation.h" 51 #include "core/style/ClipPathOperation.h"
51 #include "core/style/TextSizeAdjust.h" 52 #include "core/style/TextSizeAdjust.h"
52 #include "core/svg/SVGURIReference.h" 53 #include "core/svg/SVGURIReference.h"
53 #include "platform/fonts/FontCache.h" 54 #include "platform/fonts/FontCache.h"
54 #include "platform/transforms/RotateTransformOperation.h" 55 #include "platform/transforms/RotateTransformOperation.h"
55 #include "platform/transforms/ScaleTransformOperation.h" 56 #include "platform/transforms/ScaleTransformOperation.h"
56 #include "platform/transforms/TranslateTransformOperation.h" 57 #include "platform/transforms/TranslateTransformOperation.h"
57 #include <algorithm> 58 #include <algorithm>
(...skipping 1076 matching lines...) Expand 10 before | Expand all | Expand 10 after
1134 toCSSIdentifierValue(value).getValueID() == CSSValueNone) 1135 toCSSIdentifierValue(value).getValueID() == CSSValueNone)
1135 return TextSizeAdjust::adjustNone(); 1136 return TextSizeAdjust::adjustNone();
1136 if (value.isIdentifierValue() && 1137 if (value.isIdentifierValue() &&
1137 toCSSIdentifierValue(value).getValueID() == CSSValueAuto) 1138 toCSSIdentifierValue(value).getValueID() == CSSValueAuto)
1138 return TextSizeAdjust::adjustAuto(); 1139 return TextSizeAdjust::adjustAuto();
1139 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); 1140 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value);
1140 DCHECK(primitiveValue.isPercentage()); 1141 DCHECK(primitiveValue.isPercentage());
1141 return TextSizeAdjust(primitiveValue.getFloatValue() / 100.0f); 1142 return TextSizeAdjust(primitiveValue.getFloatValue() / 100.0f);
1142 } 1143 }
1143 1144
1145 TransformOperations StyleBuilderConverter::convertTransformOperations(
1146 StyleResolverState& state,
1147 const CSSValue& value) {
1148 return TransformBuilder::createTransformOperations(
1149 value, state.cssToLengthConversionData());
1150 }
1151
1144 TransformOrigin StyleBuilderConverter::convertTransformOrigin( 1152 TransformOrigin StyleBuilderConverter::convertTransformOrigin(
1145 StyleResolverState& state, 1153 StyleResolverState& state,
1146 const CSSValue& value) { 1154 const CSSValue& value) {
1147 const CSSValueList& list = toCSSValueList(value); 1155 const CSSValueList& list = toCSSValueList(value);
1148 DCHECK_EQ(list.length(), 3U); 1156 DCHECK_EQ(list.length(), 3U);
1149 DCHECK(list.item(0).isPrimitiveValue() || list.item(0).isIdentifierValue()); 1157 DCHECK(list.item(0).isPrimitiveValue() || list.item(0).isIdentifierValue());
1150 DCHECK(list.item(1).isPrimitiveValue() || list.item(1).isIdentifierValue()); 1158 DCHECK(list.item(1).isPrimitiveValue() || list.item(1).isIdentifierValue());
1151 DCHECK(list.item(2).isPrimitiveValue()); 1159 DCHECK(list.item(2).isPrimitiveValue());
1152 1160
1153 return TransformOrigin( 1161 return TransformOrigin(
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
1288 // Instead of the actual zoom, use 1 to avoid potential rounding errors 1296 // Instead of the actual zoom, use 1 to avoid potential rounding errors
1289 Length length = primitiveValue.convertToLength( 1297 Length length = primitiveValue.convertToLength(
1290 state.cssToLengthConversionData().copyWithAdjustedZoom(1)); 1298 state.cssToLengthConversionData().copyWithAdjustedZoom(1));
1291 return *CSSPrimitiveValue::create(length, 1); 1299 return *CSSPrimitiveValue::create(length, 1);
1292 } 1300 }
1293 } 1301 }
1294 return value; 1302 return value;
1295 } 1303 }
1296 1304
1297 } // namespace blink 1305 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698