diff options
-rw-r--r-- | components/style/properties/data.py | 3 | ||||
-rw-r--r-- | components/style/properties/gecko.mako.rs | 30 |
2 files changed, 23 insertions, 10 deletions
diff --git a/components/style/properties/data.py b/components/style/properties/data.py index 2c9990ed7bc..2b11109bbc4 100644 --- a/components/style/properties/data.py +++ b/components/style/properties/data.py @@ -63,7 +63,7 @@ class Longhand(object): def __init__(self, style_struct, name, animatable=None, derived_from=None, keyword=None, predefined_type=None, custom_cascade=False, experimental=False, internal=False, need_clone=False, need_index=False, gecko_ffi_name=None, depend_on_viewport_size=False, - allowed_in_keyframe_block=True): + allowed_in_keyframe_block=True, complex_color=False): self.name = name self.keyword = keyword self.predefined_type = predefined_type @@ -77,6 +77,7 @@ class Longhand(object): self.gecko_ffi_name = gecko_ffi_name or "m" + self.camel_case self.depend_on_viewport_size = depend_on_viewport_size self.derived_from = (derived_from or "").split() + self.complex_color = complex_color # https://drafts.csswg.org/css-animations/#keyframes # > The <declaration-list> inside of <keyframe-block> accepts any CSS property diff --git a/components/style/properties/gecko.mako.rs b/components/style/properties/gecko.mako.rs index 24602685308..b7c1f01bc76 100644 --- a/components/style/properties/gecko.mako.rs +++ b/components/style/properties/gecko.mako.rs @@ -480,16 +480,29 @@ impl Debug for ${style_struct.gecko_struct_name} { # Types used with predefined_type()-defined properties that we can auto-generate. predefined_types = { - "LengthOrPercentage": impl_style_coord, - "LengthOrPercentageOrAuto": impl_style_coord, - "LengthOrPercentageOrNone": impl_style_coord, - "Number": impl_simple, - "Opacity": impl_simple, + "Length": impl_style_coord, + "LengthOrPercentage": impl_style_coord, + "LengthOrPercentageOrAuto": impl_style_coord, + "LengthOrPercentageOrNone": impl_style_coord, + "Number": impl_simple, + "Opacity": impl_simple, + "CSSColor": impl_color, } - keyword_longhands = [x for x in longhands if x.keyword and not x.name in force_stub] + def predefined_type_method(longhand): + args = dict(ident=longhand.ident, gecko_ffi_name=longhand.gecko_ffi_name, + need_clone=longhand.need_clone) + method = predefined_types[longhand.predefined_type] + + # additional type-specific arguments + if longhand.predefined_type in ["CSSColor"]: + args.update(complex_color=longhand.complex_color) + + method(**args) + + keyword_longhands = [x for x in longhands if x.keyword and x.name not in force_stub] predefined_longhands = [x for x in longhands - if x.predefined_type in predefined_types and not x.name in force_stub] + if x.predefined_type in predefined_types and x.name not in force_stub] stub_longhands = [x for x in longhands if x not in keyword_longhands + predefined_longhands] # If one of the longhands is not handled @@ -522,8 +535,7 @@ impl ${style_struct.gecko_struct_name} { for longhand in keyword_longhands: impl_keyword(longhand.ident, longhand.gecko_ffi_name, longhand.keyword, longhand.need_clone) for longhand in predefined_longhands: - impl_fn = predefined_types[longhand.predefined_type] - impl_fn(longhand.ident, longhand.gecko_ffi_name, need_clone=longhand.need_clone) + predefined_type_method(longhand) %> /* |