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..3dd43b33f27318d2e9a2f2bdef3ef7ab0193be12 100644 |
--- a/third_party/WebKit/Source/core/css/cssom/StyleValueFactory.cpp |
+++ b/third_party/WebKit/Source/core/css/cssom/StyleValueFactory.cpp |
@@ -19,6 +19,16 @@ namespace blink { |
namespace { |
+CSSStyleValue* styleValueForPrimitiveValue(const CSSPrimitiveValue& primitiveValue) |
+{ |
+ 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 +39,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(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; |
} |