| 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 String _cachedBrowserPrefix; | 7 String _cachedBrowserPrefix; |
| 8 | 8 |
| 9 String get _browserPrefix { | 9 String get _browserPrefix { |
| 10 if (_cachedBrowserPrefix == null) { | 10 if (_cachedBrowserPrefix == null) { |
| 11 if (_Device.isFirefox) { | 11 if (_Device.isFirefox) { |
| 12 _cachedBrowserPrefix = '-moz-'; | 12 _cachedBrowserPrefix = '-moz-'; |
| 13 } else if (_Device.isIE) { | 13 } else if (_Device.isIE) { |
| 14 _cachedBrowserPrefix = '-ms-'; | 14 _cachedBrowserPrefix = '-ms-'; |
| 15 } else if (_Device.isOpera) { | 15 } else if (_Device.isOpera) { |
| 16 _cachedBrowserPrefix = '-o-'; | 16 _cachedBrowserPrefix = '-o-'; |
| 17 } else { | 17 } else { |
| 18 _cachedBrowserPrefix = '-webkit-'; | 18 _cachedBrowserPrefix = '-webkit-'; |
| 19 } | 19 } |
| 20 } | 20 } |
| 21 return _cachedBrowserPrefix; | 21 return _cachedBrowserPrefix; |
| 22 } | 22 } |
| 23 | 23 |
| 24 String _cachedBrowserPropertyPrefix; |
| 25 |
| 26 /// Prefix as used for JS property names. |
| 27 String get _browserPropertyPrefix { |
| 28 if (_cachedBrowserPropertyPrefix == null) { |
| 29 if (_Device.isFirefox) { |
| 30 _cachedBrowserPropertyPrefix = 'moz'; |
| 31 } else if (_Device.isIE) { |
| 32 _cachedBrowserPropertyPrefix = 'ms'; |
| 33 } else if (_Device.isOpera) { |
| 34 _cachedBrowserPropertyPrefix = 'o'; |
| 35 } else { |
| 36 _cachedBrowserPropertyPrefix = 'webkit'; |
| 37 } |
| 38 } |
| 39 return _cachedBrowserPropertyPrefix; |
| 40 } |
| 41 |
| 24 $(ANNOTATIONS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { | 42 $(ANNOTATIONS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { |
| 25 factory $CLASSNAME() => _$(CLASSNAME)FactoryProvider.create$CLASSNAME(); | 43 factory $CLASSNAME() => _$(CLASSNAME)FactoryProvider.create$CLASSNAME(); |
| 26 factory $CLASSNAME.css(String css) => | 44 factory $CLASSNAME.css(String css) => |
| 27 _$(CLASSNAME)FactoryProvider.create$(CLASSNAME)_css(css); | 45 _$(CLASSNAME)FactoryProvider.create$(CLASSNAME)_css(css); |
| 28 | 46 |
| 29 $!MEMBERS | 47 $!MEMBERS |
| 30 | 48 |
| 31 String getPropertyValue(String propertyName) { | 49 String getPropertyValue(String propertyName) { |
| 32 var propValue = _getPropertyValue(propertyName); | 50 var propValue = _getPropertyValue(propertyName); |
| 33 return propValue != null ? propValue : ''; | 51 return propValue != null ? propValue : ''; |
| 34 } | 52 } |
| 35 | 53 |
| 36 $if DART2JS | 54 $if DART2JS |
| 37 void setProperty(String propertyName, String value, [String priority]) { | 55 void setProperty(String propertyName, String value, [String priority]) { |
| 38 JS('void', '#.setProperty(#, #, #)', this, propertyName, value, priority); | 56 JS('void', '#.setProperty(#, #, #)', this, propertyName, value, priority); |
| 39 // Bug #2772, IE9 requires a poke to actually apply the value. | 57 // Bug #2772, IE9 requires a poke to actually apply the value. |
| 40 if (JS('bool', '!!#.setAttribute', this)) { | 58 if (JS('bool', '!!#.setAttribute', this)) { |
| 41 JS('void', '#.setAttribute(#, #)', this, propertyName, value); | 59 JS('void', '#.setAttribute(#, #)', this, propertyName, value); |
| 42 } | 60 } |
| 43 } | 61 } |
| 62 |
| 63 /** |
| 64 * Checks to see if CSS Transitions are supported. |
| 65 */ |
| 66 static bool get supportsTransitions { |
| 67 if (JS('bool', '"transition" in document.body.style')) { |
| 68 return true; |
| 69 } |
| 70 var propertyName = '${_browserPropertyPrefix}Transition'; |
| 71 return JS('bool', '# in document.body.style', propertyName); |
| 72 } |
| 73 $else |
| 74 /** |
| 75 * Checks to see if CSS Transitions are supported. |
| 76 */ |
| 77 static bool get supportsTransitions => true; |
| 44 $endif | 78 $endif |
| 45 | 79 |
| 46 // TODO(jacobr): generate this list of properties using the existing script. | 80 // TODO(jacobr): generate this list of properties using the existing script. |
| 47 /** Gets the value of "align-content" */ | 81 /** Gets the value of "align-content" */ |
| 48 String get alignContent => | 82 String get alignContent => |
| 49 getPropertyValue('${_browserPrefix}align-content'); | 83 getPropertyValue('${_browserPrefix}align-content'); |
| 50 | 84 |
| 51 /** Sets the value of "align-content" */ | 85 /** Sets the value of "align-content" */ |
| 52 void set alignContent(String value) { | 86 void set alignContent(String value) { |
| 53 setProperty('${_browserPrefix}align-content', value, ''); | 87 setProperty('${_browserPrefix}align-content', value, ''); |
| (...skipping 2909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2963 /** Gets the value of "transform-style" */ | 2997 /** Gets the value of "transform-style" */ |
| 2964 String get transformStyle => | 2998 String get transformStyle => |
| 2965 getPropertyValue('${_browserPrefix}transform-style'); | 2999 getPropertyValue('${_browserPrefix}transform-style'); |
| 2966 | 3000 |
| 2967 /** Sets the value of "transform-style" */ | 3001 /** Sets the value of "transform-style" */ |
| 2968 void set transformStyle(String value) { | 3002 void set transformStyle(String value) { |
| 2969 setProperty('${_browserPrefix}transform-style', value, ''); | 3003 setProperty('${_browserPrefix}transform-style', value, ''); |
| 2970 } | 3004 } |
| 2971 | 3005 |
| 2972 /** Gets the value of "transition" */ | 3006 /** Gets the value of "transition" */ |
| 3007 @SupportedBrowser(SupportedBrowser.CHROME) |
| 3008 @SupportedBrowser(SupportedBrowser.FIREFOX) |
| 3009 @SupportedBrowser(SupportedBrowser.IE, '10') |
| 3010 @SupportedBrowser(SupportedBrowser.SAFARI) |
| 2973 String get transition => | 3011 String get transition => |
| 2974 getPropertyValue('${_browserPrefix}transition'); | 3012 getPropertyValue('${_browserPrefix}transition'); |
| 2975 | 3013 |
| 2976 /** Sets the value of "transition" */ | 3014 /** Sets the value of "transition" */ |
| 3015 @SupportedBrowser(SupportedBrowser.CHROME) |
| 3016 @SupportedBrowser(SupportedBrowser.FIREFOX) |
| 3017 @SupportedBrowser(SupportedBrowser.IE, '10') |
| 3018 @SupportedBrowser(SupportedBrowser.SAFARI) |
| 2977 void set transition(String value) { | 3019 void set transition(String value) { |
| 2978 setProperty('${_browserPrefix}transition', value, ''); | 3020 setProperty('${_browserPrefix}transition', value, ''); |
| 2979 } | 3021 } |
| 2980 | 3022 |
| 2981 /** Gets the value of "transition-delay" */ | 3023 /** Gets the value of "transition-delay" */ |
| 2982 String get transitionDelay => | 3024 String get transitionDelay => |
| 2983 getPropertyValue('${_browserPrefix}transition-delay'); | 3025 getPropertyValue('${_browserPrefix}transition-delay'); |
| 2984 | 3026 |
| 2985 /** Sets the value of "transition-delay" */ | 3027 /** Sets the value of "transition-delay" */ |
| 2986 void set transitionDelay(String value) { | 3028 void set transitionDelay(String value) { |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3187 | 3229 |
| 3188 /** Gets the value of "zoom" */ | 3230 /** Gets the value of "zoom" */ |
| 3189 String get zoom => | 3231 String get zoom => |
| 3190 getPropertyValue('zoom'); | 3232 getPropertyValue('zoom'); |
| 3191 | 3233 |
| 3192 /** Sets the value of "zoom" */ | 3234 /** Sets the value of "zoom" */ |
| 3193 void set zoom(String value) { | 3235 void set zoom(String value) { |
| 3194 setProperty('zoom', value, ''); | 3236 setProperty('zoom', value, ''); |
| 3195 } | 3237 } |
| 3196 } | 3238 } |
| OLD | NEW |