| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 part of $LIBRARYNAME; | 5 part of $LIBRARYNAME; |
| 6 | 6 |
| 7 $(ANNOTATIONS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { | 7 $(ANNOTATIONS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { |
| 8 factory $CLASSNAME() => _$(CLASSNAME)FactoryProvider.create$CLASSNAME(); | 8 factory $CLASSNAME() => _$(CLASSNAME)FactoryProvider.create$CLASSNAME(); |
| 9 factory $CLASSNAME.css(String css) => | 9 factory $CLASSNAME.css(String css) => |
| 10 _$(CLASSNAME)FactoryProvider.create$(CLASSNAME)_css(css); | 10 _$(CLASSNAME)FactoryProvider.create$(CLASSNAME)_css(css); |
| 11 | 11 |
| 12 $!MEMBERS | 12 $!MEMBERS |
| 13 | 13 |
| 14 String getPropertyValue(String propertyName) { | 14 String getPropertyValue(String propertyName) { |
| 15 var propValue = _getPropertyValue(propertyName); | 15 var propValue = _getPropertyValue(propertyName); |
| 16 return propValue != null ? propValue : ''; | 16 return propValue != null ? propValue : ''; |
| 17 } | 17 } |
| 18 | 18 |
| 19 $if DART2JS | 19 $if DART2JS |
| 20 @DomName('CSSStyleDeclaration.setProperty') |
| 20 void setProperty(String propertyName, String value, [String priority]) { | 21 void setProperty(String propertyName, String value, [String priority]) { |
| 21 // try/catch for IE9 which throws on unsupported values. | 22 // try/catch for IE9 which throws on unsupported values. |
| 22 try { | 23 try { |
| 24 if (priority == null) { |
| 25 priority = ''; |
| 26 } |
| 23 JS('void', '#.setProperty(#, #, #)', this, propertyName, value, priority); | 27 JS('void', '#.setProperty(#, #, #)', this, propertyName, value, priority); |
| 24 // Bug #2772, IE9 requires a poke to actually apply the value. | 28 // Bug #2772, IE9 requires a poke to actually apply the value. |
| 25 if (JS('bool', '!!#.setAttribute', this)) { | 29 if (JS('bool', '!!#.setAttribute', this)) { |
| 26 JS('void', '#.setAttribute(#, #)', this, propertyName, value); | 30 JS('void', '#.setAttribute(#, #)', this, propertyName, value); |
| 27 } | 31 } |
| 28 } catch (e) {} | 32 } catch (e) {} |
| 29 } | 33 } |
| 30 | 34 |
| 31 /** | 35 /** |
| 32 * Checks to see if CSS Transitions are supported. | 36 * Checks to see if CSS Transitions are supported. |
| 33 */ | 37 */ |
| 34 static bool get supportsTransitions { | 38 static bool get supportsTransitions { |
| 35 if (JS('bool', '"transition" in document.body.style')) { | 39 if (JS('bool', '"transition" in document.body.style')) { |
| 36 return true; | 40 return true; |
| 37 } | 41 } |
| 38 var propertyName = '${Device.propertyPrefix}Transition'; | 42 var propertyName = '${Device.propertyPrefix}Transition'; |
| 39 return JS('bool', '# in document.body.style', propertyName); | 43 return JS('bool', '# in document.body.style', propertyName); |
| 40 } | 44 } |
| 41 $else | 45 $else |
| 42 /** | 46 /** |
| 43 * Checks to see if CSS Transitions are supported. | 47 * Checks to see if CSS Transitions are supported. |
| 44 */ | 48 */ |
| 45 static bool get supportsTransitions => true; | 49 static bool get supportsTransitions => true; |
| 50 |
| 51 @DomName('CSSStyleDeclaration.setProperty') |
| 52 void setProperty(String propertyName, String value, [String priority]) { |
| 53 if (priority == null) { |
| 54 priority = ''; |
| 55 } |
| 56 _setProperty(propertyName, value, priority); |
| 57 } |
| 46 $endif | 58 $endif |
| 47 | 59 |
| 48 // TODO(jacobr): generate this list of properties using the existing script. | 60 // TODO(jacobr): generate this list of properties using the existing script. |
| 49 /** Gets the value of "align-content" */ | 61 /** Gets the value of "align-content" */ |
| 50 String get alignContent => | 62 String get alignContent => |
| 51 getPropertyValue('${Device.cssPrefix}align-content'); | 63 getPropertyValue('${Device.cssPrefix}align-content'); |
| 52 | 64 |
| 53 /** Sets the value of "align-content" */ | 65 /** Sets the value of "align-content" */ |
| 54 void set alignContent(String value) { | 66 void set alignContent(String value) { |
| 55 setProperty('${Device.cssPrefix}align-content', value, ''); | 67 setProperty('${Device.cssPrefix}align-content', value, ''); |
| (...skipping 3141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3197 | 3209 |
| 3198 /** Gets the value of "zoom" */ | 3210 /** Gets the value of "zoom" */ |
| 3199 String get zoom => | 3211 String get zoom => |
| 3200 getPropertyValue('zoom'); | 3212 getPropertyValue('zoom'); |
| 3201 | 3213 |
| 3202 /** Sets the value of "zoom" */ | 3214 /** Sets the value of "zoom" */ |
| 3203 void set zoom(String value) { | 3215 void set zoom(String value) { |
| 3204 setProperty('zoom', value, ''); | 3216 setProperty('zoom', value, ''); |
| 3205 } | 3217 } |
| 3206 } | 3218 } |
| OLD | NEW |