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

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

Issue 1984163002: Fix up CSSStyleDeclaration::cssText serialization (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@border
Patch Set: Created 4 years, 7 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 (C) 2013 Intel Corporation. All rights reserved. 2 # Copyright (C) 2013 Intel Corporation. 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 ('StylePropertyShorthand.h'): self.generate_style_property_shorthand _h} 47 ('StylePropertyShorthand.h'): self.generate_style_property_shorthand _h}
48 48
49 self._longhand_dictionary = defaultdict(list) 49 self._longhand_dictionary = defaultdict(list)
50 50
51 self._properties = {property_id: property for property_id, property in s elf._properties.items() if property['longhands']} 51 self._properties = {property_id: property for property_id, property in s elf._properties.items() if property['longhands']}
52 52
53 for property in self._properties.values(): 53 for property in self._properties.values():
54 property['longhand_property_ids'] = map(enum_for_css_property, prope rty['longhands'].split(';')) 54 property['longhand_property_ids'] = map(enum_for_css_property, prope rty['longhands'].split(';'))
55 for longhand in property['longhand_property_ids']: 55 for longhand in property['longhand_property_ids']:
56 self._longhand_dictionary[longhand].append(property) 56 self._longhand_dictionary[longhand].append(property)
57 for longhands in self._longhand_dictionary.values():
58 # Sort first by number of longhands in decreasing order, then alphab etically
59 longhands.sort(
60 key=lambda property: (-len(property['longhand_property_ids']), p roperty['name'])
61 )
57 62
58 @template_expander.use_jinja('StylePropertyShorthand.cpp.tmpl') 63 @template_expander.use_jinja('StylePropertyShorthand.cpp.tmpl')
59 def generate_style_property_shorthand_cpp(self): 64 def generate_style_property_shorthand_cpp(self):
60 return { 65 return {
61 'properties': self._properties, 66 'properties': self._properties,
62 'longhands_dictionary': self._longhand_dictionary, 67 'longhands_dictionary': self._longhand_dictionary,
63 } 68 }
64 69
65 @template_expander.use_jinja('StylePropertyShorthand.h.tmpl') 70 @template_expander.use_jinja('StylePropertyShorthand.h.tmpl')
66 def generate_style_property_shorthand_h(self): 71 def generate_style_property_shorthand_h(self):
67 return { 72 return {
68 'properties': self._properties, 73 'properties': self._properties,
69 } 74 }
70 75
71 if __name__ == '__main__': 76 if __name__ == '__main__':
72 in_generator.Maker(StylePropertyShorthandWriter).main(sys.argv) 77 in_generator.Maker(StylePropertyShorthandWriter).main(sys.argv)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698