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

Unified Diff: third_party/WebKit/Source/build/scripts/templates/fields/group.tmpl

Issue 2786883002: Generate subgroup StyleSurroundData in ComputedStyle. (Closed)
Patch Set: Rebase Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/build/scripts/templates/fields/group.tmpl
diff --git a/third_party/WebKit/Source/build/scripts/templates/fields/group.tmpl b/third_party/WebKit/Source/build/scripts/templates/fields/group.tmpl
new file mode 100644
index 0000000000000000000000000000000000000000..f724cca0f03facc7d1bf86b6b2dcda900412db21
--- /dev/null
+++ b/third_party/WebKit/Source/build/scripts/templates/fields/group.tmpl
@@ -0,0 +1,44 @@
+{% from 'fields/field.tmpl' import encode %}
+{% from 'macros.tmpl' import print_if %}
+{% macro def_group(group): -%}
meade_UTC10 2017/04/06 03:29:57 I think this can be named more clearly, group_clas
shend 2017/04/20 03:22:34 Changed to define_field_group_class.
+class {{group.type_name}} : public RefCounted<{{group.type_name}}> {
+ public:
+ static PassRefPtr<{{group.type_name}}> create() {
+ return adoptRef(new {{group.type_name}});
+ }
+ PassRefPtr<{{group.type_name}}> copy() const {
+ return adoptRef(new {{group.type_name}}(*this));
+ }
+
+ bool operator==(const {{group.type_name}}& o) const {
meade_UTC10 2017/04/06 03:29:57 Not sure if the other generators you've written mi
shend 2017/04/06 04:39:40 Ah ok, I was merely following the handwritten code
meade_UTC10 2017/04/20 03:08:40 Ah yeah I think some of that is old and predates t
shend 2017/04/20 03:22:34 Changed to 'other'.
+ return (
+ {% for field in group.fields %}
+ {{field.name}} == o.{{field.name}}{{print_if(not loop.last, ' &&')}}
+ {% endfor %}
+ );
+ }
+ bool operator!=(const {{group.type_name}}& o) const { return !(*this == o); }
+
+ {% for field in group.fields %}
+ {% if field.is_bit_field %}
meade_UTC10 2017/04/06 03:29:58 How come some of the if field.is_bit_field is abst
shend 2017/04/20 03:22:34 Done.
+ unsigned {{field.name}} : {{field.size}}; // {{field.type_name}}
+ {% else %}
+ {{field.type_name}} {{field.name}};
+ {% endif %}
+ {% endfor %}
+
+ private:
+ {{group.type_name}}() :
+ {% for field in group.fields %}
+ {{field.name}}({{encode(field, field.default_value)}}){{print_if(not loop.last, ',')}}
+ {% endfor %}
+ {}
+
+ ALWAYS_INLINE {{group.type_name}}(const {{group.type_name}}& o) :
+ RefCounted<{{group.type_name}}>(),
+ {% for field in group.fields %}
+ {{field.name}}(o.{{field.name}}){{print_if(not loop.last, ',')}}
+ {% endfor %}
+ {}
+};
+{%- endmacro %}

Powered by Google App Engine
This is Rietveld 408576698