Example #1
0
    def __init__(self, in_files):
        super(StylePropertyShorthandWriter, self).__init__(in_files)
        self._outputs = {
            ('StylePropertyShorthand.cpp'):
            self.generate_style_property_shorthand_cpp,
            ('StylePropertyShorthand.h'):
            self.generate_style_property_shorthand_h
        }

        self._properties = self.in_file.name_dictionaries
        self._longhand_dictionary = defaultdict(list)

        for property in self._properties:
            cc = camelcase_property_name(property['name'])
            property['property_id'] = _create_css_property_name_enum_value(cc)
            cc = lower_first(cc)
            property['camel_case_name'] = cc
            longhands = property['longhands'].split(';')
            property['camel_case_longhands'] = list()
            for longhand in longhands:
                longhand = camelcase_property_name(longhand)
                longhand = _create_css_property_name_enum_value(longhand)
                property['camel_case_longhands'].append(longhand)
                self._longhand_dictionary[longhand].append(property)
            if property['runtimeEnabledShorthand'] is not None:
                lowerFirstConditional = lower_first(
                    property['runtimeEnabledShorthand'])
                property[
                    'runtime_conditional_getter'] = '%sEnabled' % lowerFirstConditional
        self._properties = dict((property['property_id'], property)
                                for property in self._properties)
    def __init__(self, in_files):
        super(StylePropertyShorthandWriter, self).__init__(in_files)
        self._outputs = {
            ('StylePropertyShorthand.cpp'): self.generate_style_property_shorthand_cpp,
            ('StylePropertyShorthand.h'): self.generate_style_property_shorthand_h}

        self._properties = self.in_file.name_dictionaries
        self._longhand_dictionary = defaultdict(list)

        for property in self._properties:
            cc = camelcase_property_name(property['name'])
            property['property_id'] = _create_css_property_name_enum_value(cc)
            cc = lower_first(cc)
            property['camel_case_name'] = cc
            longhands = property['longhands'].split(';')
            property['camel_case_longhands'] = list()
            for longhand in longhands:
                longhand = camelcase_property_name(longhand)
                longhand = _create_css_property_name_enum_value(longhand)
                property['camel_case_longhands'].append(longhand)
                self._longhand_dictionary[longhand].append(property)
            if property['runtimeEnabledShorthand'] is not None:
                lowerFirstConditional = lower_first(property['runtimeEnabledShorthand'])
                property['runtime_conditional_getter'] = '%sEnabled' % lowerFirstConditional
        self._properties = dict((property['property_id'], property) for property in self._properties)
Example #3
0
    def __init__(self, file_paths):
        in_generator.Writer.__init__(self, file_paths)

        properties = self.in_file.name_dictionaries

        self._aliases = {
            property['name']: property['alias_for']
            for property in properties if property['alias_for']
        }
        properties = [
            property for property in properties if not property['alias_for']
        ]

        assert len(
            properties
        ) <= 1024, 'There are more than 1024 CSS Properties, you need to update CSSProperty.h/StylePropertyMetadata m_propertyID accordingly.'
        # We currently assign 0 to CSSPropertyInvalid
        self._first_enum_value = 1
        for offset, property in enumerate(properties):
            property['property_id'] = css_name_to_enum(property['name'])
            property['upper_camel_name'] = camelcase_css_name(property['name'])
            property['lower_camel_name'] = lower_first(
                property['upper_camel_name'])
            property['enum_value'] = self._first_enum_value + offset
            property['is_internal'] = property['name'].startswith('-internal-')

        self._properties_list = properties
        self._properties = {
            property['property_id']: property
            for property in properties
        }
Example #4
0
    def __init__(self, json5_file_path):
        super(RuntimeFeatureWriter, self).__init__(json5_file_path)
        self._outputs = {
            (self.class_name + '.h'): self.generate_header,
            (self.class_name + '.cpp'): self.generate_implementation,
        }

        self._features = self.json5_file.name_dictionaries
        # Make sure the resulting dictionaries have all the keys we expect.
        for feature in self._features:
            feature['first_lowered_name'] = lower_first(feature['name'])
            # Most features just check their isFooEnabled bool
            # but some depend on or are implied by other bools.
            enabled_condition = 'is%sEnabled' % feature['name']
            assert not feature['implied_by'] or not feature[
                'depends_on'], 'Only one of implied_by and depends_on is allowed'
            for implied_by_name in feature['implied_by']:
                enabled_condition += ' || is%sEnabled' % implied_by_name
            for dependant_name in feature['depends_on']:
                enabled_condition += ' && is%sEnabled' % dependant_name
            feature['enabled_condition'] = enabled_condition
        self._standard_features = [
            feature for feature in self._features if not feature['custom']
        ]
        self._origin_trial_features = [
            feature for feature in self._features
            if feature['origin_trial_feature_name']
        ]
    def __init__(self, file_paths):
        in_generator.Writer.__init__(self, file_paths)

        properties = self.in_file.name_dictionaries

        self._aliases = [property for property in properties if property['alias_for']]
        properties = [property for property in properties if not property['alias_for']]

        # StylePropertyMetadata additionally assumes there are under 1024 properties.
        assert len(properties) < 512, 'Property aliasing expects there are under 512 properties.'

        # We currently assign 0 to CSSPropertyInvalid
        self._first_enum_value = 1
        for offset, property in enumerate(properties):
            property['property_id'] = css_name_to_enum(property['name'])
            property['upper_camel_name'] = camelcase_css_name(property['name'])
            property['lower_camel_name'] = lower_first(property['upper_camel_name'])
            property['enum_value'] = self._first_enum_value + offset
            property['is_internal'] = property['name'].startswith('-internal-')

        self._properties_including_aliases = properties
        self._properties = {property['property_id']: property for property in properties}

        # The generated code will only work with at most one alias per property
        assert len({property['alias_for'] for property in self._aliases}) == len(self._aliases)

        for property in self._aliases:
            property['property_id'] = css_alias_name_to_enum(property['name'])
            aliased_property = self._properties[css_name_to_enum(property['alias_for'])]
            property['enum_value'] = aliased_property['enum_value'] + 512
        self._properties_including_aliases += self._aliases
Example #6
0
    def __init__(self, in_file_path):
        super(StyleBuilderWriter, self).__init__(in_file_path)
        self._outputs = {('StyleBuilderFunctions.h'): self.generate_style_builder_functions_h,
                         ('StyleBuilderFunctions.cpp'): self.generate_style_builder_functions_cpp,
                         ('StyleBuilder.cpp'): self.generate_style_builder,
                        }

        def set_if_none(property, key, value):
            if property[key] is None:
                property[key] = value

        for property in self._properties.values():
            upper_camel = property['upper_camel_name']
            set_if_none(property, 'name_for_methods', upper_camel.replace('Webkit', ''))
            name = property['name_for_methods']
            set_if_none(property, 'type_name', 'E' + name)
            set_if_none(property, 'getter', lower_first(name))
            set_if_none(property, 'setter', 'set' + name)
            set_if_none(property, 'initial', 'initial' + name)
            if property['custom_all']:
                property['custom_initial'] = True
                property['custom_inherit'] = True
                property['custom_value'] = True
            property['should_declare_functions'] = not property['use_handlers_for'] and not property['longhands'] \
                                                   and not property['direction_aware'] and not property['builder_skip']
    def __init__(self, in_files):
        super(StyleBuilderWriter, self).__init__(in_files)
        self._outputs = {
            ('StyleBuilderFunctions.h'):
            self.generate_style_builder_functions_h,
            ('StyleBuilderFunctions.cpp'):
            self.generate_style_builder_functions_cpp,
            ('StyleBuilder.cpp'): self.generate_style_builder,
        }

        self._properties = self.in_file.name_dictionaries

        def set_if_none(property, key, value):
            if property[key] is None:
                property[key] = value

        for property in self._properties:
            cc = camelcase_property_name(property['name'])
            property['property_id'] = 'CSSProperty' + cc
            cc = property['name_for_methods'] or cc.replace('Webkit', '')
            property['camel_case_name'] = cc
            set_if_none(property, 'type_name', 'E' + cc)
            set_if_none(property, 'getter', lower_first(cc))
            set_if_none(property, 'setter', 'set' + cc)
            set_if_none(property, 'initial', 'initial' + cc)
            if property['custom_all']:
                property['custom_initial'] = True
                property['custom_inherit'] = True
                property['custom_value'] = True
            property['should_declare_functions'] = not property[
                'use_handlers_for'] and not property[
                    'direction_aware'] and not property['skip']

        self._properties = dict((property['property_id'], property)
                                for property in self._properties)
    def __init__(self, file_paths):
        in_generator.Writer.__init__(self, file_paths)

        properties = self.in_file.name_dictionaries
        self._descriptors = [property for property in properties if property['descriptor_only']]

        self._aliases = [property for property in properties if property['alias_for']]
        properties = [property for property in properties if not property['alias_for']]

        # 0: CSSPropertyInvalid
        # 1: CSSPropertyApplyAtRule
        # 2: CSSPropertyVariable
        self._first_enum_value = 3

        # StylePropertyMetadata additionally assumes there are under 1024 properties.
        assert self._first_enum_value + len(properties) < 512, 'Property aliasing expects there are under 512 properties.'

        for offset, property in enumerate(properties):
            property['property_id'] = name_utilities.enum_for_css_property(property['name'])
            property['upper_camel_name'] = name_utilities.camel_case(property['name'])
            property['lower_camel_name'] = name_utilities.lower_first(property['upper_camel_name'])
            property['enum_value'] = self._first_enum_value + offset
            property['is_internal'] = property['name'].startswith('-internal-')

        self._properties_including_aliases = properties
        self._properties = {property['property_id']: property for property in properties}

        # The generated code will only work with at most one alias per property
        assert len({property['alias_for'] for property in self._aliases}) == len(self._aliases)

        for property in self._aliases:
            property['property_id'] = name_utilities.enum_for_css_property_alias(property['name'])
            aliased_property = self._properties[name_utilities.enum_for_css_property(property['alias_for'])]
            property['enum_value'] = aliased_property['enum_value'] + 512
        self._properties_including_aliases += self._aliases
Example #9
0
    def __init__(self, in_files):
        super(StyleBuilderWriter, self).__init__(in_files)
        self._outputs = {('StyleBuilderFunctions.h'): self.generate_style_builder_functions_h,
                         ('StyleBuilderFunctions.cpp'): self.generate_style_builder_functions_cpp,
                         ('StyleBuilder.cpp'): self.generate_style_builder,
                        }

        self._properties = self.in_file.name_dictionaries

        def set_if_none(property, key, value):
            if property[key] is None:
                property[key] = value

        for property in self._properties:
            cc = camelcase_property_name(property['name'])
            property['property_id'] = 'CSSProperty' + cc
            cc = property['name_for_methods'] or cc.replace('Webkit', '')
            property['camel_case_name'] = cc
            set_if_none(property, 'type_name', 'E' + cc)
            set_if_none(property, 'getter', lower_first(cc))
            set_if_none(property, 'setter', 'set' + cc)
            set_if_none(property, 'initial', 'initial' + cc)
            if property['custom_all']:
                property['custom_initial'] = True
                property['custom_inherit'] = True
                property['custom_value'] = True
            property['should_declare_functions'] = not property['use_handlers_for'] and not property['direction_aware']

        self._properties = dict((property['property_id'], property) for property in self._properties)
Example #10
0
    def __init__(self, file_paths):
        in_generator.Writer.__init__(self, file_paths)

        properties = self.in_file.name_dictionaries
        self._descriptors = [
            property for property in properties if property['descriptor_only']
        ]

        self._aliases = [
            property for property in properties if property['alias_for']
        ]
        properties = [
            property for property in properties if not property['alias_for']
        ]

        # 0: CSSPropertyInvalid
        # 1: CSSPropertyApplyAtRule
        # 2: CSSPropertyVariable
        self._first_enum_value = 3

        # StylePropertyMetadata additionally assumes there are under 1024 properties.
        assert self._first_enum_value + len(
            properties
        ) < 512, 'Property aliasing expects there are under 512 properties.'

        for offset, property in enumerate(properties):
            property['property_id'] = name_utilities.enum_for_css_property(
                property['name'])
            property['upper_camel_name'] = name_utilities.camel_case(
                property['name'])
            property['lower_camel_name'] = name_utilities.lower_first(
                property['upper_camel_name'])
            property['enum_value'] = self._first_enum_value + offset
            property['is_internal'] = property['name'].startswith('-internal-')

        self._properties_including_aliases = properties
        self._properties = {
            property['property_id']: property
            for property in properties
        }

        # The generated code will only work with at most one alias per property
        assert len({property['alias_for']
                    for property in self._aliases}) == len(self._aliases)

        for property in self._aliases:
            property[
                'property_id'] = name_utilities.enum_for_css_property_alias(
                    property['name'])
            aliased_property = self._properties[
                name_utilities.enum_for_css_property(property['alias_for'])]
            property['enum_value'] = aliased_property['enum_value'] + 512
        self._properties_including_aliases += self._aliases
 def _factory_implementation(self, event):
     if event['RuntimeEnabled']:
         runtime_condition = ' && RuntimeEnabledFeatures::%s()' % name_utilities.lower_first(event['RuntimeEnabled'])
     else:
         runtime_condition = ''
     script_name = name_utilities.script_name(event)
     cpp_name = name_utilities.cpp_name(event)
     implementation = """    if (type == "%(script_name)s"%(runtime_condition)s)
     return %(cpp_name)s::create();""" % {
         'script_name': script_name,
         'runtime_condition': runtime_condition,
         'cpp_name': cpp_name,
     }
     return self.wrap_with_condition(implementation, event['Conditional'])
Example #12
0
 def _factory_implementation(self, event):
     if event['EnabledAtRuntime']:
         runtime_condition = ' && RuntimeEnabledFeatures::%s()' % lower_first(event['EnabledAtRuntime'])
     else:
         runtime_condition = ''
     name = os.path.basename(event['name'])
     class_name = self._class_name_for_entry(event)
     implementation = """    if (type == "%(name)s"%(runtime_condition)s)
     return %(class_name)s::create();""" % {
         'name': name,
         'runtime_condition': runtime_condition,
         'class_name': class_name,
     }
     return self.wrap_with_condition(implementation, event['Conditional'])
def _create_property_field(property_):
    """
    Create a property field from a CSS property and return the Field object.
    """
    property_name = property_['name_for_methods']
    property_name_lower = lower_first(property_name)

    # From the Blink style guide: Other data members should be prefixed by "m_". [names-data-members]
    field_name = 'm_' + property_name_lower
    bits_needed = math.log(len(property_['keywords']), 2)

    # Separate the type path from the type name, if specified.
    if property_['field_storage_type']:
        type_path = property_['field_storage_type']
        type_name = type_path.split('/')[-1]
    else:
        type_name = property_['type_name']
        type_path = None

    # For now, the getter name should match the field name. Later, getter names
    # will start with an uppercase letter, so if they conflict with the type name,
    # add 'get' to the front.
    getter_method_name = property_name_lower
    if type_name == property_name:
        getter_method_name = 'get' + property_name

    assert property_['initial_keyword'] is not None, \
        ('MakeComputedStyleBase requires an initial keyword for keyword_only values, none specified '
         'for property ' + property_['name'])
    default_value = type_name + '::k' + camel_case(
        property_['initial_keyword'])

    # Add the property itself as a member variable.
    return Field(
        'property',
        name=field_name,
        property_name=property_['name'],
        inherited=property_['inherited'],
        independent=property_['independent'],
        storage_type=type_name,
        storage_type_path=type_path,
        size=int(math.ceil(bits_needed)),
        default_value=default_value,
        getter_method_name=getter_method_name,
        setter_method_name='set' + property_name,
        initial_method_name='initial' + property_name,
        resetter_method_name='reset' + property_name,
        is_inherited_method_name=property_name_lower + 'IsInherited',
    )
    def __init__(self, in_file_path):
        super(RuntimeFeatureWriter, self).__init__(in_file_path)
        self._outputs = {(self.class_name + ".h"): self.generate_header,
                         (self.class_name + ".cpp"): self.generate_implementation,
                        }

        self._features = self.in_file.name_dictionaries
        # Make sure the resulting dictionaries have all the keys we expect.
        for feature in self._features:
            feature['first_lowered_name'] = lower_first(feature['name'])
            # Most features just check their isFooEnabled bool
            # but some depend on more than one bool.
            enabled_condition = "is%sEnabled" % feature['name']
            for dependant_name in feature['depends_on']:
                enabled_condition += " && is%sEnabled" % dependant_name
            feature['enabled_condition'] = enabled_condition
        self._non_custom_features = filter(lambda feature: not feature['custom'], self._features)
Example #15
0
    def __init__(self, file_paths):
        in_generator.Writer.__init__(self, file_paths)

        properties = self.in_file.name_dictionaries

        self._aliases = [
            property for property in properties if property['alias_for']
        ]
        properties = [
            property for property in properties if not property['alias_for']
        ]

        # We currently assign 0 to CSSPropertyInvalid, and 1 to CSSPropertyVariable
        self._first_enum_value = 2

        # StylePropertyMetadata additionally assumes there are under 1024 properties.
        assert self._first_enum_value + len(
            properties
        ) < 512, 'Property aliasing expects there are under 512 properties.'

        for offset, property in enumerate(properties):
            property['property_id'] = css_name_to_enum(property['name'])
            property['upper_camel_name'] = camelcase_css_name(property['name'])
            property['lower_camel_name'] = lower_first(
                property['upper_camel_name'])
            property['enum_value'] = self._first_enum_value + offset
            property['is_internal'] = property['name'].startswith('-internal-')

        self._properties_including_aliases = properties
        self._properties = {
            property['property_id']: property
            for property in properties
        }

        # The generated code will only work with at most one alias per property
        assert len({property['alias_for']
                    for property in self._aliases}) == len(self._aliases)

        for property in self._aliases:
            property['property_id'] = css_alias_name_to_enum(property['name'])
            aliased_property = self._properties[css_name_to_enum(
                property['alias_for'])]
            property['enum_value'] = aliased_property['enum_value'] + 512
        self._properties_including_aliases += self._aliases
Example #16
0
    def __init__(self, in_file_path):
        super(RuntimeFeatureWriter, self).__init__(in_file_path)
        self._outputs = {(self.class_name + '.h'): self.generate_header,
                         (self.class_name + '.cpp'): self.generate_implementation,
                        }

        self._features = self.in_file.name_dictionaries
        # Make sure the resulting dictionaries have all the keys we expect.
        for feature in self._features:
            feature['first_lowered_name'] = lower_first(feature['name'])
            # Most features just check their isFooEnabled bool
            # but some depend on or are implied by other bools.
            enabled_condition = 'is%sEnabled' % feature['name']
            assert not feature['implied_by'] or not feature['depends_on'], 'Only one of implied_by and depends_on is allowed'
            for implied_by_name in feature['implied_by']:
                enabled_condition += ' || is%sEnabled' % implied_by_name
            for dependant_name in feature['depends_on']:
                enabled_condition += ' && is%sEnabled' % dependant_name
            feature['enabled_condition'] = enabled_condition
        self._non_custom_features = filter(lambda feature: not feature['custom'], self._features)
Example #17
0
    def __init__(self, file_paths):
        in_generator.Writer.__init__(self, file_paths)

        properties = self.in_file.name_dictionaries

        self._aliases = {property['name']: property['alias_for'] for property in properties if property['alias_for']}
        properties = [property for property in properties if not property['alias_for']]

        assert len(properties) <= 1024, 'There are more than 1024 CSS Properties, you need to update CSSProperty.h/StylePropertyMetadata m_propertyID accordingly.'
        # We currently assign 0 to CSSPropertyInvalid
        self._first_enum_value = 1
        for offset, property in enumerate(properties):
            property['property_id'] = css_name_to_enum(property['name'])
            property['upper_camel_name'] = camelcase_css_name(property['name'])
            property['lower_camel_name'] = lower_first(property['upper_camel_name'])
            property['enum_value'] = self._first_enum_value + offset
            property['is_internal'] = property['name'].startswith('-internal-')

        self._properties_list = properties
        self._properties = {property['property_id']: property for property in properties}
Example #18
0
def _create_property_field(property_):
    """
    Create a property field from a CSS property and return the Field object.
    """
    property_name = property_['name_for_methods']
    property_name_lower = lower_first(property_name)

    # From the Blink style guide: Other data members should be prefixed by "m_". [names-data-members]
    field_name = 'm_' + property_name_lower
    bits_needed = math.log(len(property_['keywords']), 2)  # TODO: implement for non-enums
    type_name = property_['type_name']

    # For now, the getter name should match the field name. Later, getter names
    # will start with an uppercase letter, so if they conflict with the type name,
    # add 'get' to the front.
    getter_method_name = property_name_lower
    if type_name == property_name:
        getter_method_name = 'get' + property_name

    assert property_['initial_keyword'] is not None, \
        ('MakeComputedStyleBase requires an initial keyword for keyword fields, none specified '
         'for property ' + property_['name'])
    default_value = type_name + '::k' + camel_case(property_['initial_keyword'])

    return Field(
        'property',
        name=field_name,
        property_name=property_['name'],
        inherited=property_['inherited'],
        independent=property_['independent'],
        type_name=type_name,
        field_template=property_['field_template'],
        size=int(math.ceil(bits_needed)),
        default_value=default_value,
        getter_method_name=getter_method_name,
        setter_method_name='set' + property_name,
        initial_method_name='initial' + property_name,
        resetter_method_name='reset' + property_name,
        is_inherited_method_name=property_name_lower + 'IsInherited',
    )
    def __init__(self, in_file_path):
        super(RuntimeFeatureWriter, self).__init__(in_file_path)
        self._outputs = {
            (self.class_name + ".h"): self.generate_header,
            (self.class_name + ".cpp"): self.generate_implementation,
        }

        self._features = self.in_file.name_dictionaries
        # Make sure the resulting dictionaries have all the keys we expect.
        for feature in self._features:
            feature["first_lowered_name"] = lower_first(feature["name"])
            # Most features just check their isFooEnabled bool
            # but some depend on or are implied by other bools.
            enabled_condition = "is%sEnabled" % feature["name"]
            assert (
                not feature["implied_by"] or not feature["depends_on"]
            ), "Only one of implied_by and depends_on is allowed"
            for implied_by_name in feature["implied_by"]:
                enabled_condition += " || is%sEnabled" % implied_by_name
            for dependant_name in feature["depends_on"]:
                enabled_condition += " && is%sEnabled" % dependant_name
            feature["enabled_condition"] = enabled_condition
        self._standard_features = [feature for feature in self._features if not feature["custom"]]
Example #20
0
    def __init__(self, json5_file_path):
        super(StyleBuilderWriter, self).__init__(json5_file_path)
        self._outputs = {
            ('StyleBuilderFunctions.h'):
            self.generate_style_builder_functions_h,
            ('StyleBuilderFunctions.cpp'):
            self.generate_style_builder_functions_cpp,
            ('StyleBuilder.cpp'): self.generate_style_builder,
        }

        def set_if_none(property, key, value):
            if property[key] is None:
                property[key] = value

        for property in self._properties.values():
            upper_camel = property['upper_camel_name']
            set_if_none(property, 'name_for_methods',
                        upper_camel.replace('Webkit', ''))
            name = property['name_for_methods']
            simple_type_name = str(property['type_name']).split('::')[-1]
            set_if_none(property, 'type_name', 'E' + name)
            set_if_none(
                property, 'getter',
                lower_first(name) if simple_type_name != name else 'get' +
                name)
            set_if_none(property, 'setter', 'set' + name)
            set_if_none(property, 'inherited', False)
            set_if_none(property, 'initial', 'initial' + name)
            if property['custom_all']:
                property['custom_initial'] = True
                property['custom_inherit'] = True
                property['custom_value'] = True
            if property['inherited']:
                property['is_inherited_setter'] = 'set' + name + 'IsInherited'
            property['should_declare_functions'] = not property['use_handlers_for'] and not property['longhands'] \
                and not property['direction_aware'] and not property['builder_skip'] \
                and not property['descriptor_only']
Example #21
0
def _create_inherited_flag_field(property_):
    """
    Create the field used for an inheritance fast path from an independent CSS property,
    and return the Field object.
    """
    property_name = property_['name_for_methods']
    property_name_lower = lower_first(property_name)

    field_name_suffix_upper = property_name + 'IsInherited'
    field_name_suffix_lower = property_name_lower + 'IsInherited'

    return Field(
        'inherited_flag',
        name='m_' + field_name_suffix_lower,
        property_name=property_['name'],
        type_name='bool',
        field_template='flag',
        size=1,
        default_value='true',
        getter_method_name=field_name_suffix_lower,
        setter_method_name='set' + field_name_suffix_upper,
        initial_method_name='initial' + field_name_suffix_upper,
        resetter_method_name='reset' + field_name_suffix_upper,
    )
Example #22
0
    def __init__(self, file_paths):
        json5_generator.Writer.__init__(self, file_paths)

        properties = self.json5_file.name_dictionaries

        # Sort properties by priority, then alphabetically.
        for property in properties:
            # This order must match the order in CSSPropertyPriority.h.
            priority_numbers = {'Animation': 0, 'High': 1, 'Low': 2}
            priority = priority_numbers[property['priority']]
            name_without_leading_dash = property['name']
            if property['name'].startswith('-'):
                name_without_leading_dash = property['name'][1:]
            property['sorting_key'] = (priority, name_without_leading_dash)

        # Assert there are no key collisions.
        sorting_keys = [p['sorting_key'] for p in properties]
        assert len(sorting_keys) == len(set(sorting_keys)), \
            ('Collision detected - two properties have the same name and priority, '
             'a potentially non-deterministic ordering can occur.')
        properties.sort(key=lambda p: p['sorting_key'])

        self._aliases = [
            property for property in properties if property['alias_for']
        ]
        properties = [
            property for property in properties if not property['alias_for']
        ]

        # 0: CSSPropertyInvalid
        # 1: CSSPropertyApplyAtRule
        # 2: CSSPropertyVariable
        self._first_enum_value = 3

        # StylePropertyMetadata additionally assumes there are under 1024 properties.
        assert self._first_enum_value + len(
            properties
        ) < 512, 'Property aliasing expects there are under 512 properties.'

        for offset, property in enumerate(properties):
            property['property_id'] = name_utilities.enum_for_css_property(
                property['name'])
            property['upper_camel_name'] = name_utilities.camel_case(
                property['name'])
            property['lower_camel_name'] = name_utilities.lower_first(
                property['upper_camel_name'])
            property['enum_value'] = self._first_enum_value + offset
            property['is_internal'] = property['name'].startswith('-internal-')

        self._properties_including_aliases = properties
        self._properties = {
            property['property_id']: property
            for property in properties
        }

        # The generated code will only work with at most one alias per property
        assert len({property['alias_for']
                    for property in self._aliases}) == len(self._aliases)

        for property in self._aliases:
            property[
                'property_id'] = name_utilities.enum_for_css_property_alias(
                    property['name'])
            aliased_property = self._properties[
                name_utilities.enum_for_css_property(property['alias_for'])]
            property['enum_value'] = aliased_property['enum_value'] + 512
        self._properties_including_aliases += self._aliases