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, re | 10 import tempfile, os, re |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 // to distinguish between property not being present in the browser and | 151 // to distinguish between property not being present in the browser and |
152 // not having a value at all. (Ultimately we'll want the native method to | 152 // not having a value at all. (Ultimately we'll want the native method to |
153 // return null if the property doesn't exist and empty string if it's | 153 // return null if the property doesn't exist and empty string if it's |
154 // defined but just doesn't have a value. | 154 // defined but just doesn't have a value. |
155 return _hasProperty(propertyName); | 155 return _hasProperty(propertyName); |
156 $endif | 156 $endif |
157 } | 157 } |
158 | 158 |
159 $if DARTIUM | 159 $if DARTIUM |
160 bool _hasProperty(String propertyName) => | 160 bool _hasProperty(String propertyName) => |
161 $if JSINTEROP | 161 _blink.BlinkCSSStyleDeclaration.instance.$__get___propertyIsEnumerable_Cal
lback_1_(this, propertyName); |
162 _blink.BlinkCSSStyleDeclaration.instance.$__propertyQuery___Callback_1_(th
is, propertyName); | |
163 $else | |
164 _blink.BlinkCSSStyleDeclaration.$__propertyQuery___Callback_1(this, proper
tyName); | |
165 $endif | |
166 $endif | 162 $endif |
167 | 163 |
168 @DomName('CSSStyleDeclaration.setProperty') | 164 @DomName('CSSStyleDeclaration.setProperty') |
169 void setProperty(String propertyName, String value, [String priority]) { | 165 void setProperty(String propertyName, String value, [String priority]) { |
170 return _setPropertyHelper(_browserPropertyName(propertyName), | 166 return _setPropertyHelper(_browserPropertyName(propertyName), |
171 value, priority); | 167 value, priority); |
172 } | 168 } |
173 | 169 |
174 String _browserPropertyName(String propertyName) { | 170 String _browserPropertyName(String propertyName) { |
175 String name = _readCache(propertyName); | 171 String name = _readCache(propertyName); |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 class_lines.append(annotated[base_css_name]) | 355 class_lines.append(annotated[base_css_name]) |
360 class_lines.append(""" | 356 class_lines.append(""" |
361 set %s(String value) { | 357 set %s(String value) { |
362 setProperty('%s', value, ''); | 358 setProperty('%s', value, ''); |
363 } | 359 } |
364 """ % (camel_case_name, css_name)) | 360 """ % (camel_case_name, css_name)) |
365 | 361 |
366 class_file.write(''.join(class_lines)); | 362 class_file.write(''.join(class_lines)); |
367 class_file.write('}\n') | 363 class_file.write('}\n') |
368 class_file.close() | 364 class_file.close() |
OLD | NEW |