Chromium Code Reviews| Index: third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp |
| diff --git a/third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp b/third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp |
| index 0311e4d2f9438907fe57c8f07dc7d9cd86680c6a..552385189874a4ccf7d6b9cb6d5a2133d853753d 100644 |
| --- a/third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp |
| +++ b/third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp |
| @@ -1284,30 +1284,46 @@ PassRefPtr<StylePath> StyleBuilderConverter::convertPathOrNone( |
| return nullptr; |
| } |
| -const CSSValue& StyleBuilderConverter::convertRegisteredPropertyValue( |
| - const StyleResolverState& state, |
| +static const CSSValue& computeRegisteredPropertyValue( |
| + const CSSToLengthConversionData& cssToLengthConversionData, |
| const CSSValue& value) { |
| // TODO(timloh): Images and transform-function values can also contain |
| // lengths. |
| if (value.isValueList()) { |
| CSSValueList* newList = CSSValueList::createSpaceSeparated(); |
| - for (const CSSValue* innerValue : toCSSValueList(value)) |
| - newList->append(convertRegisteredPropertyValue(state, *innerValue)); |
| + for (const CSSValue* innerValue : toCSSValueList(value)) { |
| + newList->append(computeRegisteredPropertyValue(cssToLengthConversionData, |
| + *innerValue)); |
| + } |
| return *newList; |
| } |
| if (value.isPrimitiveValue()) { |
| const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); |
| - if (primitiveValue.isCalculated() || |
| + if ((primitiveValue.isCalculated() && |
|
Timothy Loh
2017/01/13 05:07:41
Apparently we didn't have any tests previously tha
|
| + (primitiveValue.isCalculatedPercentageWithLength() || |
| + primitiveValue.isLength() || primitiveValue.isPercentage())) || |
| CSSPrimitiveValue::isRelativeUnit( |
| primitiveValue.typeWithCalcResolved())) { |
| // Instead of the actual zoom, use 1 to avoid potential rounding errors |
| Length length = primitiveValue.convertToLength( |
| - state.cssToLengthConversionData().copyWithAdjustedZoom(1)); |
| + cssToLengthConversionData.copyWithAdjustedZoom(1)); |
| return *CSSPrimitiveValue::create(length, 1); |
| } |
| } |
| return value; |
| } |
| +const CSSValue& StyleBuilderConverter::convertRegisteredPropertyInitialValue( |
| + const CSSValue& value) { |
| + return computeRegisteredPropertyValue(CSSToLengthConversionData(), value); |
| +} |
| + |
| +const CSSValue& StyleBuilderConverter::convertRegisteredPropertyValue( |
| + const StyleResolverState& state, |
| + const CSSValue& value) { |
| + return computeRegisteredPropertyValue(state.cssToLengthConversionData(), |
| + value); |
| +} |
| + |
| } // namespace blink |