Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 #!/usr/bin/env python | |
| 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 | |
| 4 # found in the LICENSE file. | |
| 5 | |
| 6 import sys | |
| 7 | |
| 8 import in_generator | |
| 9 import template_expander | |
| 10 import make_style_builder | |
| 11 | |
| 12 | |
| 13 class CSSPropertyAPIWriter(make_style_builder.StyleBuilderWriter): | |
| 14 def __init__(self, in_file_path): | |
| 15 super(CSSPropertyAPIWriter, self).__init__(in_file_path) | |
| 16 | |
| 17 self._outputs = {"CSSPropertyDescriptor.cpp": self.generate_property_des criptor_h} | |
|
sashab
2016/12/08 23:56:35
Move this line and move newline to after it to be
aazzam
2016/12/09 00:44:39
done
| |
| 18 self._property_groups = [] | |
|
sashab
2016/12/08 23:56:35
Add comments explaining what these variables are f
aazzam
2016/12/09 00:44:39
done
| |
| 19 self._properties_by_index = [] | |
| 20 for property in self._properties.values(): | |
| 21 if property['generated_api_class'] is not None: | |
| 22 if property['generated_api_class'] is True: | |
| 23 self._property_groups.append(property['upper_camel_name']) | |
|
sashab
2016/12/08 23:56:35
It's not clear that the other branch is not False.
aazzam
2016/12/09 00:44:39
done
| |
| 24 else: | |
|
sashab
2016/12/08 23:56:35
I would change to elif property['..'] is not False
aazzam
2016/12/09 00:44:39
done :)
| |
| 25 self._property_groups.append(property['generated_api_class'] ) | |
| 26 self._properties_by_index.append(property) | |
| 27 | |
| 28 self._property_groups = list(set(self._property_groups)) | |
|
sashab
2016/12/08 23:56:35
Add comment explaining this is to remove duplicate
aazzam
2016/12/09 00:44:39
done
| |
| 29 for i, property in enumerate(self._properties_by_index): | |
|
sashab
2016/12/08 23:56:35
Add comment explaining what this loop is for
aazzam
2016/12/09 00:44:39
done
| |
| 30 property['api_array_index'] = i + 1 | |
| 31 | |
| 32 @template_expander.use_jinja('CSSPropertyDescriptor.cpp.tmpl') | |
| 33 def generate_property_descriptor_h(self): | |
| 34 return { | |
| 35 'propertyGroups': sorted(self._property_groups), | |
|
sashab
2016/12/08 23:56:35
Check other files - I think they use underscore_na
aazzam
2016/12/09 00:44:39
done
| |
| 36 'properties': self._properties_by_index, | |
| 37 } | |
| 38 | |
| 39 if __name__ == '__main__': | |
| 40 in_generator.Maker(CSSPropertyAPIWriter).main(sys.argv) | |
| OLD | NEW |