OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/css/cssom/StyleValueFactory.h" | 5 #include "core/css/cssom/StyleValueFactory.h" |
6 | 6 |
7 #include "core/css/CSSValue.h" | 7 #include "core/css/CSSValue.h" |
8 #include "core/css/cssom/CSSSimpleLength.h" | 8 #include "core/css/cssom/CSSSimpleLength.h" |
9 #include "core/css/cssom/CSSStyleValue.h" | 9 #include "core/css/cssom/CSSStyleValue.h" |
| 10 #include "core/css/cssom/CSSTransformValue.h" |
10 #include "core/css/cssom/CSSUnsupportedStyleValue.h" | 11 #include "core/css/cssom/CSSUnsupportedStyleValue.h" |
11 #include "core/css/cssom/TransformValue.h" | |
12 | 12 |
13 namespace blink { | 13 namespace blink { |
14 | 14 |
15 CSSStyleValueVector StyleValueFactory::cssValueToStyleValueVector(CSSPropertyID
propertyID, const CSSValue& value) | 15 CSSStyleValueVector StyleValueFactory::cssValueToStyleValueVector(CSSPropertyID
propertyID, const CSSValue& value) |
16 { | 16 { |
17 CSSStyleValueVector styleValueVector; | 17 CSSStyleValueVector styleValueVector; |
18 | 18 |
19 if (value.isPrimitiveValue()) { | 19 if (value.isPrimitiveValue()) { |
20 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); | 20 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); |
21 if (primitiveValue.isLength() && !primitiveValue.isCalculated()) { | 21 if (primitiveValue.isLength() && !primitiveValue.isCalculated()) { |
22 styleValueVector.append(CSSSimpleLength::create(primitiveValue.getDo
ubleValue(), primitiveValue.typeWithCalcResolved())); | 22 styleValueVector.append(CSSSimpleLength::create(primitiveValue.getDo
ubleValue(), primitiveValue.typeWithCalcResolved())); |
23 return styleValueVector; | 23 return styleValueVector; |
24 } | 24 } |
25 } | 25 } |
26 | 26 |
27 CSSStyleValue* styleValue = nullptr; | 27 CSSStyleValue* styleValue = nullptr; |
28 switch (propertyID) { | 28 switch (propertyID) { |
29 case CSSPropertyTransform: | 29 case CSSPropertyTransform: |
30 styleValue = TransformValue::fromCSSValue(value); | 30 styleValue = CSSTransformValue::fromCSSValue(value); |
31 if (styleValue) | 31 if (styleValue) |
32 styleValueVector.append(styleValue); | 32 styleValueVector.append(styleValue); |
33 return styleValueVector; | 33 return styleValueVector; |
34 default: | 34 default: |
35 // TODO(meade): Implement the rest. | 35 // TODO(meade): Implement the rest. |
36 break; | 36 break; |
37 } | 37 } |
38 | 38 |
39 styleValueVector.append(CSSUnsupportedStyleValue::create(value.cssText())); | 39 styleValueVector.append(CSSUnsupportedStyleValue::create(value.cssText())); |
40 return styleValueVector; | 40 return styleValueVector; |
41 } | 41 } |
42 | 42 |
43 } // namespace blink | 43 } // namespace blink |
OLD | NEW |