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

Side by Side Diff: core/scripts/make_css_property_names.py

Issue 15643014: Blink IDL roll. (Closed) Base URL: http://dart.googlecode.com/svn/third_party/WebCore/
Patch Set: Created 7 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « core/scripts/in_generator.py ('k') | core/scripts/make_css_value_keywords.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/env python 1 #!/usr/bin/env python
2 2
3 import os.path 3 import os.path
4 import re 4 import re
5 import subprocess 5 import subprocess
6 import sys 6 import sys
7 7
8 from in_file import InFile 8 from in_file import InFile
9 import in_generator 9 import in_generator
10 import license 10 import license
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 164
165 class CSSPropertiesWriter(in_generator.Writer): 165 class CSSPropertiesWriter(in_generator.Writer):
166 class_name = "CSSPropertyNames" 166 class_name = "CSSPropertyNames"
167 defaults = { 167 defaults = {
168 'alias_for': None, 168 'alias_for': None,
169 'condition': None, 169 'condition': None,
170 } 170 }
171 171
172 def __init__(self, file_paths, enabled_conditions): 172 def __init__(self, file_paths, enabled_conditions):
173 in_generator.Writer.__init__(self, file_paths, enabled_conditions) 173 in_generator.Writer.__init__(self, file_paths, enabled_conditions)
174 self._outputs = {(self.class_name + ".h"): self.generate_header,
175 (self.class_name + ".cpp"): self.generate_implementatio n,
176 }
174 177
175 all_properties = self.in_file.name_dictionaries 178 all_properties = self.in_file.name_dictionaries
176 self._aliases = filter(lambda property: property['alias_for'], all_prope rties) 179 self._aliases = filter(lambda property: property['alias_for'], all_prope rties)
177 for offset, property in enumerate(self._aliases): 180 for offset, property in enumerate(self._aliases):
178 # Aliases use the enum_name that they are an alias for. 181 # Aliases use the enum_name that they are an alias for.
179 property['enum_name'] = self._enum_name_from_property_name(property[ 'alias_for']) 182 property['enum_name'] = self._enum_name_from_property_name(property[ 'alias_for'])
180 # Aliases do not get an enum_value. 183 # Aliases do not get an enum_value.
181 184
182 self._properties = filter(lambda property: not property['alias_for'] and not property['condition'] or property['condition'] in self._enabled_conditions, all_properties) 185 self._properties = filter(lambda property: not property['alias_for'] and not property['condition'] or property['condition'] in self._enabled_conditions, all_properties)
183 self._first_property_id = 1001 # Historical, unclear why. 186 self._first_property_id = 1001 # Historical, unclear why.
(...skipping 27 matching lines...) Expand all
211 'property_to_enum_map': '\n'.join(map(lambda property: '%(name)s, %( enum_name)s' % property, self._properties + self._aliases)), 214 'property_to_enum_map': '\n'.join(map(lambda property: '%(name)s, %( enum_name)s' % property, self._properties + self._aliases)),
212 } 215 }
213 # FIXME: If we could depend on Python 2.7, we would use subprocess.check _output 216 # FIXME: If we could depend on Python 2.7, we would use subprocess.check _output
214 gperf_args = ['gperf', '--key-positions=*', '-D', '-n', '-s', '2'] 217 gperf_args = ['gperf', '--key-positions=*', '-D', '-n', '-s', '2']
215 gperf = subprocess.Popen(gperf_args, stdin=subprocess.PIPE, stdout=subpr ocess.PIPE) 218 gperf = subprocess.Popen(gperf_args, stdin=subprocess.PIPE, stdout=subpr ocess.PIPE)
216 return gperf.communicate(gperf_input)[0] 219 return gperf.communicate(gperf_input)[0]
217 220
218 221
219 if __name__ == "__main__": 222 if __name__ == "__main__":
220 in_generator.Maker(CSSPropertiesWriter).main(sys.argv) 223 in_generator.Maker(CSSPropertiesWriter).main(sys.argv)
OLDNEW
« no previous file with comments | « core/scripts/in_generator.py ('k') | core/scripts/make_css_value_keywords.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698