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

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

Issue 350333003: Cascade declared property values instead of applying values on top of each other (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase Created 6 years, 4 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 | Source/build/scripts/templates/StyleBuilder.cpp.tmpl » ('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 # Copyright (C) 2013 Google Inc. All rights reserved. 2 # Copyright (C) 2013 Google Inc. All rights reserved.
3 # 3 #
4 # Redistribution and use in source and binary forms, with or without 4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are 5 # modification, are permitted provided that the following conditions are
6 # met: 6 # met:
7 # 7 #
8 # * Redistributions of source code must retain the above copyright 8 # * Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer. 9 # notice, this list of conditions and the following disclaimer.
10 # * Redistributions in binary form must reproduce the above 10 # * Redistributions in binary form must reproduce the above
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 'lower_first': lower_first, 42 'lower_first': lower_first,
43 } 43 }
44 44
45 valid_values = { 45 valid_values = {
46 'svg': [True, False], 46 'svg': [True, False],
47 'font': [True, False], 47 'font': [True, False],
48 'custom_all': [True, False], 48 'custom_all': [True, False],
49 'custom_initial': [True, False], 49 'custom_initial': [True, False],
50 'custom_inherit': [True, False], 50 'custom_inherit': [True, False],
51 'custom_value': [True, False], 51 'custom_value': [True, False],
52 'direction_aware': [True, False],
53 'skip': [True, False], 52 'skip': [True, False],
54 } 53 }
55 defaults = { 54 defaults = {
56 'name_for_methods': None, 55 'name_for_methods': None,
57 'use_handlers_for': None,
58 'svg': False, 56 'svg': False,
59 'font': False, 57 'font': False,
60 'converter': None, 58 'converter': None,
61 'direction_aware': False,
62 'skip': False, 59 'skip': False,
63 # These depend on property name by default 60 # These depend on property name by default
64 'type_name': None, 61 'type_name': None,
65 'getter': None, 62 'getter': None,
66 'setter': None, 63 'setter': None,
67 'initial': None, 64 'initial': None,
68 # Setting these stops default handlers being generated 65 # Setting these stops default handlers being generated
69 # Setting custom_all is the same as setting the other three 66 # Setting custom_all is the same as setting the other three
70 'custom_all': False, 67 'custom_all': False,
71 'custom_initial': False, 68 'custom_initial': False,
(...skipping 20 matching lines...) Expand all
92 cc = property['name_for_methods'] or cc.replace('Webkit', '') 89 cc = property['name_for_methods'] or cc.replace('Webkit', '')
93 property['camel_case_name'] = cc 90 property['camel_case_name'] = cc
94 set_if_none(property, 'type_name', 'E' + cc) 91 set_if_none(property, 'type_name', 'E' + cc)
95 set_if_none(property, 'getter', lower_first(cc)) 92 set_if_none(property, 'getter', lower_first(cc))
96 set_if_none(property, 'setter', 'set' + cc) 93 set_if_none(property, 'setter', 'set' + cc)
97 set_if_none(property, 'initial', 'initial' + cc) 94 set_if_none(property, 'initial', 'initial' + cc)
98 if property['custom_all']: 95 if property['custom_all']:
99 property['custom_initial'] = True 96 property['custom_initial'] = True
100 property['custom_inherit'] = True 97 property['custom_inherit'] = True
101 property['custom_value'] = True 98 property['custom_value'] = True
102 property['should_declare_functions'] = not property['use_handlers_fo r'] and not property['direction_aware'] and not property['skip'] 99 property['should_declare_functions'] = not property['skip']
103 100
104 self._properties = dict((property['property_id'], property) for property in self._properties) 101 self._properties = dict((property['property_id'], property) for property in self._properties)
105 102
106 @template_expander.use_jinja('StyleBuilderFunctions.h.tmpl', 103 @template_expander.use_jinja('StyleBuilderFunctions.h.tmpl',
107 filters=filters) 104 filters=filters)
108 def generate_style_builder_functions_h(self): 105 def generate_style_builder_functions_h(self):
109 return { 106 return {
110 'properties': self._properties, 107 'properties': self._properties,
111 } 108 }
112 109
113 @template_expander.use_jinja('StyleBuilderFunctions.cpp.tmpl', 110 @template_expander.use_jinja('StyleBuilderFunctions.cpp.tmpl',
114 filters=filters) 111 filters=filters)
115 def generate_style_builder_functions_cpp(self): 112 def generate_style_builder_functions_cpp(self):
116 return { 113 return {
117 'properties': self._properties, 114 'properties': self._properties,
118 } 115 }
119 116
120 @template_expander.use_jinja('StyleBuilder.cpp.tmpl', filters=filters) 117 @template_expander.use_jinja('StyleBuilder.cpp.tmpl', filters=filters)
121 def generate_style_builder(self): 118 def generate_style_builder(self):
122 return { 119 return {
123 'properties': self._properties, 120 'properties': self._properties,
124 } 121 }
125 122
126 123
127 if __name__ == '__main__': 124 if __name__ == '__main__':
128 in_generator.Maker(StyleBuilderWriter).main(sys.argv) 125 in_generator.Maker(StyleBuilderWriter).main(sys.argv)
OLDNEW
« no previous file with comments | « no previous file | Source/build/scripts/templates/StyleBuilder.cpp.tmpl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698