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

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

Issue 2620883002: Convert Settings.in, CSSValueKeywords.in, SVGCSSValueKeywords.in to json5 (Closed)
Patch Set: Convert CSSProperties.in to json5 format Created 3 years, 11 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 13 matching lines...) Expand all
24 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 29
30 from collections import defaultdict 30 from collections import defaultdict
31 import sys 31 import sys
32 32
33 import css_properties 33 import css_properties
34 import in_generator 34 import json5_generator
35 from name_utilities import enum_for_css_property 35 from name_utilities import enum_for_css_property
36 from name_utilities import lower_first 36 from name_utilities import lower_first
37 import template_expander 37 import template_expander
38 38
39 39
40 class StylePropertyShorthandWriter(css_properties.CSSProperties): 40 class StylePropertyShorthandWriter(css_properties.CSSProperties):
41 class_name = 'StylePropertyShorthand' 41 class_name = 'StylePropertyShorthand'
42 42
43 def __init__(self, in_file_path): 43 def __init__(self, json5_file_path):
44 super(StylePropertyShorthandWriter, self).__init__(in_file_path) 44 super(StylePropertyShorthandWriter, self).__init__(json5_file_path)
45 self._outputs = { 45 self._outputs = {
46 ('StylePropertyShorthand.cpp'): self.generate_style_property_shortha nd_cpp, 46 ('StylePropertyShorthand.cpp'): self.generate_style_property_shortha nd_cpp,
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(';'))
(...skipping 12 matching lines...) Expand all
67 'longhands_dictionary': self._longhand_dictionary, 67 'longhands_dictionary': self._longhand_dictionary,
68 } 68 }
69 69
70 @template_expander.use_jinja('StylePropertyShorthand.h.tmpl') 70 @template_expander.use_jinja('StylePropertyShorthand.h.tmpl')
71 def generate_style_property_shorthand_h(self): 71 def generate_style_property_shorthand_h(self):
72 return { 72 return {
73 'properties': self._properties, 73 'properties': self._properties,
74 } 74 }
75 75
76 if __name__ == '__main__': 76 if __name__ == '__main__':
77 in_generator.Maker(StylePropertyShorthandWriter).main(sys.argv) 77 json5_generator.Maker(StylePropertyShorthandWriter).main()
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/build/scripts/make_style_builder.py ('k') | third_party/WebKit/Source/build/scripts/scripts.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698