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

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

Issue 2692803002: Clean up type handling in make_computed_style_base.py. (Closed)
Patch Set: Don't change behaviour Created 3 years, 10 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 %} 1 {% from 'macros.tmpl' import license %}
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 field in fields if field.storage_type_path != None %} 9 {% for field in fields if field.type_path != None %}
10 #include "{{field.storage_type_path}}.h" 10 #include "{{field.type_path}}.h"
11 {% endfor %} 11 {% endfor %}
12 12
13 {# Returns the default value for the field, converted to fit in the storage cont ainer. #} 13 {# Returns the default value for the field, converted to fit in the storage cont ainer. #}
14 {% macro default_value(field) %} 14 {% macro default_value(field) %}
15 {# We only support enum fields for now. #} 15 {# We only support enum fields for now. #}
16 static_cast<unsigned>({{field.default_value}}){% endmacro %} 16 static_cast<unsigned>({{field.default_value}}){% endmacro %}
17 17
18 namespace blink { 18 namespace blink {
19 19
20 // The generated portion of ComputedStyle. For more info, see the header comment 20 // The generated portion of ComputedStyle. For more info, see the header comment
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 // Copies the values of any independent inherited properties from the parent 96 // Copies the values of any independent inherited properties from the parent
97 // style that are marked as inherited by this style. 97 // style that are marked as inherited by this style.
98 void propagateIndependentInheritedProperties( 98 void propagateIndependentInheritedProperties(
99 const ComputedStyleBase& parentStyle); 99 const ComputedStyleBase& parentStyle);
100 100
101 // Fields. 101 // Fields.
102 // TODO(sashab): Remove initialFoo() static methods and update callers to 102 // TODO(sashab): Remove initialFoo() static methods and update callers to
103 // use resetFoo(), which can be more efficient. 103 // use resetFoo(), which can be more efficient.
104 {% for field in fields %} 104 {% for field in fields %}
105 // {{field.property_name}} 105 // {{field.property_name}}
106 inline static {{field.storage_type}} {{field.initial_method_name}}() { return {{field.default_value}}; } 106 inline static {{field.type_name}} {{field.initial_method_name}}() { return {{f ield.default_value}}; }
107 {{field.storage_type}} {{field.getter_method_name}}() const { return static_ca st<{{field.storage_type}}>({{field.name}}); } 107 {{field.type_name}} {{field.getter_method_name}}() const { return static_cast< {{field.type_name}}>({{field.name}}); }
108 void {{field.setter_method_name}}({{field.storage_type}} v) { {{field.name}} = static_cast<unsigned>(v); } 108 void {{field.setter_method_name}}({{field.type_name}} v) { {{field.name}} = st atic_cast<unsigned>(v); }
meade_UTC10 2017/02/13 06:46:24 This might be hard given it's jinja... but is ther
109 inline void {{field.resetter_method_name}}() { {{field.name}} = {{default_valu e(field)}}; } 109 inline void {{field.resetter_method_name}}() { {{field.name}} = {{default_valu e(field)}}; }
110 110
111 {% endfor %} 111 {% endfor %}
112 protected: 112 protected:
113 // Storage. 113 // Storage.
114 {% for field in fields %} 114 {% for field in fields %}
115 unsigned {{field.name}} : {{field.size}}; // {{field.storage_type}} 115 unsigned {{field.name}} : {{field.size}}; // {{field.type_name}}
116 {% endfor %} 116 {% endfor %}
117 }; 117 };
118 118
119 } // namespace blink 119 } // namespace blink
120 120
121 #endif // ComputedStyleBase_h 121 #endif // ComputedStyleBase_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698