| OLD | NEW |
| 1 // Copyright (c) 2011, 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 // WARNING: Do not edit. | 5 // WARNING: Do not edit. |
| 6 // This file was generated by html/scripts/css_code_generator.py | 6 // This file was generated by html/scripts/css_code_generator.py |
| 7 | 7 |
| 8 // Source of CSS properties: | 8 // Source of CSS properties: |
| 9 // Source/WebCore/css/CSSPropertyNames.in | 9 // Source/WebCore/css/CSSPropertyNames.in |
| 10 | 10 |
| 11 // TODO(jacobr): add versions that take numeric values in px, miliseconds, etc. | 11 // TODO(jacobr): add versions that take numeric values in px, miliseconds, etc. |
| 12 | 12 |
| 13 class CSSStyleDeclarationWrappingImplementation extends DOMWrapperBase implement
s CSSStyleDeclaration { | 13 class CSSStyleDeclarationWrappingImplementation extends DOMWrapperBase implement
s CSSStyleDeclaration { |
| 14 static String _cachedBrowserPrefix; | 14 static String _cachedBrowserPrefix; |
| 15 /** |
| 16 * The element this style declaration is associated with if any. This |
| 17 * should only be set to a non-null value if modifying this object |
| 18 * will change the associated element. Thus this should not be set for |
| 19 * computed styles. |
| 20 */ |
| 21 final ElementWrappingImplementation _element; |
| 15 | 22 |
| 16 CSSStyleDeclarationWrappingImplementation._wrap(ptr) : super._wrap(ptr) {} | 23 CSSStyleDeclarationWrappingImplementation._wrap(ptr) |
| 24 : super._wrap(ptr), _element = null; |
| 25 CSSStyleDeclarationWrappingImplementation._wrapWithElement( |
| 26 ptr, this._element) : super._wrap(ptr); |
| 17 | 27 |
| 18 factory CSSStyleDeclarationWrappingImplementation.css(String css) { | 28 factory CSSStyleDeclarationWrappingImplementation.css(String css) { |
| 19 var style = new Element.tag('div').style; | 29 var style = new Element.tag('div').style; |
| 20 style.cssText = css; | 30 style.cssText = css; |
| 21 return style; | 31 return style; |
| 22 } | 32 } |
| 23 | 33 |
| 24 factory CSSStyleDeclarationWrappingImplementation() { | 34 factory CSSStyleDeclarationWrappingImplementation() { |
| 25 return new CSSStyleDeclarationWrappingImplementation.css(''); | 35 return new CSSStyleDeclarationWrappingImplementation.css(''); |
| 26 } | 36 } |
| 27 | 37 |
| 28 static String get _browserPrefix() { | 38 static String get _browserPrefix() { |
| 29 if (_cachedBrowserPrefix === null) { | 39 if (_cachedBrowserPrefix === null) { |
| 30 if (_Device.isFirefox) { | 40 if (_Device.isFirefox) { |
| 31 _cachedBrowserPrefix = '-moz-'; | 41 _cachedBrowserPrefix = '-moz-'; |
| 32 } else { | 42 } else { |
| 33 _cachedBrowserPrefix = '-webkit-'; | 43 _cachedBrowserPrefix = '-webkit-'; |
| 34 } | 44 } |
| 35 // TODO(jacobr): support IE 9.0 and Opera as well. | 45 // TODO(jacobr): support IE and Opera as well. |
| 36 } | 46 } |
| 37 return _cachedBrowserPrefix; | 47 return _cachedBrowserPrefix; |
| 38 } | 48 } |
| 39 | 49 |
| 40 String get cssText() { return _ptr.cssText; } | 50 String get cssText() => _ptr.cssText; |
| 41 | 51 |
| 42 void set cssText(String value) { _ptr.cssText = value; } | 52 bool get _inDocument() { |
| 53 return _element !== null && _element._inDocument; |
| 54 } |
| 55 |
| 56 void set cssText(String value) { |
| 57 assert(!_inMeasurementFrame || !_inDocument); |
| 58 _ptr.cssText = value; |
| 59 } |
| 43 | 60 |
| 44 int get length() { return _ptr.length; } | 61 int get length() { return _ptr.length; } |
| 45 | 62 |
| 46 CSSRule get parentRule() { return LevelDom.wrapCSSRule(_ptr.parentRule); } | 63 CSSRule get parentRule() { return LevelDom.wrapCSSRule(_ptr.parentRule); } |
| 47 | 64 |
| 48 CSSValue getPropertyCSSValue(String propertyName) { | 65 CSSValue getPropertyCSSValue(String propertyName) { |
| 49 return LevelDom.wrapCSSValue(_ptr.getPropertyCSSValue(propertyName)); | 66 return LevelDom.wrapCSSValue(_ptr.getPropertyCSSValue(propertyName)); |
| 50 } | 67 } |
| 51 | 68 |
| 52 String getPropertyPriority(String propertyName) { | 69 String getPropertyPriority(String propertyName) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 63 | 80 |
| 64 bool isPropertyImplicit(String propertyName) { | 81 bool isPropertyImplicit(String propertyName) { |
| 65 return _ptr.isPropertyImplicit(propertyName); | 82 return _ptr.isPropertyImplicit(propertyName); |
| 66 } | 83 } |
| 67 | 84 |
| 68 String item(int index) { | 85 String item(int index) { |
| 69 return _ptr.item(index); | 86 return _ptr.item(index); |
| 70 } | 87 } |
| 71 | 88 |
| 72 String removeProperty(String propertyName) { | 89 String removeProperty(String propertyName) { |
| 90 assert(!_inMeasurementFrame || !_inDocument); |
| 73 return _ptr.removeProperty(propertyName); | 91 return _ptr.removeProperty(propertyName); |
| 74 } | 92 } |
| 75 | 93 |
| 76 void setProperty(String propertyName, var value, [String priority = '']) { | 94 void setProperty(String propertyName, var value, [String priority = '']) { |
| 95 assert(!_inMeasurementFrame || !_inDocument); |
| 77 _ptr.setProperty(propertyName, '$value', priority); | 96 _ptr.setProperty(propertyName, '$value', priority); |
| 78 } | 97 } |
| 79 | 98 |
| 80 String get typeName() { return "CSSStyleDeclaration"; } | |
| 81 | |
| 82 | |
| 83 /** Gets the value of "animation" */ | 99 /** Gets the value of "animation" */ |
| 84 String get animation() => | 100 String get animation() => |
| 85 getPropertyValue('${_browserPrefix}animation'); | 101 getPropertyValue('${_browserPrefix}animation'); |
| 86 | 102 |
| 87 /** Sets the value of "animation" */ | 103 /** Sets the value of "animation" */ |
| 88 void set animation(var value) { | 104 void set animation(var value) { |
| 89 setProperty('${_browserPrefix}animation', value, ''); | 105 setProperty('${_browserPrefix}animation', value, ''); |
| 90 } | 106 } |
| 91 | 107 |
| 92 /** Gets the value of "animation-delay" */ | 108 /** Gets the value of "animation-delay" */ |
| (...skipping 2743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2836 | 2852 |
| 2837 /** Gets the value of "zoom" */ | 2853 /** Gets the value of "zoom" */ |
| 2838 String get zoom() => | 2854 String get zoom() => |
| 2839 getPropertyValue('zoom'); | 2855 getPropertyValue('zoom'); |
| 2840 | 2856 |
| 2841 /** Sets the value of "zoom" */ | 2857 /** Sets the value of "zoom" */ |
| 2842 void set zoom(var value) { | 2858 void set zoom(var value) { |
| 2843 setProperty('zoom', value, ''); | 2859 setProperty('zoom', value, ''); |
| 2844 } | 2860 } |
| 2845 } | 2861 } |
| OLD | NEW |