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

Side by Side Diff: third_party/WebKit/Source/build/scripts/templates/ComputedStyleBase.cpp.tmpl

Issue 2919343002: Remove template parameter on ComputedStyleBase. (Closed)
Patch Set: Address comments Created 3 years, 6 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
(Empty)
1 {% from 'macros.tmpl' import license, print_if %}
2 {% from 'fields/field.tmpl' import encode, getter_expression, setter_expression, fieldwise_copy, fieldwise_diff %}
3 {% from 'fields/group.tmpl' import define_field_group_class %}
4 {{license()}}
5
6 #include "core/ComputedStyleBase.h"
7 #include "core/style/ComputedStyle.h"
8 #include "platform/wtf/SizeAssertions.h"
9
10 namespace blink {
11
12 struct SameSizeAsComputedStyleBase {
13 {% if computed_style.subgroups is defined %}
14 void* dataRefs[{{computed_style.subgroups|length}}];
15 {% endif %}
16 {% for field in computed_style.fields|rejectattr("is_bit_field") %}
17 {{field.type_name}} {{field.name}};
18 {% endfor %}
19 unsigned m_bit_fields[{{computed_style.num_32_bit_words_for_bit_fields}}];
20 };
21
22 // If this fails, the packing algorithm in make_computed_style_base.py has
23 // failed to produce the optimal packed size. To fix, update the algorithm to
24 // ensure that the buckets are placed so that each takes up at most 1 word.
25 ASSERT_SIZE(ComputedStyleBase, SameSizeAsComputedStyleBase);
26
27 // Constructor and destructor are protected so that only the parent class Comput edStyle
28 // can instantiate this class.
29 ComputedStyleBase::ComputedStyleBase() :
30 {% for field in computed_style.fields %}
31 {{field.name}}({{encode(field, field.default_value)}}){{print_if(not loop.la st, ',')}}
32 {% endfor %}
33 {
34 {% for subgroup in computed_style.subgroups %}
35 {{subgroup.member_name}}.Init();
36 {% endfor %}
37 }
38
39 void ComputedStyleBase::InheritFrom(const ComputedStyleBase& other,
40 IsAtShadowBoundary isAtShadowBoundary) {
41 {{fieldwise_copy(computed_style, computed_style.all_fields
42 |selectattr("is_property")
43 |selectattr("is_inherited")
44 |list
45 )|indent(2)}}
46 }
47
48 void ComputedStyleBase::CopyNonInheritedFromCached(
49 const ComputedStyleBase& other) {
50 {{fieldwise_copy(computed_style, computed_style.all_fields
51 |rejectattr("has_custom_compare_and_copy")
52 |rejectattr("is_inherited")
53 |list
54 )|indent(2)}}
55 }
56
57 void ComputedStyleBase::PropagateIndependentInheritedProperties(
58 const ComputedStyleBase& parentStyle) {
59 {% for field in computed_style.all_fields if field.is_property and field.is_in dependent %}
60 if ({{field.is_inherited_method_name}}())
61 {{setter_expression(field)}} = parentStyle.{{getter_expression(field)}};
62 {% endfor %}
63 }
64
65 {% for name, groups_to_diff in diff_functions_map.items() %}
66 bool ComputedStyleBase::{{name}}(const ComputedStyle& a, const ComputedStyle& b) {
67 {{fieldwise_diff(groups_to_diff)|indent(4)}}
68 return false;
69 }
70
71 {% endfor %}
72
73 {% for group in computed_style.subgroups %}
74 {{define_field_group_class(group)}}
75
76 {% endfor %}
77
78 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698