diff --git a/components/style/properties/helpers.mako.rs b/components/style/properties/helpers.mako.rs index 1e6c1400a18..3b8e10b5125 100644 --- a/components/style/properties/helpers.mako.rs +++ b/components/style/properties/helpers.mako.rs @@ -9,7 +9,7 @@ %> <%def name="predefined_type(name, type, initial_value, parse_method='parse', - needs_context=True, vector=False, + vector=False, computed_type=None, initial_specified_value=None, allow_quirks='No', allow_empty=False, **kwargs)"> <%def name="predefined_type_inner(name, type, initial_value, parse_method)"> @@ -45,10 +45,10 @@ ) -> Result> { % if allow_quirks != "No": specified::${type}::${parse_method}_quirky(context, input, AllowQuirks::${allow_quirks}) - % elif needs_context: + % elif parse_method != "parse": specified::${type}::${parse_method}(context, input) % else: - specified::${type}::${parse_method}(input) + ::parse(context, input) % endif } @@ -971,25 +971,21 @@ name, first_property, second_property, - parser_function, - needs_context=True, + parser_function='crate::parser::Parse::parse', **kwargs )"> <%call expr="self.shorthand(name, sub_properties=' '.join([first_property, second_property]), **kwargs)"> #[allow(unused_imports)] use crate::parser::Parse; + #[allow(unused_imports)] use crate::values::specified; pub fn parse_value<'i, 't>( context: &ParserContext, input: &mut Parser<'i, 't>, ) -> Result> { - let parse_one = |_c: &ParserContext, input: &mut Parser<'i, 't>| { - % if needs_context: - ${parser_function}(_c, input) - % else: - ${parser_function}(input) - % endif + let parse_one = |c: &ParserContext, input: &mut Parser<'i, 't>| -> Result> { + ${parser_function}(c, input) }; let first = parse_one(context, input)?; @@ -1017,26 +1013,26 @@ -<%def name="four_sides_shorthand(name, sub_property_pattern, parser_function, - needs_context=True, allow_quirks='No', **kwargs)"> +<%def name="four_sides_shorthand(name, sub_property_pattern, + parser_function='crate::parser::Parse::parse', + allow_quirks='No', **kwargs)"> <% sub_properties=' '.join(sub_property_pattern % side for side in PHYSICAL_SIDES) %> <%call expr="self.shorthand(name, sub_properties=sub_properties, **kwargs)"> #[allow(unused_imports)] use crate::parser::Parse; use crate::values::generics::rect::Rect; + #[allow(unused_imports)] use crate::values::specified; pub fn parse_value<'i, 't>( context: &ParserContext, input: &mut Parser<'i, 't>, ) -> Result> { - let rect = Rect::parse_with(context, input, |_c, i| { + let rect = Rect::parse_with(context, input, |c, i| -> Result> { % if allow_quirks != "No": - ${parser_function}_quirky(_c, i, specified::AllowQuirks::${allow_quirks}) - % elif needs_context: - ${parser_function}(_c, i) + ${parser_function}_quirky(c, i, specified::AllowQuirks::${allow_quirks}) % else: - ${parser_function}(i) + ${parser_function}(c, i) % endif })?; Ok(expanded! { diff --git a/components/style/properties/longhands/border.mako.rs b/components/style/properties/longhands/border.mako.rs index 1c4eae16939..11ed63a438a 100644 --- a/components/style/properties/longhands/border.mako.rs +++ b/components/style/properties/longhands/border.mako.rs @@ -42,7 +42,6 @@ animation_value_type="discrete" if not is_logical else "none", logical=is_logical, logical_group="border-style", - needs_context=False, )} ${helpers.predefined_type( diff --git a/components/style/properties/longhands/box.mako.rs b/components/style/properties/longhands/box.mako.rs index cf30afaa1ae..810368be155 100644 --- a/components/style/properties/longhands/box.mako.rs +++ b/components/style/properties/longhands/box.mako.rs @@ -71,7 +71,6 @@ ${helpers.predefined_type( initial_specified_value="specified::Float::None", spec="https://drafts.csswg.org/css-box/#propdef-float", animation_value_type="discrete", - needs_context=False, servo_restyle_damage="rebuild_and_reflow", gecko_ffi_name="mFloat", )} @@ -82,7 +81,6 @@ ${helpers.predefined_type( "computed::Clear::None", engines="gecko servo-2013", animation_value_type="discrete", - needs_context=False, gecko_ffi_name="mBreakType", spec="https://drafts.csswg.org/css-box/#propdef-clear", servo_restyle_damage="rebuild_and_reflow", @@ -117,7 +115,6 @@ ${helpers.single_keyword( "computed::OverflowClipBox::PaddingBox", engines="gecko", enabled_in="ua", - needs_context=False, gecko_pref="layout.css.overflow-clip-box.enabled", animation_value_type="discrete", spec="Internal, may be standardized in the future: \ @@ -136,7 +133,6 @@ ${helpers.single_keyword( logical=logical, animation_value_type="discrete", spec="https://drafts.csswg.org/css-overflow-3/#propdef-{}".format(full_name), - needs_context=False, servo_restyle_damage = "reflow", gecko_pref="layout.css.overflow-logical.enabled" if logical else None, )} @@ -148,7 +144,6 @@ ${helpers.predefined_type( "computed::OverflowAnchor::Auto", engines="gecko", initial_specified_value="specified::OverflowAnchor::Auto", - needs_context=False, gecko_pref="layout.css.scroll-anchoring.enabled", spec="https://drafts.csswg.org/css-scroll-anchoring/#exclusion-api", animation_value_type="discrete", @@ -468,7 +463,6 @@ ${helpers.predefined_type( "OverscrollBehavior", "computed::OverscrollBehavior::Auto", engines="gecko", - needs_context=False, logical_group="overscroll-behavior", logical=logical, gecko_pref="layout.css.overscroll-behavior.enabled", @@ -494,7 +488,6 @@ ${helpers.predefined_type( "BreakBetween", "computed::BreakBetween::Auto", engines="gecko", - needs_context=False, spec="https://drafts.csswg.org/css-break/#propdef-break-after", animation_value_type="discrete", )} @@ -504,7 +497,6 @@ ${helpers.predefined_type( "BreakBetween", "computed::BreakBetween::Auto", engines="gecko", - needs_context=False, spec="https://drafts.csswg.org/css-break/#propdef-break-before", animation_value_type="discrete", )} @@ -514,7 +506,6 @@ ${helpers.predefined_type( "BreakWithin", "computed::BreakWithin::Auto", engines="gecko", - needs_context=False, alias="page-break-inside", spec="https://drafts.csswg.org/css-break/#propdef-break-inside", animation_value_type="discrete", @@ -528,7 +519,6 @@ ${helpers.predefined_type( "computed::Resize::None", engines="gecko", animation_value_type="discrete", - needs_context=False, gecko_ffi_name="mResize", spec="https://drafts.csswg.org/css-ui/#propdef-resize", )} @@ -584,7 +574,6 @@ ${helpers.predefined_type( "computed::TransformStyle::Flat", engines="gecko servo-2013 servo-2020", spec="https://drafts.csswg.org/css-transforms-2/#transform-style-property", - needs_context=False, extra_prefixes=transform_extra_prefixes, flags="CREATES_STACKING_CONTEXT FIXPOS_CB", animation_value_type="discrete", diff --git a/components/style/properties/longhands/column.mako.rs b/components/style/properties/longhands/column.mako.rs index 1974e82d137..2d9a116d30b 100644 --- a/components/style/properties/longhands/column.mako.rs +++ b/components/style/properties/longhands/column.mako.rs @@ -84,7 +84,6 @@ ${helpers.predefined_type( "BorderStyle", "computed::BorderStyle::None", engines="gecko", - needs_context=False, initial_specified_value="specified::BorderStyle::None", extra_prefixes="moz:layout.css.prefixes.columns", animation_value_type="discrete", diff --git a/components/style/properties/longhands/inherited_svg.mako.rs b/components/style/properties/longhands/inherited_svg.mako.rs index 73db38e0042..820b2d25d04 100644 --- a/components/style/properties/longhands/inherited_svg.mako.rs +++ b/components/style/properties/longhands/inherited_svg.mako.rs @@ -72,7 +72,6 @@ ${helpers.predefined_type( "FillRule", "Default::default()", engines="gecko", - needs_context=False, animation_value_type="discrete", spec="https://www.w3.org/TR/SVG11/painting.html#FillRuleProperty", )} @@ -165,7 +164,6 @@ ${helpers.predefined_type( "FillRule", "Default::default()", engines="gecko", - needs_context=False, animation_value_type="discrete", spec="https://www.w3.org/TR/SVG11/masking.html#ClipRuleProperty", )} diff --git a/components/style/properties/longhands/inherited_table.mako.rs b/components/style/properties/longhands/inherited_table.mako.rs index 5630d1070ea..b38df2423a1 100644 --- a/components/style/properties/longhands/inherited_table.mako.rs +++ b/components/style/properties/longhands/inherited_table.mako.rs @@ -30,7 +30,6 @@ ${helpers.predefined_type( "caption-side", "table::CaptionSide", "computed::table::CaptionSide::Top", - needs_context=False, engines="gecko servo-2013", animation_value_type="discrete", spec="https://drafts.csswg.org/css-tables/#propdef-caption-side", diff --git a/components/style/properties/longhands/inherited_text.mako.rs b/components/style/properties/longhands/inherited_text.mako.rs index c108bbcc75f..3720119ce88 100644 --- a/components/style/properties/longhands/inherited_text.mako.rs +++ b/components/style/properties/longhands/inherited_text.mako.rs @@ -83,7 +83,6 @@ ${helpers.predefined_type( animation_value_type="discrete", spec="https://drafts.csswg.org/css-text/#propdef-overflow-wrap", alias="word-wrap", - needs_context=False, servo_restyle_damage="rebuild_and_reflow", )} @@ -95,7 +94,6 @@ ${helpers.predefined_type( servo_2020_pref="layout.2020.unimplemented", animation_value_type="discrete", spec="https://drafts.csswg.org/css-text/#propdef-word-break", - needs_context=False, servo_restyle_damage="rebuild_and_reflow", )} @@ -143,7 +141,6 @@ ${helpers.predefined_type( "text-align-last", "TextAlignLast", "computed::text::TextAlignLast::Auto", - needs_context=False, engines="gecko", animation_value_type="discrete", spec="https://drafts.csswg.org/css-text/#propdef-text-align-last", @@ -286,7 +283,6 @@ ${helpers.predefined_type( engines="gecko", animation_value_type="discrete", spec="https://drafts.csswg.org/css-text-3/#line-break-property", - needs_context=False, )} // CSS Compatibility @@ -402,7 +398,6 @@ ${helpers.predefined_type( "TextDecorationSkipInk", "computed::TextDecorationSkipInk::Auto", engines="gecko", - needs_context=False, animation_value_type="discrete", spec="https://drafts.csswg.org/css-text-decor-4/#text-decoration-skip-ink-property", )} diff --git a/components/style/properties/longhands/list.mako.rs b/components/style/properties/longhands/list.mako.rs index 82e226418cd..b9a11a574f5 100644 --- a/components/style/properties/longhands/list.mako.rs +++ b/components/style/properties/longhands/list.mako.rs @@ -91,7 +91,6 @@ ${helpers.predefined_type( engines="gecko", animation_value_type="discrete", enabled_in="ua", - needs_context=False, spec="Internal implementation detail for
    ", servo_restyle_damage="rebuild_and_reflow", )} diff --git a/components/style/properties/longhands/ui.mako.rs b/components/style/properties/longhands/ui.mako.rs index e205c82da99..1dfdfcc1a73 100644 --- a/components/style/properties/longhands/ui.mako.rs +++ b/components/style/properties/longhands/ui.mako.rs @@ -37,7 +37,6 @@ ${helpers.predefined_type( engines="gecko", extra_prefixes="moz webkit", animation_value_type="discrete", - needs_context=False, spec="https://drafts.csswg.org/css-ui-4/#propdef-user-select", )} diff --git a/components/style/properties/shorthands/border.mako.rs b/components/style/properties/shorthands/border.mako.rs index 7419ad90217..c204c878444 100644 --- a/components/style/properties/shorthands/border.mako.rs +++ b/components/style/properties/shorthands/border.mako.rs @@ -17,9 +17,7 @@ ${helpers.four_sides_shorthand( ${helpers.four_sides_shorthand( "border-style", "border-%s-style", - "specified::BorderStyle::parse", engines="gecko servo-2013 servo-2020", - needs_context=False, spec="https://drafts.csswg.org/css-backgrounds/#border-style", )} diff --git a/components/style/properties/shorthands/box.mako.rs b/components/style/properties/shorthands/box.mako.rs index e1b94e52ac3..24cb850b971 100644 --- a/components/style/properties/shorthands/box.mako.rs +++ b/components/style/properties/shorthands/box.mako.rs @@ -8,10 +8,8 @@ ${helpers.two_properties_shorthand( "overflow", "overflow-x", "overflow-y", - "specified::Overflow::parse", engines="gecko servo-2013 servo-2020", flags="SHORTHAND_IN_GETCS", - needs_context=False, spec="https://drafts.csswg.org/css-overflow/#propdef-overflow", )} @@ -19,10 +17,8 @@ ${helpers.two_properties_shorthand( "overflow-clip-box", "overflow-clip-box-block", "overflow-clip-box-inline", - "specified::OverflowClipBox::parse", engines="gecko", enabled_in="ua", - needs_context=False, gecko_pref="layout.css.overflow-clip-box.enabled", spec="Internal, may be standardized in the future " "(https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-clip-box)", @@ -310,9 +306,7 @@ ${helpers.two_properties_shorthand( "overscroll-behavior", "overscroll-behavior-x", "overscroll-behavior-y", - "specified::OverscrollBehavior::parse", engines="gecko", - needs_context=False, gecko_pref="layout.css.overscroll-behavior.enabled", spec="https://wicg.github.io/overscroll-behavior/#overscroll-behavior-properties", )}