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

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

Issue 2558733002: Sort fields in ComputedStyleBase in decreasing order of size (Closed)
Patch Set: Created 4 years 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 in_generator 9 import in_generator
10 import template_expander 10 import template_expander
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 type=type_name, 131 type=type_name,
132 size=int(math.ceil(bits_needed)), 132 size=int(math.ceil(bits_needed)),
133 default_value=default_value, 133 default_value=default_value,
134 getter_method_name=property_name_lower, 134 getter_method_name=property_name_lower,
135 setter_method_name='set' + property_name, 135 setter_method_name='set' + property_name,
136 initial_method_name='initial' + property_name, 136 initial_method_name='initial' + property_name,
137 resetter_method_name='reset' + property_name, 137 resetter_method_name='reset' + property_name,
138 is_inherited_method_name=property_name_lower + 'IsInherited' , 138 is_inherited_method_name=property_name_lower + 'IsInherited' ,
139 )) 139 ))
140 140
141 # Small optimization: order fields by size, from largest to smallest,
142 # to reduce wasted space from alignment.
143 self._fields.sort(key=lambda f: f.size, reverse=True)
144
141 @template_expander.use_jinja('ComputedStyleBase.h.tmpl') 145 @template_expander.use_jinja('ComputedStyleBase.h.tmpl')
142 def generate_base_computed_style_h(self): 146 def generate_base_computed_style_h(self):
143 return { 147 return {
144 'properties': self._properties, 148 'properties': self._properties,
145 'enums': self._computed_enums, 149 'enums': self._computed_enums,
146 'fields': self._fields, 150 'fields': self._fields,
147 } 151 }
148 152
149 @template_expander.use_jinja('ComputedStyleBase.cpp.tmpl') 153 @template_expander.use_jinja('ComputedStyleBase.cpp.tmpl')
150 def generate_base_computed_style_cpp(self): 154 def generate_base_computed_style_cpp(self):
151 return { 155 return {
152 'properties': self._properties, 156 'properties': self._properties,
153 'enums': self._computed_enums, 157 'enums': self._computed_enums,
154 'fields': self._fields, 158 'fields': self._fields,
155 } 159 }
156 160
157 @template_expander.use_jinja('ComputedStyleBaseConstants.h.tmpl') 161 @template_expander.use_jinja('ComputedStyleBaseConstants.h.tmpl')
158 def generate_base_computed_style_constants(self): 162 def generate_base_computed_style_constants(self):
159 return { 163 return {
160 'properties': self._properties, 164 'properties': self._properties,
161 'enums': self._computed_enums, 165 'enums': self._computed_enums,
162 'fields': self._fields, 166 'fields': self._fields,
163 } 167 }
164 168
165 if __name__ == '__main__': 169 if __name__ == '__main__':
166 in_generator.Maker(ComputedStyleBaseWriter).main(sys.argv) 170 in_generator.Maker(ComputedStyleBaseWriter).main(sys.argv)
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