Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(114)

Unified Diff: third_party/WebKit/Source/core/css/cssom/StylePropertyMap.cpp

Issue 1590193002: Partial implementation of inline StylePropertyMap. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@maps
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..5f4bcc3cd22f339823ee21d6b6b19639906215c4 100644
--- a/third_party/WebKit/Source/core/css/cssom/StylePropertyMap.cpp
+++ b/third_party/WebKit/Source/core/css/cssom/StylePropertyMap.cpp
@@ -10,34 +10,70 @@
namespace blink {
-StyleValue* StylePropertyMap::get(const String& propertyName)
+StyleValue* StylePropertyMap::get(const String& propertyName, ExceptionState& exceptionState)
{
- return get(cssPropertyID(propertyName));
+ CSSPropertyID propertyID = cssPropertyID(propertyName);
+ if (propertyID != CSSPropertyInvalid)
+ return get(propertyID);
+
+ // TODO(meade): Handle custom properties here.
+ exceptionState.throwTypeError("Invalid propertyName: " + propertyName);
+ return nullptr;
}
-HeapVector<Member<StyleValue>> StylePropertyMap::getAll(const String& propertyName)
+HeapVector<Member<StyleValue>> StylePropertyMap::getAll(const String& propertyName, ExceptionState& exceptionState)
{
- return getAll(cssPropertyID(propertyName));
+ CSSPropertyID propertyID = cssPropertyID(propertyName);
+ if (propertyID != CSSPropertyInvalid)
+ return getAll(propertyID);
+
+ // TODO(meade): Handle custom properties here.
+ exceptionState.throwTypeError("Invalid propertyName: " + propertyName);
+ return HeapVector<Member<StyleValue>>();
}
-bool StylePropertyMap::has(const String& propertyName)
+bool StylePropertyMap::has(const String& propertyName, ExceptionState& exceptionState)
{
- return has(cssPropertyID(propertyName));
+ CSSPropertyID propertyID = cssPropertyID(propertyName);
+ if (propertyID != CSSPropertyInvalid)
+ return has(propertyID);
+
+ // TODO(meade): Handle custom properties here.
+ exceptionState.throwTypeError("Invalid propertyName: " + propertyName);
+ 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);
}
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

Powered by Google App Engine
This is Rietveld 408576698