Commit de5be95f authored by aazzam's avatar aazzam Committed by Commit bot

Made a generator for .h files for implementations of CSSPropertyAPI.h

Renamed make_css_property_descriptor.py to make_css_property_api.py and
modified it so that it also generates API .h files. Added the template
file CSSPropertyAPI.h.tmpl.

To generate the .h file for a property, add the api_class flag to the
property in CSSProperties.in.

BUG=668012

Review-Url: https://codereview.chromium.org/2578773002
Cr-Commit-Position: refs/heads/master@{#439053}
parent 1014cd6b
......@@ -37,6 +37,7 @@ class CSSPropertyAPIWriter(make_style_builder.StyleBuilderWriter):
continue
classname = get_classname(property)
properties_for_class[classname].append(property['property_id'])
self._outputs[classname + '.h'] = self.generate_property_api_h_builder(classname)
# Stores a list of classes with elements (index, classname, [propertyIDs, ..]).
self._api_classes = []
......@@ -55,5 +56,15 @@ class CSSPropertyAPIWriter(make_style_builder.StyleBuilderWriter):
'api_classes': self._api_classes,
}
# Provides a function object given the classname of the property.
# This returned function generates a .h file for the specified property.
def generate_property_api_h_builder(self, api_classname):
@template_expander.use_jinja('CSSPropertyAPIFiles.h.tmpl')
def generate_property_api_h():
return {
'api_classname': api_classname,
}
return generate_property_api_h
if __name__ == '__main__':
in_generator.Maker(CSSPropertyAPIWriter).main(sys.argv)
......@@ -2,20 +2,18 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CSSPropertyAPIWebkitPadding_h
#define CSSPropertyAPIWebkitPadding_h
#ifndef {{api_classname}}_h
#define {{api_classname}}_h
#include "core/CSSPropertyNames.h"
#include "core/css/properties/CSSPropertyAPI.h"
namespace blink {
// TODO(aazzam): Generate API .h files
class CSSParserTokenRange;
class CSSParserContext;
class CSSPropertyAPIWebkitPadding : public CSSPropertyAPI {
class {{api_classname}} : public CSSPropertyAPI {
public:
static const CSSValue* parseSingleValue(CSSParserTokenRange&,
const CSSParserContext&);
......@@ -23,4 +21,4 @@ class CSSPropertyAPIWebkitPadding : public CSSPropertyAPI {
} // namespace blink
#endif // CSSPropertyAPIWebkitPadding_h
#endif // {{api_classname}}_h
......@@ -424,9 +424,12 @@ css_properties("make_core_generated_computed_style_base") {
]
}
css_properties("make_core_generated_css_property_descriptor") {
script = "../build/scripts/make_css_property_descriptor.py"
other_inputs = [ "../build/scripts/templates/CSSPropertyDescriptor.cpp.tmpl" ]
css_properties("make_core_generated_css_property_apis") {
script = "../build/scripts/make_css_property_apis.py"
other_inputs = [
"../build/scripts/templates/CSSPropertyDescriptor.cpp.tmpl",
"../build/scripts/templates/CSSPropertyAPIFiles.h.tmpl",
]
outputs = [
"$blink_core_output_dir/css/properties/CSSPropertyDescriptor.cpp",
]
......@@ -873,7 +876,7 @@ targets_generating_sources = [
":make_core_generated_css_primitive_value_unit_trie",
":make_core_generated_css_property_metadata",
":make_core_generated_computed_style_base",
":make_core_generated_css_property_descriptor",
":make_core_generated_css_property_apis",
":make_core_generated_css_property_names",
":make_core_generated_cssom_types",
":make_core_generated_event_factory",
......
......@@ -346,7 +346,6 @@ blink_core_sources("css") {
"parser/SizesCalcParser.cpp",
"properties/CSSPropertyAPI.h",
"properties/CSSPropertyAPIWebkitPadding.cpp",
"properties/CSSPropertyAPIWebkitPadding.h",
"properties/CSSPropertyDescriptor.h",
"resolver/AnimatedStyleBuilder.cpp",
"resolver/AnimatedStyleBuilder.h",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment