Commit 4345e38c authored by shend's avatar shend Committed by Commit Bot

Explicitly generate ComputedStyleBase subgroup copy constructors.

We currently use the default copy constructor for subgroups under
ComputedStyleBase like StyleSurroundData. We've been able to do so
because all fields had default copying behaviour. Now we want to
generate StyleRareNonInheritedData, which has std::unique_ptr fields
that cannot be copied by default. This means we have to explicitly
generate user-defined copy constructors for these subgroups.

This is in preparation for supporting custom copying behaviour for
fields.

Diff of generated files:
https://gist.github.com/darrnshn/1c51e498c11b2798fbc962390a009060/revisions

BUG=628043

Review-Url: https://codereview.chromium.org/2911373002
Cr-Commit-Position: refs/heads/master@{#475788}
parent 72281818
{% from 'fields/field.tmpl' import encode, declare_storage, compare %}
{% from 'macros.tmpl' import print_if %}
{% macro define_field_group_class(group): -%}
class {{group.type_name}} : public RefCountedCopyable<{{group.type_name}}> {
class {{group.type_name}} : public RefCounted<{{group.type_name}}> {
public:
static PassRefPtr<{{group.type_name}}> Create() {
return AdoptRef(new {{group.type_name}});
......@@ -30,6 +30,10 @@ class {{group.type_name}} : public RefCountedCopyable<{{group.type_name}}> {
{% endfor %}
{}
{{group.type_name}}(const {{group.type_name}}&) = default;
{{group.type_name}}(const {{group.type_name}}& other) :
{% for field in group.fields %}
{{field.name}}(other.{{field.name}}){{print_if(not loop.last, ',')}}
{% endfor %}
{}
};
{%- endmacro %}
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