OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # | 2 # |
3 # Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 3 # Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
4 # for details. All rights reserved. Use of this source code is governed by a | 4 # for details. All rights reserved. Use of this source code is governed by a |
5 # BSD-style license that can be found in the LICENSE file. | 5 # BSD-style license that can be found in the LICENSE file. |
6 | 6 |
7 """Generates CSSStyleDeclaration template file from css property definitions | 7 """Generates CSSStyleDeclaration template file from css property definitions |
8 defined in WebKit.""" | 8 defined in WebKit.""" |
9 | 9 |
10 import tempfile, os | 10 import tempfile, os |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 // to distinguish between property not being present in the browser and | 105 // to distinguish between property not being present in the browser and |
106 // not having a value at all. (Ultimately we'll want the native method to | 106 // not having a value at all. (Ultimately we'll want the native method to |
107 // return null if the property doesn't exist and empty string if it's | 107 // return null if the property doesn't exist and empty string if it's |
108 // defined but just doesn't have a value. | 108 // defined but just doesn't have a value. |
109 return _hasProperty(propertyName); | 109 return _hasProperty(propertyName); |
110 $endif | 110 $endif |
111 } | 111 } |
112 $if DARTIUM | 112 $if DARTIUM |
113 | 113 |
114 bool _hasProperty(String propertyName) => | 114 bool _hasProperty(String propertyName) => |
115 _blink.BlinkCSSStyleDeclaration.$__propertyQuery___Callback(this, property
Name); | 115 _blink.BlinkCSSStyleDeclaration.$__propertyQuery___Callback_DOMString(this
, propertyName); |
116 $endif | 116 $endif |
117 | 117 |
118 @DomName('CSSStyleDeclaration.setProperty') | 118 @DomName('CSSStyleDeclaration.setProperty') |
119 void setProperty(String propertyName, String value, [String priority]) { | 119 void setProperty(String propertyName, String value, [String priority]) { |
120 if (_supportsProperty(_camelCase(propertyName))) { | 120 if (_supportsProperty(_camelCase(propertyName))) { |
121 return _setPropertyHelper(propertyName, value, priority); | 121 return _setPropertyHelper(propertyName, value, priority); |
122 } else { | 122 } else { |
123 return _setPropertyHelper(Device.cssPrefix + propertyName, value, | 123 return _setPropertyHelper(Device.cssPrefix + propertyName, value, |
124 priority); | 124 priority); |
125 } | 125 } |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 class_lines.append(annotated[base_css_name]) | 236 class_lines.append(annotated[base_css_name]) |
237 class_lines.append(""" | 237 class_lines.append(""" |
238 void set %s(String value) { | 238 void set %s(String value) { |
239 setProperty('%s', value, ''); | 239 setProperty('%s', value, ''); |
240 } | 240 } |
241 """ % (camel_case_name, css_name)) | 241 """ % (camel_case_name, css_name)) |
242 | 242 |
243 class_file.write(''.join(class_lines)); | 243 class_file.write(''.join(class_lines)); |
244 class_file.write('}\n') | 244 class_file.write('}\n') |
245 class_file.close() | 245 class_file.close() |
OLD | NEW |