Chromium Code Reviews| 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 1266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1277 | 1277 |
| 1278 PassRefPtr<StylePath> StyleBuilderConverter::convertPathOrNone( | 1278 PassRefPtr<StylePath> StyleBuilderConverter::convertPathOrNone( |
| 1279 StyleResolverState& state, | 1279 StyleResolverState& state, |
| 1280 const CSSValue& value) { | 1280 const CSSValue& value) { |
| 1281 if (value.isPathValue()) | 1281 if (value.isPathValue()) |
| 1282 return toCSSPathValue(value).stylePath(); | 1282 return toCSSPathValue(value).stylePath(); |
| 1283 DCHECK_EQ(toCSSIdentifierValue(value).getValueID(), CSSValueNone); | 1283 DCHECK_EQ(toCSSIdentifierValue(value).getValueID(), CSSValueNone); |
| 1284 return nullptr; | 1284 return nullptr; |
| 1285 } | 1285 } |
| 1286 | 1286 |
| 1287 const CSSValue& StyleBuilderConverter::convertRegisteredPropertyValue( | 1287 static const CSSValue& computeRegisteredPropertyValue( |
| 1288 const StyleResolverState& state, | 1288 const CSSToLengthConversionData& cssToLengthConversionData, |
| 1289 const CSSValue& value) { | 1289 const CSSValue& value) { |
| 1290 // TODO(timloh): Images and transform-function values can also contain | 1290 // TODO(timloh): Images and transform-function values can also contain |
| 1291 // lengths. | 1291 // lengths. |
| 1292 if (value.isValueList()) { | 1292 if (value.isValueList()) { |
| 1293 CSSValueList* newList = CSSValueList::createSpaceSeparated(); | 1293 CSSValueList* newList = CSSValueList::createSpaceSeparated(); |
| 1294 for (const CSSValue* innerValue : toCSSValueList(value)) | 1294 for (const CSSValue* innerValue : toCSSValueList(value)) { |
| 1295 newList->append(convertRegisteredPropertyValue(state, *innerValue)); | 1295 newList->append(computeRegisteredPropertyValue(cssToLengthConversionData, |
| 1296 *innerValue)); | |
| 1297 } | |
| 1296 return *newList; | 1298 return *newList; |
| 1297 } | 1299 } |
| 1298 | 1300 |
| 1299 if (value.isPrimitiveValue()) { | 1301 if (value.isPrimitiveValue()) { |
| 1300 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); | 1302 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); |
| 1301 if (primitiveValue.isCalculated() || | 1303 if ((primitiveValue.isCalculated() && |
|
Timothy Loh
2017/01/13 05:07:41
Apparently we didn't have any tests previously tha
| |
| 1304 (primitiveValue.isCalculatedPercentageWithLength() || | |
| 1305 primitiveValue.isLength() || primitiveValue.isPercentage())) || | |
| 1302 CSSPrimitiveValue::isRelativeUnit( | 1306 CSSPrimitiveValue::isRelativeUnit( |
| 1303 primitiveValue.typeWithCalcResolved())) { | 1307 primitiveValue.typeWithCalcResolved())) { |
| 1304 // Instead of the actual zoom, use 1 to avoid potential rounding errors | 1308 // Instead of the actual zoom, use 1 to avoid potential rounding errors |
| 1305 Length length = primitiveValue.convertToLength( | 1309 Length length = primitiveValue.convertToLength( |
| 1306 state.cssToLengthConversionData().copyWithAdjustedZoom(1)); | 1310 cssToLengthConversionData.copyWithAdjustedZoom(1)); |
| 1307 return *CSSPrimitiveValue::create(length, 1); | 1311 return *CSSPrimitiveValue::create(length, 1); |
| 1308 } | 1312 } |
| 1309 } | 1313 } |
| 1310 return value; | 1314 return value; |
| 1311 } | 1315 } |
| 1312 | 1316 |
| 1317 const CSSValue& StyleBuilderConverter::convertRegisteredPropertyInitialValue( | |
| 1318 const CSSValue& value) { | |
| 1319 return computeRegisteredPropertyValue(CSSToLengthConversionData(), value); | |
| 1320 } | |
| 1321 | |
| 1322 const CSSValue& StyleBuilderConverter::convertRegisteredPropertyValue( | |
| 1323 const StyleResolverState& state, | |
| 1324 const CSSValue& value) { | |
| 1325 return computeRegisteredPropertyValue(state.cssToLengthConversionData(), | |
| 1326 value); | |
| 1327 } | |
| 1328 | |
| 1313 } // namespace blink | 1329 } // namespace blink |
| OLD | NEW |