Chromium Code Reviews| Index: third_party/WebKit/Source/core/css/cssom/StylePropertyMap.cpp |
| diff --git a/third_party/WebKit/Source/core/css/cssom/StylePropertyMap.cpp b/third_party/WebKit/Source/core/css/cssom/StylePropertyMap.cpp |
| index 68bfe8094181344a7dbcff8c5b65680fdaff3b7f..6509ed41c8a970e33086deacab30e316dc04d570 100644 |
| --- a/third_party/WebKit/Source/core/css/cssom/StylePropertyMap.cpp |
| +++ b/third_party/WebKit/Source/core/css/cssom/StylePropertyMap.cpp |
| @@ -12,32 +12,65 @@ namespace blink { |
| StyleValue* StylePropertyMap::get(const String& propertyName) |
| { |
| - return get(cssPropertyID(propertyName)); |
| + CSSPropertyID propertyID = cssPropertyID(propertyName); |
| + if (propertyID != CSSPropertyInvalid) { |
| + return get(propertyID); |
| + } |
| + // TODO(meade): Handle custom properties here. |
| + return nullptr; |
| } |
| HeapVector<Member<StyleValue>> StylePropertyMap::getAll(const String& propertyName) |
| { |
| - return getAll(cssPropertyID(propertyName)); |
| + CSSPropertyID propertyID = cssPropertyID(propertyName); |
| + if (propertyID != CSSPropertyInvalid) { |
| + return getAll(propertyID); |
| + } |
| + // TODO(meade): Handle custom properties here. |
| + return HeapVector<Member<StyleValue>>(); |
| } |
| bool StylePropertyMap::has(const String& propertyName) |
| { |
| - return has(cssPropertyID(propertyName)); |
| + CSSPropertyID propertyID = cssPropertyID(propertyName); |
| + if (propertyID != CSSPropertyInvalid) { |
| + return has(propertyID); |
| + } |
| + // TODO(meade): Handle custom properties here. |
| + return false; |
| } |
| void StylePropertyMap::set(const String& propertyName, StyleValueOrStyleValueSequenceOrString& item, ExceptionState& exceptionState) |
| { |
| - set(cssPropertyID(propertyName), item, exceptionState); |
| + CSSPropertyID propertyID = cssPropertyID(propertyName); |
| + if (propertyID != CSSPropertyInvalid) { |
| + set(propertyID, item, exceptionState); |
| + return; |
| + } |
| + // TODO(meade): Handle custom properties here. |
| + exceptionState.throwTypeError("Invalid propertyName: " + propertyName); |
|
Timothy Loh
2016/03/23 03:45:09
Why do only some of these have exceptions? Are we
meade_UTC10
2016/03/29 06:27:37
Dunno. Probably assumed that setting something tha
|
| } |
| void StylePropertyMap::append(const String& propertyName, StyleValueOrStyleValueSequenceOrString& item, ExceptionState& exceptionState) |
| { |
| - append(cssPropertyID(propertyName), item, exceptionState); |
| + CSSPropertyID propertyID = cssPropertyID(propertyName); |
| + if (propertyID != CSSPropertyInvalid) { |
| + append(propertyID, item, exceptionState); |
| + return; |
| + } |
| + // TODO(meade): Handle custom properties here. |
| + exceptionState.throwTypeError("Invalid propertyName: " + propertyName); |
| } |
| void StylePropertyMap::remove(const String& propertyName, ExceptionState& exceptionState) |
| { |
| - remove(cssPropertyID(propertyName), exceptionState); |
| + CSSPropertyID propertyID = cssPropertyID(propertyName); |
| + if (propertyID != CSSPropertyInvalid) { |
| + remove(propertyID, exceptionState); |
| + return; |
| + } |
| + // TODO(meade): Handle custom properties here. |
| + exceptionState.throwTypeError("Invalid propertyName: " + propertyName); |
| } |
| } // namespace blink |