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

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: tidy up Created 3 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/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 10be8c3120485252880f978c7dc5cb8ef377e24d..6bb2012db854fec599e7a6a921598de22dbf1176 100644
--- a/third_party/WebKit/Source/core/css/cssom/StylePropertyMapReadonly.cpp
+++ b/third_party/WebKit/Source/core/css/cssom/StylePropertyMapReadonly.cpp
@@ -51,41 +51,26 @@ class StylePropertyMapIterationSource final
CSSStyleValue* StylePropertyMapReadonly::get(const String& propertyName,
ExceptionState& exceptionState) {
- CSSPropertyID propertyID = cssPropertyID(propertyName);
- if (propertyID == CSSPropertyInvalid || propertyID == CSSPropertyVariable) {
- // TODO(meade): Handle custom properties here.
- exceptionState.throwTypeError("Invalid propertyName: " + propertyName);
- return nullptr;
- }
-
- CSSStyleValueVector styleVector = getAllInternal(propertyID);
- if (styleVector.isEmpty())
- return nullptr;
-
- return styleVector[0];
+ CSSStyleValueVector styleVector = getAll(propertyName, exceptionState);
+ return styleVector.isEmpty() ? nullptr : styleVector[0];
}
CSSStyleValueVector StylePropertyMapReadonly::getAll(
const String& propertyName,
ExceptionState& exceptionState) {
CSSPropertyID propertyID = cssPropertyID(propertyName);
- if (propertyID != CSSPropertyInvalid && propertyID != CSSPropertyVariable)
- return getAllInternal(propertyID);
-
- // TODO(meade): Handle custom properties here.
- exceptionState.throwTypeError("Invalid propertyName: " + propertyName);
- return CSSStyleValueVector();
+ if (propertyID == CSSPropertyInvalid) {
+ exceptionState.throwTypeError("Invalid propertyName: " + propertyName);
+ return CSSStyleValueVector();
+ }
+ if (propertyID == CSSPropertyVariable)
+ return getAllInternal(AtomicString(propertyName), exceptionState);
+ return getAllInternal(propertyID);
}
bool StylePropertyMapReadonly::has(const String& propertyName,
ExceptionState& exceptionState) {
- CSSPropertyID propertyID = cssPropertyID(propertyName);
- if (propertyID != CSSPropertyInvalid && propertyID != CSSPropertyVariable)
- return !getAllInternal(propertyID).isEmpty();
-
- // TODO(meade): Handle custom properties here.
- exceptionState.throwTypeError("Invalid propertyName: " + propertyName);
- return false;
+ return !getAll(propertyName, exceptionState).isEmpty();
}
StylePropertyMapReadonly::IterationSource*

Powered by Google App Engine
This is Rietveld 408576698