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

Side by Side Diff: Source/build/scripts/css_properties.py

Issue 410953002: Merge CSSProperties.in and CSSShorthands.in (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@infiles
Patch Set: Created 6 years, 5 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
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 # Copyright 2014 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 import in_generator
7 from name_utilities import lower_first
8
9
10 class CSSProperties(in_generator.Writer):
11 defaults = {
12 'longhands': '',
13 'font': False,
14 'svg': False,
15 'name_for_methods': None,
16 'getter': None,
17 'setter': None,
18 'initial': None,
19 'type_name': None,
20 'sb_converter': None,
21 'sb_custom_all': False,
22 'sb_custom_initial': False,
23 'sb_custom_inherit': False,
24 'sb_custom_value': False,
25 'sb_skip': False,
26 }
27
28 valid_values = {
29 'font': (True, False),
30 'svg': (True, False),
31 'sb_custom_all': (True, False),
32 'sb_custom_initial': (True, False),
33 'sb_custom_inherit': (True, False),
34 'sb_custom_value': (True, False),
35 'sb_skip': (True, False),
36 }
37
38 def __init__(self, file_paths):
39 in_generator.Writer.__init__(self, file_paths)
40
41 properties = self.in_file.name_dictionaries
42
43 for property in properties:
44 property['property_id'] = css_name_to_enum(property['name'])
45 property['upper_camel_name'] = camelcase_css_name(property['name'])
46 property['lower_camel_name'] = lower_first(property['upper_camel_nam e'])
47
48 self._properties_list = properties
49 self._properties = {property['property_id']: property for property in pr operties}
50
51
52 def camelcase_css_name(css_name):
53 """Convert hyphen-separated-name to UpperCamelCase.
54
55 E.g., '-foo-bar' becomes 'FooBar'.
56 """
57 return ''.join(word.capitalize() for word in css_name.split('-'))
58
59
60 def css_name_to_enum(css_name):
61 return 'CSSProperty' + camelcase_css_name(css_name)
OLDNEW
« no previous file with comments | « no previous file | Source/build/scripts/make_style_builder.py » ('j') | Source/devtools/scripts/generate_supported_css.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698