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/CSSImageValue.h" | 7 #include "core/css/CSSImageValue.h" |
8 #include "core/css/CSSValue.h" | 8 #include "core/css/CSSValue.h" |
9 #include "core/css/cssom/CSSKeywordValue.h" | 9 #include "core/css/cssom/CSSKeywordValue.h" |
| 10 #include "core/css/cssom/CSSNumericValue.h" |
10 #include "core/css/cssom/CSSOMTypes.h" | 11 #include "core/css/cssom/CSSOMTypes.h" |
11 #include "core/css/cssom/CSSStyleValue.h" | 12 #include "core/css/cssom/CSSStyleValue.h" |
12 #include "core/css/cssom/CSSStyleVariableReferenceValue.h" | 13 #include "core/css/cssom/CSSStyleVariableReferenceValue.h" |
13 #include "core/css/cssom/CSSTransformValue.h" | 14 #include "core/css/cssom/CSSTransformValue.h" |
14 #include "core/css/cssom/CSSURLImageValue.h" | 15 #include "core/css/cssom/CSSURLImageValue.h" |
15 #include "core/css/cssom/CSSUnparsedValue.h" | 16 #include "core/css/cssom/CSSUnparsedValue.h" |
16 #include "core/css/cssom/CSSUnsupportedStyleValue.h" | 17 #include "core/css/cssom/CSSUnsupportedStyleValue.h" |
17 | 18 |
18 namespace blink { | 19 namespace blink { |
19 | 20 |
20 namespace { | 21 namespace { |
21 | 22 |
22 CSSStyleValue* CreateStyleValueFromPrimitiveValue( | |
23 const CSSPrimitiveValue& primitive_value) { | |
24 return nullptr; | |
25 } | |
26 | |
27 CSSStyleValue* CreateStyleValueWithPropertyInternal(CSSPropertyID property_id, | 23 CSSStyleValue* CreateStyleValueWithPropertyInternal(CSSPropertyID property_id, |
28 const CSSValue& value) { | 24 const CSSValue& value) { |
29 switch (property_id) { | 25 switch (property_id) { |
30 case CSSPropertyTransform: | 26 case CSSPropertyTransform: |
31 return CSSTransformValue::FromCSSValue(value); | 27 return CSSTransformValue::FromCSSValue(value); |
32 default: | 28 default: |
33 // TODO(meade): Implement other properties. | 29 // TODO(meade): Implement other properties. |
34 break; | 30 break; |
35 } | 31 } |
36 return nullptr; | 32 return nullptr; |
37 } | 33 } |
38 | 34 |
39 CSSStyleValue* CreateStyleValue(const CSSValue& value) { | 35 CSSStyleValue* CreateStyleValue(const CSSValue& value) { |
40 if (value.IsCSSWideKeyword() || value.IsIdentifierValue() || | 36 if (value.IsCSSWideKeyword() || value.IsIdentifierValue() || |
41 value.IsCustomIdentValue()) | 37 value.IsCustomIdentValue()) |
42 return CSSKeywordValue::FromCSSValue(value); | 38 return CSSKeywordValue::FromCSSValue(value); |
43 if (value.IsPrimitiveValue()) | 39 if (value.IsPrimitiveValue()) |
44 return CreateStyleValueFromPrimitiveValue(ToCSSPrimitiveValue(value)); | 40 return CSSNumericValue::FromCSSValue(ToCSSPrimitiveValue(value)); |
45 if (value.IsVariableReferenceValue()) | 41 if (value.IsVariableReferenceValue()) |
46 return CSSUnparsedValue::FromCSSValue(ToCSSVariableReferenceValue(value)); | 42 return CSSUnparsedValue::FromCSSValue(ToCSSVariableReferenceValue(value)); |
47 if (value.IsImageValue()) { | 43 if (value.IsImageValue()) { |
48 return CSSURLImageValue::Create( | 44 return CSSURLImageValue::Create( |
49 ToCSSImageValue(value).ValueWithURLMadeAbsolute()); | 45 ToCSSImageValue(value).ValueWithURLMadeAbsolute()); |
50 } | 46 } |
51 return nullptr; | 47 return nullptr; |
52 } | 48 } |
53 | 49 |
54 CSSStyleValue* CreateStyleValueWithProperty(CSSPropertyID property_id, | 50 CSSStyleValue* CreateStyleValueWithProperty(CSSPropertyID property_id, |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 } | 91 } |
96 return style_value_vector; | 92 return style_value_vector; |
97 } | 93 } |
98 | 94 |
99 CSSStyleValueVector StyleValueFactory::CssValueToStyleValueVector( | 95 CSSStyleValueVector StyleValueFactory::CssValueToStyleValueVector( |
100 const CSSValue& css_value) { | 96 const CSSValue& css_value) { |
101 return CssValueToStyleValueVector(CSSPropertyInvalid, css_value); | 97 return CssValueToStyleValueVector(CSSPropertyInvalid, css_value); |
102 } | 98 } |
103 | 99 |
104 } // namespace blink | 100 } // namespace blink |
OLD | NEW |