Commit a0c2bf8d authored by sashab's avatar sashab Committed by Commit bot

Renamed 'type' to 'storage_type' in make_computed_style_base.py

Renamed the Field attribute 'type' to 'storage_type' in
make_computed_style_base.py and the ComputedStyleBase template files.

This is pre-work for when Fields can have both an internal storage and
external type (new attribute 'external_type'), and these types need to
be distinguished without being confusing.

BUG=628043

Review-Url: https://codereview.chromium.org/2563853002
Cr-Commit-Position: refs/heads/master@{#438022}
parent 861a5853
......@@ -35,8 +35,8 @@ class Field(object):
self.name = kwargs.pop('name')
# Name of property field is for
self.property_name = kwargs.pop('property_name')
# Field storage type
self.type = kwargs.pop('type')
# Internal field storage type
self.storage_type = kwargs.pop('storage_type')
# Bits needed for storage
self.size = kwargs.pop('size')
# Default value for field
......@@ -112,7 +112,7 @@ class ComputedStyleBaseWriter(make_style_builder.StyleBuilderWriter):
'inherited_flag',
name='m_' + field_name_suffix_lower,
property_name=property['name'],
type='bool',
storage_type='bool',
size=1,
default_value='true',
getter_method_name=field_name_suffix_lower,
......@@ -128,7 +128,7 @@ class ComputedStyleBaseWriter(make_style_builder.StyleBuilderWriter):
property_name=property['name'],
inherited=property['inherited'],
independent=property['independent'],
type=type_name,
storage_type=type_name,
size=int(math.ceil(bits_needed)),
default_value=default_value,
getter_method_name=property_name_lower,
......
......@@ -100,16 +100,16 @@ class CORE_EXPORT ComputedStyleBase {
// use resetFoo(), which can be more efficient.
{% for field in fields %}
// {{field.property_name}}
inline static {{field.type}} {{field.initial_method_name}}() { return {{field.default_value}}; }
{{field.type}} {{field.getter_method_name}}() const { return static_cast<{{field.type}}>({{field.name}}); }
void {{field.setter_method_name}}({{field.type}} v) { {{field.name}} = static_cast<unsigned>(v); }
inline static {{field.storage_type}} {{field.initial_method_name}}() { return {{field.default_value}}; }
{{field.storage_type}} {{field.getter_method_name}}() const { return static_cast<{{field.storage_type}}>({{field.name}}); }
void {{field.setter_method_name}}({{field.storage_type}} v) { {{field.name}} = static_cast<unsigned>(v); }
inline void {{field.resetter_method_name}}() { {{field.name}} = {{default_value(field)}}; }
{% endfor %}
protected:
// Storage.
{% for field in fields %}
unsigned {{field.name}} : {{field.size}}; // {{field.type}}
unsigned {{field.name}} : {{field.size}}; // {{field.storage_type}}
{% endfor %}
};
......
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