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

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

Issue 2791193004: [Typed CSSOM] New design for computed styles which includes custom properties (Closed)
Patch Set: Make UpdateStyle non-const Created 3 years, 7 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
« no previous file with comments | « third_party/WebKit/Source/core/css/cssom/ComputedStylePropertyMap.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/css/cssom/StylePropertyMapReadonly.cpp
diff --git a/third_party/WebKit/Source/core/css/cssom/StylePropertyMapReadonly.cpp b/third_party/WebKit/Source/core/css/cssom/StylePropertyMapReadonly.cpp
index c4c19cba7e1f302019d5c78031ee60f2470ba0c8..4d8dbee616fa61618a7466f5817911c8de9b0c68 100644
--- a/third_party/WebKit/Source/core/css/cssom/StylePropertyMapReadonly.cpp
+++ b/third_party/WebKit/Source/core/css/cssom/StylePropertyMapReadonly.cpp
@@ -51,41 +51,24 @@ class StylePropertyMapIterationSource final
CSSStyleValue* StylePropertyMapReadonly::get(const String& property_name,
ExceptionState& exception_state) {
- CSSPropertyID property_id = cssPropertyID(property_name);
- if (property_id == CSSPropertyInvalid || property_id == CSSPropertyVariable) {
- // TODO(meade): Handle custom properties here.
- exception_state.ThrowTypeError("Invalid propertyName: " + property_name);
- return nullptr;
- }
-
- CSSStyleValueVector style_vector = GetAllInternal(property_id);
- if (style_vector.IsEmpty())
- return nullptr;
-
- return style_vector[0];
+ CSSStyleValueVector style_vector = getAll(property_name, exception_state);
+ return style_vector.IsEmpty() ? nullptr : style_vector[0];
}
CSSStyleValueVector StylePropertyMapReadonly::getAll(
const String& property_name,
ExceptionState& exception_state) {
CSSPropertyID property_id = cssPropertyID(property_name);
- if (property_id != CSSPropertyInvalid && property_id != CSSPropertyVariable)
- return GetAllInternal(property_id);
-
- // TODO(meade): Handle custom properties here.
- exception_state.ThrowTypeError("Invalid propertyName: " + property_name);
- return CSSStyleValueVector();
+ if (property_id == CSSPropertyInvalid)
+ exception_state.ThrowTypeError("Invalid propertyName: " + property_name);
+ if (property_id == CSSPropertyVariable)
+ return GetAllInternal(AtomicString(property_name));
+ return GetAllInternal(property_id);
}
bool StylePropertyMapReadonly::has(const String& property_name,
ExceptionState& exception_state) {
- CSSPropertyID property_id = cssPropertyID(property_name);
- if (property_id != CSSPropertyInvalid && property_id != CSSPropertyVariable)
- return !GetAllInternal(property_id).IsEmpty();
-
- // TODO(meade): Handle custom properties here.
- exception_state.ThrowTypeError("Invalid propertyName: " + property_name);
- return false;
+ return !getAll(property_name, exception_state).IsEmpty();
}
StylePropertyMapReadonly::IterationSource*
« no previous file with comments | « third_party/WebKit/Source/core/css/cssom/ComputedStylePropertyMap.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698