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

Unified Diff: tools/dom/scripts/css_code_generator.py

Issue 1062973002: Revert trial commit of "CssStyleDeclaration performance work" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 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: tools/dom/scripts/css_code_generator.py
diff --git a/tools/dom/scripts/css_code_generator.py b/tools/dom/scripts/css_code_generator.py
index 6b07534024522d85f5790970a02c0aa10b5e9304..a290c5fc83d1a253765fe5df0c465876cc127fd1 100644
--- a/tools/dom/scripts/css_code_generator.py
+++ b/tools/dom/scripts/css_code_generator.py
@@ -117,34 +117,14 @@ $endif
@DomName('CSSStyleDeclaration.setProperty')
void setProperty(String propertyName, String value, [String priority]) {
- return _setPropertyHelper(_browserPropertyName(propertyName),
- value, priority);
- }
-
- String _browserPropertyName(String propertyName) {
- String name = _readCache(propertyName);
- if (name is String) return name;
if (_supportsProperty(_camelCase(propertyName))) {
- name = propertyName;
+ return _setPropertyHelper(propertyName, value, priority);
} else {
- name = Device.cssPrefix + propertyName;
+ return _setPropertyHelper(Device.cssPrefix + propertyName, value,
+ priority);
}
- _writeCache(propertyName, name);
- return name;
}
-$if DART2JS
- static final _propertyCache = JS('', '{}');
- static String _readCache(String key) =>
- JS('String|Null', '#[#]', _propertyCache, key);
- static void _writeCache(String key, String value) {
- JS('void', '#[#] = #', _propertyCache, key, value);
- }
-$else
- static String _readCache(String key) => null;
- static void _writeCache(String key, value) {}
-$endif
-
static String _camelCase(String hyphenated) {
$if DART2JS
var replacedMs = JS('String', r'#.replace(/^-ms-/, "ms-")', hyphenated);
@@ -162,9 +142,18 @@ $endif
$if DART2JS
void _setPropertyHelper(String propertyName, String value, [String priority]) {
- if (value == null) value = '';
- if (priority == null) priority = '';
- JS('void', '#.setProperty(#, #, #)', this, propertyName, value, priority);
+ // try/catch for IE9 which throws on unsupported values.
+ try {
+ if (value == null) value = '';
+ if (priority == null) {
+ priority = '';
+ }
+ JS('void', '#.setProperty(#, #, #)', this, propertyName, value, priority);
+ // Bug #2772, IE9 requires a poke to actually apply the value.
+ if (JS('bool', '!!#.setAttribute', this)) {
+ JS('void', '#.setAttribute(#, #)', this, propertyName, value);
+ }
+ } catch (e) {}
}
/**
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | tools/dom/templates/html/impl/impl_CSSStyleDeclaration.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698