From 3c0a1f2cb2821e4921e91437c86fa121884025a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Sat, 27 May 2023 15:08:02 +0200 Subject: [PATCH] style: Remove NS_AUTHOR_SPECIFIED_PADDING There's only one meaningful usage of it, which is to disable native appearance of the (the windows native theme is no longer exposed to content). is inconsistent with every other native widget, which only disables native appearance if the author specifies backgrounds or borders. So make it match literally all other widgets and simplify a bit the code. We had no tests for this special behavior, let me know if you think it's worth adding one (but I don't feel very strongly about it). Differential Revision: https://phabricator.services.mozilla.com/D127082 --- components/style/properties/cascade.rs | 9 +-------- components/style/properties/computed_value_flags.rs | 6 ------ components/style/properties/properties.mako.rs | 12 ------------ 3 files changed, 1 insertion(+), 26 deletions(-) diff --git a/components/style/properties/cascade.rs b/components/style/properties/cascade.rs index b64ff4c6349..e9b63fe8c72 100644 --- a/components/style/properties/cascade.rs +++ b/components/style/properties/cascade.rs @@ -794,12 +794,6 @@ impl<'a, 'b: 'a> Cascade<'a, 'b> { { builder.add_flags(ComputedValueFlags::HAS_AUTHOR_SPECIFIED_BORDER_BACKGROUND); } - if self - .author_specified - .contains_any(LonghandIdSet::padding_properties()) - { - builder.add_flags(ComputedValueFlags::HAS_AUTHOR_SPECIFIED_PADDING); - } if self .author_specified @@ -863,8 +857,7 @@ impl<'a, 'b: 'a> Cascade<'a, 'b> { // // Note that all the properties involved are non-inherited, so we don't // need to do anything else other than just copying the bits over. - let reset_props_bits = ComputedValueFlags::HAS_AUTHOR_SPECIFIED_BORDER_BACKGROUND | - ComputedValueFlags::HAS_AUTHOR_SPECIFIED_PADDING; + let reset_props_bits = ComputedValueFlags::HAS_AUTHOR_SPECIFIED_BORDER_BACKGROUND; builder.add_flags(cached_style.flags & reset_props_bits); true diff --git a/components/style/properties/computed_value_flags.rs b/components/style/properties/computed_value_flags.rs index 0942bbd0d13..25adc3327ca 100644 --- a/components/style/properties/computed_value_flags.rs +++ b/components/style/properties/computed_value_flags.rs @@ -84,12 +84,6 @@ bitflags! { /// https://github.com/w3c/csswg-drafts/issues/4777#issuecomment-604424845 const HAS_AUTHOR_SPECIFIED_BORDER_BACKGROUND = 1 << 14; - /// Whether there are author-specified rules for padding-* properties. - /// - /// FIXME(emilio): Try to merge this with BORDER_BACKGROUND, see - /// https://github.com/w3c/csswg-drafts/issues/4777 - const HAS_AUTHOR_SPECIFIED_PADDING = 1 << 15; - /// Whether there are author-specified rules for `font-family`. const HAS_AUTHOR_SPECIFIED_FONT_FAMILY = 1 << 16; diff --git a/components/style/properties/properties.mako.rs b/components/style/properties/properties.mako.rs index 7d19785ea80..10b13618a94 100644 --- a/components/style/properties/properties.mako.rs +++ b/components/style/properties/properties.mako.rs @@ -945,18 +945,6 @@ impl LonghandIdSet { &HAS_NO_EFFECT_ON_SCROLLBARS } - /// Returns the set of padding properties for the purpose of disabling - /// native appearance. - #[inline] - pub fn padding_properties() -> &'static Self { - <% assert "padding" in logical_groups %> - ${static_longhand_id_set( - "PADDING_PROPERTIES", - lambda p: p.logical_group == "padding" - )} - &PADDING_PROPERTIES - } - /// Returns the set of border properties for the purpose of disabling native /// appearance. #[inline]