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

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

Issue 2739553003: Make ComputedStyleBase abstract. (Closed)
Patch Set: Rebase Created 3 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/ComputedStyleBaseConstants.h" 7 #include "core/ComputedStyleBaseConstants.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}}"
11 {% endfor %} 11 {% endfor %}
12 12
13 {# Each field template has macros that we can call to generate specific 13 {# Each field template has macros that we can call to generate specific
14 aspects of the field (e.g. getters, setters). 14 aspects of the field (e.g. getters, setters).
15 #} 15 #}
16 {% import 'fields/keyword.tmpl' as keyword %} 16 {% import 'fields/keyword.tmpl' as keyword %}
17 {% import 'fields/flag.tmpl' as flag %} 17 {% import 'fields/flag.tmpl' as flag %}
18 {% import 'fields/monotonic_flag.tmpl' as monotonic_flag %} 18 {% import 'fields/monotonic_flag.tmpl' as monotonic_flag %}
19 {% set field_templates = { 'keyword': keyword, 'flag': flag, 'monotonic_flag': m onotonic_flag } %} 19 {% set field_templates = { 'keyword': keyword, 'flag': flag, 'monotonic_flag': m onotonic_flag } %}
20 20
21 namespace blink { 21 namespace blink {
22 22
23 // The generated portion of ComputedStyle. For more info, see the header comment 23 // The generated portion of ComputedStyle. For more info, see the header comment
24 // in ComputedStyle.h. 24 // in ComputedStyle.h.
25 class CORE_EXPORT ComputedStyleBase { 25 class CORE_EXPORT ComputedStyleBase {
26 public: 26 public:
27 ALWAYS_INLINE ComputedStyleBase() :
28 {% for field in fields %}
29 {{field.name}}(static_cast<unsigned>({{field.default_value}})){{print_if(n ot loop.last, ',')}}
30 {% endfor %}
31 {}
32 ~ComputedStyleBase() {}
33
34 ALWAYS_INLINE ComputedStyleBase(const ComputedStyleBase& o) :
35 {% for field in fields %}
36 {{field.name}}(o.{{field.name}}){{print_if(not loop.last, ',')}}
37 {% endfor %}
38 {}
39
40 inline bool independentInheritedEqual(const ComputedStyleBase& o) const { 27 inline bool independentInheritedEqual(const ComputedStyleBase& o) const {
41 return ( 28 return (
42 {% for field in fields if field.is_property and field.is_inherited and field .is_independent %} 29 {% for field in fields if field.is_property and field.is_inherited and field .is_independent %}
43 {{field.name}} == o.{{field.name}}{{print_if(not loop.last, ' &&')}} 30 {{field.name}} == o.{{field.name}}{{print_if(not loop.last, ' &&')}}
44 {% endfor %} 31 {% endfor %}
45 ); 32 );
46 } 33 }
47 34
48 inline bool nonIndependentInheritedEqual(const ComputedStyleBase& o) const { 35 inline bool nonIndependentInheritedEqual(const ComputedStyleBase& o) const {
49 return ( 36 return (
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 // Fields. 69 // Fields.
83 // TODO(sashab): Remove initialFoo() static methods and update callers to 70 // TODO(sashab): Remove initialFoo() static methods and update callers to
84 // use resetFoo(), which can be more efficient. 71 // use resetFoo(), which can be more efficient.
85 72
86 {% for field in fields %} 73 {% for field in fields %}
87 // {{field.property_name}} 74 // {{field.property_name}}
88 {{field_templates[field.field_template].decl_methods(field)|indent(2)}} 75 {{field_templates[field.field_template].decl_methods(field)|indent(2)}}
89 76
90 {% endfor %} 77 {% endfor %}
91 protected: 78 protected:
79 ALWAYS_INLINE ComputedStyleBase() :
80 {% for field in fields %}
81 {{field.name}}(static_cast<unsigned>({{field.default_value}})){{print_if(n ot loop.last, ',')}}
82 {% endfor %}
83 {}
84
85 ~ComputedStyleBase() = default;
sashab 2017/03/16 23:55:31 I like this, but can we add a comment here like: /
86
87 ALWAYS_INLINE ComputedStyleBase(const ComputedStyleBase& o) :
88 {% for field in fields %}
89 {{field.name}}(o.{{field.name}}){{print_if(not loop.last, ',')}}
90 {% endfor %}
91 {}
92
92 // Storage. 93 // Storage.
93 {% for field in fields %} 94 {% for field in fields %}
94 unsigned {{field.name}} : {{field.size}}; // {{field.type_name}} 95 unsigned {{field.name}} : {{field.size}}; // {{field.type_name}}
95 {% endfor %} 96 {% endfor %}
96 }; 97 };
97 98
98 } // namespace blink 99 } // namespace blink
99 100
100 #endif // ComputedStyleBase_h 101 #endif // ComputedStyleBase_h
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698