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/StylePropertyMap.h" | 5 #include "core/css/cssom/StylePropertyMap.h" |
6 | 6 |
7 #include "bindings/core/v8/ExceptionState.h" | 7 #include "bindings/core/v8/ExceptionState.h" |
8 #include "core/css/CSSValueList.h" | 8 #include "core/css/CSSValueList.h" |
9 #include "core/css/cssom/CSSSimpleLength.h" | 9 #include "core/css/cssom/CSSSimpleLength.h" |
10 #include "core/css/cssom/StyleValue.h" | 10 #include "core/css/cssom/StyleValue.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 | 36 |
37 // TODO(meade): Handle custom properties here. | 37 // TODO(meade): Handle custom properties here. |
38 exceptionState.throwTypeError("Invalid propertyName: " + propertyName); | 38 exceptionState.throwTypeError("Invalid propertyName: " + propertyName); |
39 return StyleValueVector(); | 39 return StyleValueVector(); |
40 } | 40 } |
41 | 41 |
42 bool StylePropertyMap::has(const String& propertyName, ExceptionState& exception
State) | 42 bool StylePropertyMap::has(const String& propertyName, ExceptionState& exception
State) |
43 { | 43 { |
44 CSSPropertyID propertyID = cssPropertyID(propertyName); | 44 CSSPropertyID propertyID = cssPropertyID(propertyName); |
45 if (propertyID != CSSPropertyInvalid) | 45 if (propertyID != CSSPropertyInvalid) |
46 return has(propertyID); | 46 return !getAll(propertyID).isEmpty(); |
47 | 47 |
48 // TODO(meade): Handle custom properties here. | 48 // TODO(meade): Handle custom properties here. |
49 exceptionState.throwTypeError("Invalid propertyName: " + propertyName); | 49 exceptionState.throwTypeError("Invalid propertyName: " + propertyName); |
50 return false; | 50 return false; |
51 } | 51 } |
52 | 52 |
53 void StylePropertyMap::set(const String& propertyName, StyleValueOrStyleValueSeq
uenceOrString& item, ExceptionState& exceptionState) | 53 void StylePropertyMap::set(const String& propertyName, StyleValueOrStyleValueSeq
uenceOrString& item, ExceptionState& exceptionState) |
54 { | 54 { |
55 CSSPropertyID propertyID = cssPropertyID(propertyName); | 55 CSSPropertyID propertyID = cssPropertyID(propertyName); |
56 if (propertyID != CSSPropertyInvalid) { | 56 if (propertyID != CSSPropertyInvalid) { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 for (CSSValue* value : *toCSSValueList(&cssValue)) { | 97 for (CSSValue* value : *toCSSValueList(&cssValue)) { |
98 StyleValue* styleValue = StyleValueFactory::create(propertyID, *value); | 98 StyleValue* styleValue = StyleValueFactory::create(propertyID, *value); |
99 if (!styleValue) | 99 if (!styleValue) |
100 return StyleValueVector(); | 100 return StyleValueVector(); |
101 styleValueVector.append(styleValue); | 101 styleValueVector.append(styleValue); |
102 } | 102 } |
103 return styleValueVector; | 103 return styleValueVector; |
104 } | 104 } |
105 | 105 |
106 } // namespace blink | 106 } // namespace blink |
OLD | NEW |