Chromium Code Reviews| Index: third_party/WebKit/Source/core/css/cssom/StyleValueFactory.cpp |
| diff --git a/third_party/WebKit/Source/core/css/cssom/StyleValueFactory.cpp b/third_party/WebKit/Source/core/css/cssom/StyleValueFactory.cpp |
| index 301b91445f3f9b312605ce644b8d9f8c9efa3f53..61eabc0b866a73137ea240f1c91155ea1287643c 100644 |
| --- a/third_party/WebKit/Source/core/css/cssom/StyleValueFactory.cpp |
| +++ b/third_party/WebKit/Source/core/css/cssom/StyleValueFactory.cpp |
| @@ -4,9 +4,12 @@ |
| #include "core/css/cssom/StyleValueFactory.h" |
| +#include "core/css/CSSCalculationValue.h" |
|
rjwright
2016/09/29 05:34:42
I don't think any of these extra includes are need
meade_UTC10
2016/09/29 05:53:13
Done.
|
| #include "core/css/CSSImageValue.h" |
| #include "core/css/CSSValue.h" |
| +#include "core/css/cssom/CSSCalcLength.h" |
| #include "core/css/cssom/CSSNumberValue.h" |
| +#include "core/css/cssom/CSSOMTypes.h" |
| #include "core/css/cssom/CSSSimpleLength.h" |
| #include "core/css/cssom/CSSStyleValue.h" |
| #include "core/css/cssom/CSSStyleVariableReferenceValue.h" |
| @@ -19,6 +22,16 @@ namespace blink { |
| namespace { |
| +CSSStyleValue* styleValueForPrimitiveValue(CSSPropertyID propertyID, const CSSPrimitiveValue& primitiveValue) |
|
rjwright
2016/09/29 05:34:42
propertyID isn't used
meade_UTC10
2016/09/29 05:53:13
Done.
|
| +{ |
| + if (primitiveValue.isNumber()) |
| + return CSSNumberValue::create(primitiveValue.getDoubleValue()); |
| + if (primitiveValue.isLength()) |
| + return CSSSimpleLength::fromCSSValue(primitiveValue); |
| + |
| + return nullptr; |
| +} |
| + |
| CSSStyleValue* styleValueForProperty(CSSPropertyID propertyID, const CSSValue& value) |
| { |
| switch (propertyID) { |
| @@ -29,22 +42,12 @@ CSSStyleValue* styleValueForProperty(CSSPropertyID propertyID, const CSSValue& v |
| break; |
| } |
| - if (value.isPrimitiveValue()) { |
| - const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); |
| - if (primitiveValue.isLength() && !primitiveValue.isCalculated()) |
| - return CSSSimpleLength::create(primitiveValue.getDoubleValue(), primitiveValue.typeWithCalcResolved()); |
| - if (primitiveValue.isNumber()) |
| - return CSSNumberValue::create(primitiveValue.getDoubleValue()); |
| - } |
| - |
| - if (value.isVariableReferenceValue()) { |
| + if (value.isPrimitiveValue()) |
| + return styleValueForPrimitiveValue(propertyID, toCSSPrimitiveValue(value)); |
| + if (value.isVariableReferenceValue()) |
| return CSSUnparsedValue::fromCSSValue(toCSSVariableReferenceValue(value)); |
| - } |
| - |
| - if (value.isImageValue()) { |
| - const CSSImageValue& imageValue = toCSSImageValue(value); |
| - return CSSURLImageValue::create(imageValue.valueWithURLMadeAbsolute()); |
| - } |
| + if (value.isImageValue()) |
| + return CSSURLImageValue::create(toCSSImageValue(value).valueWithURLMadeAbsolute()); |
| return nullptr; |
| } |