From d552969ca14baf142f913993aa7bc4cf2401654e Mon Sep 17 00:00:00 2001 From: violet Date: Thu, 16 May 2019 00:44:51 +0000 Subject: [PATCH] style: Support AllowQuirks::Always option in helpers.mako.rs Differential Revision: https://phabricator.services.mozilla.com/D29936 --- components/style/properties/data.py | 2 +- components/style/properties/helpers.mako.rs | 16 ++++++++-------- .../properties/longhands/background.mako.rs | 2 +- .../style/properties/longhands/border.mako.rs | 4 ++-- .../style/properties/longhands/effects.mako.rs | 2 +- .../style/properties/longhands/font.mako.rs | 2 +- .../properties/longhands/inherited_text.mako.rs | 2 +- .../style/properties/longhands/margin.mako.rs | 2 +- .../style/properties/longhands/padding.mako.rs | 2 +- .../style/properties/longhands/position.mako.rs | 8 ++++---- .../style/properties/shorthands/border.mako.rs | 2 +- .../style/properties/shorthands/margin.mako.rs | 2 +- .../style/properties/shorthands/padding.mako.rs | 2 +- .../style/properties/shorthands/position.mako.rs | 2 +- 14 files changed, 25 insertions(+), 25 deletions(-) diff --git a/components/style/properties/data.py b/components/style/properties/data.py index daeb82ffab9..a7a3479974b 100644 --- a/components/style/properties/data.py +++ b/components/style/properties/data.py @@ -172,7 +172,7 @@ class Longhand(object): gecko_ffi_name=None, allowed_in_keyframe_block=True, cast_type='u8', logical=False, logical_group=None, alias=None, extra_prefixes=None, boxed=False, - flags=None, allowed_in_page_rule=False, allow_quirks=False, + flags=None, allowed_in_page_rule=False, allow_quirks="No", ignored_when_colors_disabled=False, simple_vector_bindings=False, vector=False, servo_restyle_damage="repaint"): diff --git a/components/style/properties/helpers.mako.rs b/components/style/properties/helpers.mako.rs index a890534518f..56637af9463 100644 --- a/components/style/properties/helpers.mako.rs +++ b/components/style/properties/helpers.mako.rs @@ -10,7 +10,7 @@ <%def name="predefined_type(name, type, initial_value, parse_method='parse', needs_context=True, vector=False, computed_type=None, initial_specified_value=None, - allow_quirks=False, allow_empty=False, **kwargs)"> + allow_quirks='No', allow_empty=False, **kwargs)"> <%def name="predefined_type_inner(name, type, initial_value, parse_method)"> #[allow(unused_imports)] use app_units::Au; @@ -42,8 +42,8 @@ context: &ParserContext, input: &mut Parser<'i, 't>, ) -> Result> { - % if allow_quirks: - specified::${type}::${parse_method}_quirky(context, input, AllowQuirks::Yes) + % if allow_quirks != "No": + specified::${type}::${parse_method}_quirky(context, input, AllowQuirks::${allow_quirks}) % elif needs_context: specified::${type}::${parse_method}(context, input) % else: @@ -523,8 +523,8 @@ context: &ParserContext, input: &mut Parser<'i, 't>, ) -> Result> { - % if property.allow_quirks: - parse_quirky(context, input, specified::AllowQuirks::Yes) + % if property.allow_quirks != "No": + parse_quirky(context, input, specified::AllowQuirks::${property.allow_quirks}) % else: parse(context, input) % endif @@ -986,7 +986,7 @@ <%def name="four_sides_shorthand(name, sub_property_pattern, parser_function, - needs_context=True, allow_quirks=False, **kwargs)"> + needs_context=True, 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)] @@ -999,8 +999,8 @@ input: &mut Parser<'i, 't>, ) -> Result> { let rect = Rect::parse_with(context, input, |_c, i| { - % if allow_quirks: - ${parser_function}_quirky(_c, i, specified::AllowQuirks::Yes) + % if allow_quirks != "No": + ${parser_function}_quirky(_c, i, specified::AllowQuirks::${allow_quirks}) % elif needs_context: ${parser_function}(_c, i) % else: diff --git a/components/style/properties/longhands/background.mako.rs b/components/style/properties/longhands/background.mako.rs index 42344a18cb9..9c66e4676f9 100644 --- a/components/style/properties/longhands/background.mako.rs +++ b/components/style/properties/longhands/background.mako.rs @@ -14,7 +14,7 @@ ${helpers.predefined_type( spec="https://drafts.csswg.org/css-backgrounds/#background-color", animation_value_type="AnimatedColor", ignored_when_colors_disabled=True, - allow_quirks=True, + allow_quirks="Yes", flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER \ CAN_ANIMATE_ON_COMPOSITOR", )} diff --git a/components/style/properties/longhands/border.mako.rs b/components/style/properties/longhands/border.mako.rs index 13a7f237350..7ea8b8dd0eb 100644 --- a/components/style/properties/longhands/border.mako.rs +++ b/components/style/properties/longhands/border.mako.rs @@ -28,7 +28,7 @@ animation_value_type="AnimatedColor", logical=is_logical, logical_group="border-color", - allow_quirks=not is_logical, + allow_quirks="No" if is_logical else "Yes", flags="APPLIES_TO_FIRST_LETTER", ignored_when_colors_disabled=True, )} @@ -56,7 +56,7 @@ logical=is_logical, logical_group="border-width", flags="APPLIES_TO_FIRST_LETTER GETCS_NEEDS_LAYOUT_FLUSH", - allow_quirks=not is_logical, + allow_quirks="No" if is_logical else "Yes", servo_restyle_damage="reflow rebuild_and_reflow_inline" )} % endfor diff --git a/components/style/properties/longhands/effects.mako.rs b/components/style/properties/longhands/effects.mako.rs index aead5f56508..9bb8adda32e 100644 --- a/components/style/properties/longhands/effects.mako.rs +++ b/components/style/properties/longhands/effects.mako.rs @@ -38,7 +38,7 @@ ${helpers.predefined_type( "computed::ClipRectOrAuto::auto()", animation_value_type="ComputedValue", boxed=True, - allow_quirks=True, + allow_quirks="Yes", spec="https://drafts.fxtf.org/css-masking/#clip-property", )} diff --git a/components/style/properties/longhands/font.mako.rs b/components/style/properties/longhands/font.mako.rs index c1d3d8fcc6c..8d84ef34cb3 100644 --- a/components/style/properties/longhands/font.mako.rs +++ b/components/style/properties/longhands/font.mako.rs @@ -64,7 +64,7 @@ ${helpers.predefined_type( initial_value="computed::FontSize::medium()", initial_specified_value="specified::FontSize::medium()", animation_value_type="NonNegativeLength", - allow_quirks=True, + allow_quirks="Yes", flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER", spec="https://drafts.csswg.org/css-fonts/#propdef-font-size", servo_restyle_damage="rebuild_and_reflow", diff --git a/components/style/properties/longhands/inherited_text.mako.rs b/components/style/properties/longhands/inherited_text.mako.rs index 94af642713e..e8f56cf2cde 100644 --- a/components/style/properties/longhands/inherited_text.mako.rs +++ b/components/style/properties/longhands/inherited_text.mako.rs @@ -56,7 +56,7 @@ ${helpers.predefined_type( "computed::LengthPercentage::zero()", animation_value_type="ComputedValue", spec="https://drafts.csswg.org/css-text/#propdef-text-indent", - allow_quirks=True, + allow_quirks="Yes", servo_restyle_damage = "reflow", )} diff --git a/components/style/properties/longhands/margin.mako.rs b/components/style/properties/longhands/margin.mako.rs index d2a3be11d1d..c3289c34b7c 100644 --- a/components/style/properties/longhands/margin.mako.rs +++ b/components/style/properties/longhands/margin.mako.rs @@ -17,7 +17,7 @@ "LengthPercentageOrAuto", "computed::LengthPercentageOrAuto::zero()", alias=maybe_moz_logical_alias(product, side, "-moz-margin-%s"), - allow_quirks=not side[1], + allow_quirks="No" if side[1] else "Yes", animation_value_type="ComputedValue", logical=side[1], logical_group="margin", diff --git a/components/style/properties/longhands/padding.mako.rs b/components/style/properties/longhands/padding.mako.rs index a1262aee0fc..6142bbf901e 100644 --- a/components/style/properties/longhands/padding.mako.rs +++ b/components/style/properties/longhands/padding.mako.rs @@ -24,7 +24,7 @@ logical_group="padding", spec=spec, flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_PLACEHOLDER GETCS_NEEDS_LAYOUT_FLUSH", - allow_quirks=not side[1], + allow_quirks="No" if side[1] else "Yes", servo_restyle_damage="reflow rebuild_and_reflow_inline" )} % endfor diff --git a/components/style/properties/longhands/position.mako.rs b/components/style/properties/longhands/position.mako.rs index 096349f4b1c..34216385fed 100644 --- a/components/style/properties/longhands/position.mako.rs +++ b/components/style/properties/longhands/position.mako.rs @@ -17,7 +17,7 @@ spec="https://www.w3.org/TR/CSS2/visuren.html#propdef-%s" % side, flags="GETCS_NEEDS_LAYOUT_FLUSH", animation_value_type="ComputedValue", - allow_quirks=True, + allow_quirks="Yes", servo_restyle_damage="reflow_out_of_flow", logical_group="inset", )} @@ -253,7 +253,7 @@ ${helpers.predefined_type( "computed::Size::auto()", logical=logical, logical_group="size", - allow_quirks=not logical, + allow_quirks="No" if logical else "Yes", spec=spec % size, animation_value_type="Size", flags="GETCS_NEEDS_LAYOUT_FLUSH", @@ -266,7 +266,7 @@ ${helpers.predefined_type( "computed::Size::auto()", logical=logical, logical_group="min-size", - allow_quirks=not logical, + allow_quirks="No" if logical else "Yes", spec=spec % size, animation_value_type="Size", servo_restyle_damage="reflow", @@ -277,7 +277,7 @@ ${helpers.predefined_type( "computed::MaxSize::none()", logical=logical, logical_group="max-size", - allow_quirks=not logical, + allow_quirks="No" if logical else "Yes", spec=spec % size, animation_value_type="MaxSize", servo_restyle_damage="reflow", diff --git a/components/style/properties/shorthands/border.mako.rs b/components/style/properties/shorthands/border.mako.rs index cd472068793..1f8df0df6a1 100644 --- a/components/style/properties/shorthands/border.mako.rs +++ b/components/style/properties/shorthands/border.mako.rs @@ -7,7 +7,7 @@ ${helpers.four_sides_shorthand("border-color", "border-%s-color", "specified::Color::parse", spec="https://drafts.csswg.org/css-backgrounds/#border-color", - allow_quirks=True)} + allow_quirks="Yes")} ${helpers.four_sides_shorthand( "border-style", diff --git a/components/style/properties/shorthands/margin.mako.rs b/components/style/properties/shorthands/margin.mako.rs index fd3124a6ae1..9b996abbe86 100644 --- a/components/style/properties/shorthands/margin.mako.rs +++ b/components/style/properties/shorthands/margin.mako.rs @@ -10,7 +10,7 @@ ${helpers.four_sides_shorthand( "specified::LengthPercentageOrAuto::parse", spec="https://drafts.csswg.org/css-box/#propdef-margin", allowed_in_page_rule=True, - allow_quirks=True, + allow_quirks="Yes", )} ${helpers.two_properties_shorthand( diff --git a/components/style/properties/shorthands/padding.mako.rs b/components/style/properties/shorthands/padding.mako.rs index a4e013caabc..8d50c3b9e38 100644 --- a/components/style/properties/shorthands/padding.mako.rs +++ b/components/style/properties/shorthands/padding.mako.rs @@ -9,7 +9,7 @@ ${helpers.four_sides_shorthand( "padding-%s", "specified::NonNegativeLengthPercentage::parse", spec="https://drafts.csswg.org/css-box-3/#propdef-padding", - allow_quirks=True, + allow_quirks="Yes", )} ${helpers.two_properties_shorthand( diff --git a/components/style/properties/shorthands/position.mako.rs b/components/style/properties/shorthands/position.mako.rs index 6fdbe1235cf..63298b86ba1 100644 --- a/components/style/properties/shorthands/position.mako.rs +++ b/components/style/properties/shorthands/position.mako.rs @@ -768,7 +768,7 @@ ${helpers.four_sides_shorthand( "%s", "specified::LengthPercentageOrAuto::parse", spec="https://drafts.csswg.org/css-logical/#propdef-inset", - allow_quirks=False, + allow_quirks="No", )} ${helpers.two_properties_shorthand(