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

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

Issue 2826653002: Generate getters/setters for some fields on groups in ComputedStyle (Closed)
Patch Set: Incorporating shend@'s suggestions 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
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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 if not self.is_inherited_flag: 127 if not self.is_inherited_flag:
128 self.is_inherited = kwargs.pop('inherited') 128 self.is_inherited = kwargs.pop('inherited')
129 self.is_independent = kwargs.pop('independent') 129 self.is_independent = kwargs.pop('independent')
130 assert self.is_inherited or not self.is_independent, 'Only inherited fields can be independent' 130 assert self.is_inherited or not self.is_independent, 'Only inherited fields can be independent'
131 131
132 self.is_inherited_method_name = method_name(join_name(name_for_metho ds, 'is inherited')) 132 self.is_inherited_method_name = method_name(join_name(name_for_metho ds, 'is inherited'))
133 133
134 # Method names 134 # Method names
135 self.getter_method_name = getter_method_name 135 self.getter_method_name = getter_method_name
136 self.setter_method_name = setter_method_name 136 self.setter_method_name = setter_method_name
137 self.internal_getter_method_name = method_name(join_name(getter_method_n ame, 'Internal'))
138 self.internal_mutable_method_name = method_name(join_name('Mutable', nam e_for_methods, 'Internal'))
suzyh_UTC10 (ex-contributor) 2017/04/19 08:03:33 The class doc says name_for_methods is the name us
nainar 2017/04/19 08:49:35 That's because we need them as input to form the n
suzyh_UTC10 (ex-contributor) 2017/04/20 00:12:18 Clarification: I meant why not construct {getter,s
nainar 2017/04/20 02:53:04 So turns out I was stupid in explaining it to you
suzyh_UTC10 (ex-contributor) 2017/04/20 03:48:02 Aha! OK then. Ideally we'd tidy this up, so option
nainar 2017/04/20 05:15:58 Done.
139 self.internal_setter_method_name = method_name(join_name(setter_method_n ame, 'Internal'))
137 self.initial_method_name = initial_method_name 140 self.initial_method_name = initial_method_name
138 self.resetter_method_name = method_name(join_name('Reset', name_for_meth ods)) 141 self.resetter_method_name = method_name(join_name('Reset', name_for_meth ods))
139 142
140 # If the size of the field is not None, it means it is a bit field 143 # If the size of the field is not None, it means it is a bit field
141 self.is_bit_field = self.size is not None 144 self.is_bit_field = self.size is not None
142 145
143 assert len(kwargs) == 0, 'Unexpected arguments provided to Field: ' + st r(kwargs) 146 assert len(kwargs) == 0, 'Unexpected arguments provided to Field: ' + st r(kwargs)
144 147
145 148
146 def _get_include_paths(properties): 149 def _get_include_paths(properties):
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 @template_expander.use_jinja('ComputedStyleBaseConstants.h.tmpl') 403 @template_expander.use_jinja('ComputedStyleBaseConstants.h.tmpl')
401 def generate_base_computed_style_constants(self): 404 def generate_base_computed_style_constants(self):
402 return { 405 return {
403 'properties': self._properties, 406 'properties': self._properties,
404 'enums': self._generated_enums, 407 'enums': self._generated_enums,
405 'fields': self._fields, 408 'fields': self._fields,
406 } 409 }
407 410
408 if __name__ == '__main__': 411 if __name__ == '__main__':
409 json5_generator.Maker(ComputedStyleBaseWriter).main() 412 json5_generator.Maker(ComputedStyleBaseWriter).main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698