示例#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)
示例#3
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)
    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)