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

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

Issue 2826653002: Generate getters/setters for some fields on groups in ComputedStyle (Closed)
Patch Set: Append Internal to all protected methods 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 unified diff | Download patch
OLDNEW
1 {% from 'macros.tmpl' import license, print_if %} 1 {% from 'macros.tmpl' import license, print_if %}
2 {{license()}} 2 {{license()}}
3 3
4 #ifndef ComputedStyleBase_h 4 #ifndef ComputedStyleBase_h
5 #define ComputedStyleBase_h 5 #define ComputedStyleBase_h
6 6
7 #include "core/style/ComputedStyleConstants.h" 7 #include "core/style/ComputedStyleConstants.h"
8 #include "core/CoreExport.h" 8 #include "core/CoreExport.h"
9 {% for path in include_paths %} 9 {% for path in include_paths %}
10 #include "{{path}}" 10 #include "{{path}}"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 // style that are marked as inherited by this style. 74 // style that are marked as inherited by this style.
75 void PropagateIndependentInheritedProperties( 75 void PropagateIndependentInheritedProperties(
76 const ComputedStyleBase& parentStyle); 76 const ComputedStyleBase& parentStyle);
77 77
78 // Fields. 78 // Fields.
79 // TODO(sashab): Remove initialFoo() static methods and update callers to 79 // TODO(sashab): Remove initialFoo() static methods and update callers to
80 // use resetFoo(), which can be more efficient. 80 // use resetFoo(), which can be more efficient.
81 81
82 {% for field in fields %} 82 {% for field in fields %}
83 // {{field.property_name}} 83 // {{field.property_name}}
84 {{field_templates[field.field_template].decl_methods(field)|indent(2)}} 84 {{field_templates[field.field_template].decl_public_methods(field)|indent(2)}}
85 85
86 {% endfor %} 86 {% endfor %}
87 protected: 87 protected:
88 // Constructor and destructor are protected so that only the parent class Comp utedStyle 88 // Constructor and destructor are protected so that only the parent class Comp utedStyle
89 // can instantiate this class. 89 // can instantiate this class.
90 ALWAYS_INLINE ComputedStyleBase() : 90 ALWAYS_INLINE ComputedStyleBase() :
91 {% for field in fields %} 91 {% for field in fields %}
92 {{field.name}}({{encode(field, field.default_value)}}){{print_if(not loop. last, ',')}} 92 {{field.name}}({{encode(field, field.default_value)}}){{print_if(not loop. last, ',')}}
93 {% endfor %} 93 {% endfor %}
94 {} 94 {}
95 95
96 {% for field in fields %}
97 {% if field.field_template == 'storage_only' or field.field_template == 'monot onic_flag' or field.field_template == 'external' %}
shend 2017/04/19 03:46:20 nit: I would do either: {% if field.field_template
nainar 2017/04/19 04:02:46 Went with option 1
98 {{field_templates[field.field_template].decl_protected_methods(field)|indent(2 )}}
99 {% endif %}
100 {% endfor %}
101
96 ~ComputedStyleBase() = default; 102 ~ComputedStyleBase() = default;
97 103
98 // Storage. 104 // Storage.
99 {% for field in fields %} 105 {% for field in fields %}
100 {% if field.is_bit_field %} 106 {% if field.is_bit_field %}
101 unsigned {{field.name}} : {{field.size}}; // {{field.type_name}} 107 unsigned {{field.name}} : {{field.size}}; // {{field.type_name}}
102 {% else %} 108 {% else %}
103 {{field.type_name}} {{field.name}}; 109 {{field.type_name}} {{field.name}};
104 {% endif %} 110 {% endif %}
105 {% endfor %} 111 {% endfor %}
106 }; 112 };
107 113
108 } // namespace blink 114 } // namespace blink
109 115
110 #endif // ComputedStyleBase_h 116 #endif // ComputedStyleBase_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698