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

Unified Diff: tools/dom/templates/html/impl/impl_CSSStyleDeclaration.darttemplate

Issue 2976213002: Allow setting unknown CSS properties, e.g. CSS variables (Closed)
Patch Set: Update status files Created 3 years, 5 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 | « tools/dom/scripts/css_code_generator.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/dom/templates/html/impl/impl_CSSStyleDeclaration.darttemplate
diff --git a/tools/dom/templates/html/impl/impl_CSSStyleDeclaration.darttemplate b/tools/dom/templates/html/impl/impl_CSSStyleDeclaration.darttemplate
index 8864506053e49edcf059757abf7c095050817bfe..bb4cd3e84f5dec93aed67d2574eb4ff13b8f38e9 100644
--- a/tools/dom/templates/html/impl/impl_CSSStyleDeclaration.darttemplate
+++ b/tools/dom/templates/html/impl/impl_CSSStyleDeclaration.darttemplate
@@ -28,15 +28,11 @@ $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME $EXTENDS with
/// Please note the property name uses camelCase, not-hyphens.
String getPropertyValue(String propertyName) {
var propValue = _getPropertyValueHelper(propertyName);
- return propValue != null ? propValue : '';
+ return propValue ?? '';
}
String _getPropertyValueHelper(String propertyName) {
- if (_supportsProperty(_camelCase(propertyName))) {
- return _getPropertyValue(propertyName);
- } else {
- return _getPropertyValue(Device.cssPrefix + propertyName);
- }
+ return _getPropertyValue(_browserPropertyName(propertyName));
}
/**
@@ -49,7 +45,7 @@ $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME $EXTENDS with
*/
bool supportsProperty(String propertyName) {
return _supportsProperty(propertyName) ||
- _supportsProperty(_camelCase(Device.cssPrefix + propertyName));
+ _supportsProperty(_camelCase("${Device.cssPrefix}$propertyName"));
}
bool _supportsProperty(String propertyName) {
@@ -79,15 +75,23 @@ $endif
String _browserPropertyName(String propertyName) {
String name = _readCache(propertyName);
if (name is String) return name;
- if (_supportsProperty(_camelCase(propertyName))) {
- name = propertyName;
- } else {
- name = Device.cssPrefix + propertyName;
- }
+ name = _supportedBrowserPropertyName(propertyName);
_writeCache(propertyName, name);
return name;
}
+ String _supportedBrowserPropertyName(String propertyName) {
+ if (_supportsProperty(_camelCase(propertyName))) {
+ return propertyName;
+ }
+ var prefixed = "${Device.cssPrefix}$propertyName";
+ if (_supportsProperty(prefixed)) {
+ return prefixed;
+ }
+ // May be a CSS variable, just use it as provided.
+ return propertyName;
+ }
+
$if DART2JS
static final _propertyCache = JS('', '{}');
static String _readCache(String key) =>
« no previous file with comments | « tools/dom/scripts/css_code_generator.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698