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

Side by Side Diff: third_party/WebKit/Source/build/scripts/make_computed_style_base.py

Issue 2809053002: Filter out shorthands for make_computed_style_base.py. (Closed)
Patch Set: Add asserts Created 3 years, 8 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 | « no previous file | no next file » | 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 # Copyright 2016 The Chromium Authors. All rights reserved. 2 # Copyright 2016 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import math 6 import math
7 import sys 7 import sys
8 8
9 import json5_generator 9 import json5_generator
10 import template_expander 10 import template_expander
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 310
311 # TODO(shend): Remove this once we move NONPROPERTIES to its own JSON fi le, 311 # TODO(shend): Remove this once we move NONPROPERTIES to its own JSON fi le,
312 # since the JSON5 reader will handle missing fields and defaults. 312 # since the JSON5 reader will handle missing fields and defaults.
313 for property_ in NONPROPERTIES: 313 for property_ in NONPROPERTIES:
314 property_['name_for_methods'] = property_['name'] 314 property_['name_for_methods'] = property_['name']
315 if 'field_type_path' not in property_: 315 if 'field_type_path' not in property_:
316 property_['field_type_path'] = None 316 property_['field_type_path'] = None
317 if 'type_name' not in property_: 317 if 'type_name' not in property_:
318 property_['type_name'] = 'E' + enum_type_name(property_['name_fo r_methods']) 318 property_['type_name'] = 'E' + enum_type_name(property_['name_fo r_methods'])
319 319
320 property_values = self._properties.values() 320 # Ignore shorthand properties
321 for property_ in self._properties.values():
322 if property_['field_template'] is not None:
323 assert not property_['longhands'], \
324 "Shorthand '{}' cannot have a field_template.".format(proper ty_['name'])
325
326 property_values = [value for value in self._properties.values() if not v alue['longhands']]
321 327
322 for property_ in property_values: 328 for property_ in property_values:
323 # Override the type name when field_type_path is specified 329 # Override the type name when field_type_path is specified
324 if property_['field_type_path']: 330 if property_['field_type_path']:
325 property_['type_name'] = property_['field_type_path'].split('/') [-1] 331 property_['type_name'] = property_['field_type_path'].split('/') [-1]
326 # CSS properties are not allowed to explicitly specify their field_s ize. 332 # CSS properties are not allowed to explicitly specify their field_s ize.
327 property_['field_size'] = None 333 property_['field_size'] = None
328 334
329 self._generated_enums = _create_enums(property_values + NONPROPERTIES) 335 self._generated_enums = _create_enums(property_values + NONPROPERTIES)
330 336
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 'mapping': [(enum_value_name(k), enum_for_css_keyword(k)) fo r k in property_['keywords']], 412 'mapping': [(enum_value_name(k), enum_for_css_keyword(k)) fo r k in property_['keywords']],
407 } 413 }
408 414
409 return { 415 return {
410 'include_paths': self._include_paths, 416 'include_paths': self._include_paths,
411 'mappings': mappings, 417 'mappings': mappings,
412 } 418 }
413 419
414 if __name__ == '__main__': 420 if __name__ == '__main__':
415 json5_generator.Maker(ComputedStyleBaseWriter).main() 421 json5_generator.Maker(ComputedStyleBaseWriter).main()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698