82 data = [d.strip()
for d
in data
if not isCommentLine(d)
and not '=' in d]
85 universal_properties = set.intersection(*browser_props)
86 universal_properties = universal_properties.difference([
'cssText'])
87 universal_properties = universal_properties.intersection(
88 list(map(camelCaseName, data)))
90 output_file = open(OUTPUT_FILE,
'w')
92/// Exposing all the extra CSS property getters and setters.
94library dart.css_properties;
96import 'dart:_js_annotations';
97import 'dart:_js_bindings' as js_bindings;
98import 'dart:html_common';
102class CssStyleDeclaration implements js_bindings.CSSStyleDeclaration {}
104extension CssStyleDeclarationView on CssStyleDeclaration {
105 // dart:html requires a `String?` type for `value`.
106 external Object setProperty(String property, String? value,
107 [String? priority = '']);
109 // ##### Universal property getters and setters #####
112 for camelName
in sorted(universal_properties):
114 output_file.write(
"""
115 /** Gets the value of "%s" */
116 String get %s => this._%s;
118 /** Sets the value of "%s" */
119 set %s(String? value) {
120 _%s = value == null ? '' : value;
124 external String get _%s;
127 external set _%s(String value);
128 """ % (property, camelName, camelName, property, camelName, camelName,
129 camelName, camelName, camelName, camelName))
131 output_file.write(
"""
133 // ##### Non-universal property getters and setters #####
140 for prop
in sorted(data, key=camelCaseName):
142 upper_camel_case_name = camel_case_name[0].upper() + camel_case_name[1:]
143 css_name = prop.replace(
'-webkit-',
'')
144 base_css_name = prop.replace(
'-webkit-',
'')
146 if base_css_name
in seen
or base_css_name.startswith(
147 '-internal')
or camel_case_name
in universal_properties:
149 seen.add(base_css_name)
151 comment =
' /** %s the value of "' + base_css_name +
'" */'
152 property_lines.append(
'\n')
153 property_lines.append(comment %
'Gets')
154 if base_css_name
in annotated:
155 property_lines.append(annotated[base_css_name])
156 property_lines.append(
"""
158 getPropertyValue('%s');
160""" % (camel_case_name, css_name))
162 property_lines.append(comment %
'Sets')
163 if base_css_name
in annotated:
164 property_lines.append(annotated[base_css_name])
165 property_lines.append(
"""
166 set %s(String value) {
167 setProperty('%s', value, '');
169""" % (camel_case_name, css_name))
171 output_file.write(
''.join(property_lines))
172 output_file.write(
'}\n')