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

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: Update tests Created 4 years, 10 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..ff41b145a401e61f8b3fa6bdffe6cdbae38aaedc 100644
--- a/third_party/WebKit/Source/core/css/cssom/StylePropertyMap.cpp
+++ b/third_party/WebKit/Source/core/css/cssom/StylePropertyMap.cpp
@@ -17,27 +17,55 @@ StyleValue* StylePropertyMap::get(const String& propertyName)
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(cssPropertyID(propertyName));
Timothy Loh 2016/02/09 07:29:32 You probably meant to use propertyID here and all
meade_UTC10 2016/02/10 05:55:39 Done.
+ }
+ // 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(cssPropertyID(propertyName), 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(cssPropertyID(propertyName), 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(cssPropertyID(propertyName), exceptionState);
+ return;
+ }
+ // TODO(meade): Handle custom properties here.
+ exceptionState.throwTypeError("Invalid propertyName: " + propertyName);
}
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698