Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(154)

Side by Side Diff: tools/dom/scripts/css_code_generator.py

Issue 2705213003: Refined types for most HtmlElement factory constructors (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sdk/lib/svg/dartium/svg_dartium.dart ('k') | tools/dom/scripts/htmldartgenerator.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 part of $LIBRARYNAME; 100 part of $LIBRARYNAME;
101 """ % SOURCE_PATH) 101 """ % SOURCE_PATH)
102 102
103 103
104 class_file.write(""" 104 class_file.write("""
105 $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME $EXTENDS with 105 $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME $EXTENDS with
106 $(CLASSNAME)Base $IMPLEMENTS { 106 $(CLASSNAME)Base $IMPLEMENTS {
107 factory $CLASSNAME() => new CssStyleDeclaration.css(''); 107 factory $CLASSNAME() => new CssStyleDeclaration.css('');
108 108
109 factory $CLASSNAME.css(String css) { 109 factory $CLASSNAME.css(String css) {
110 final style = new Element.tag('div').style; 110 final style = new DivElement().style;
111 style.cssText = css; 111 style.cssText = css;
112 return style; 112 return style;
113 } 113 }
114 114
115 /// Returns the value of the property if the provided *CSS* property 115 /// Returns the value of the property if the provided *CSS* property
116 /// name is supported on this element and if the value is set. Otherwise 116 /// name is supported on this element and if the value is set. Otherwise
117 /// returns an empty string. 117 /// returns an empty string.
118 /// 118 ///
119 /// Please note the property name uses camelCase, not-hyphens. 119 /// Please note the property name uses camelCase, not-hyphens.
120 String getPropertyValue(String propertyName) { 120 String getPropertyValue(String propertyName) {
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 class_lines.append(annotated[base_css_name]) 359 class_lines.append(annotated[base_css_name])
360 class_lines.append(""" 360 class_lines.append("""
361 set %s(String value) { 361 set %s(String value) {
362 setProperty('%s', value, ''); 362 setProperty('%s', value, '');
363 } 363 }
364 """ % (camel_case_name, css_name)) 364 """ % (camel_case_name, css_name))
365 365
366 class_file.write(''.join(class_lines)); 366 class_file.write(''.join(class_lines));
367 class_file.write('}\n') 367 class_file.write('}\n')
368 class_file.close() 368 class_file.close()
OLDNEW
« no previous file with comments | « sdk/lib/svg/dartium/svg_dartium.dart ('k') | tools/dom/scripts/htmldartgenerator.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698