Index: third_party/WebKit/Source/build/scripts/make_computed_style_base.py |
diff --git a/third_party/WebKit/Source/build/scripts/make_computed_style_base.py b/third_party/WebKit/Source/build/scripts/make_computed_style_base.py |
index f9aeb8949f4dea9b32b38946f253fb15da45a80e..93b49a89c21cb2eac7bccbd447655fecd5154742 100755 |
--- a/third_party/WebKit/Source/build/scripts/make_computed_style_base.py |
+++ b/third_party/WebKit/Source/build/scripts/make_computed_style_base.py |
@@ -286,6 +286,7 @@ |
'ComputedStyleBase.h': self.generate_base_computed_style_h, |
'ComputedStyleBase.cpp': self.generate_base_computed_style_cpp, |
'ComputedStyleBaseConstants.h': self.generate_base_computed_style_constants, |
+ 'CSSValueIDMappingsGenerated.h': self.generate_css_value_mappings, |
} |
# TODO(shend): Remove this once we move NONPROPERTIES to its own JSON file, |
@@ -373,5 +374,21 @@ |
'fields': self._fields, |
} |
+ @template_expander.use_jinja('CSSValueIDMappingsGenerated.h.tmpl') |
+ def generate_css_value_mappings(self): |
+ mappings = {} |
+ |
+ for property_ in self._properties.values(): |
+ if property_['field_template'] == 'keyword': |
+ mappings[property_['type_name']] = { |
+ 'default_value': enum_value_name(property_['default_value']), |
+ 'mapping': [(enum_value_name(k), enum_for_css_keyword(k)) for k in property_['keywords']], |
+ } |
+ |
+ return { |
+ 'include_paths': self._include_paths, |
+ 'mappings': mappings, |
+ } |
+ |
if __name__ == '__main__': |
json5_generator.Maker(ComputedStyleBaseWriter).main() |