From cdafaa57a019aff4535b0cbe8cbb01c4d05a9faa Mon Sep 17 00:00:00 2001 From: Oriol Brufau Date: Sun, 11 Feb 2024 12:51:55 -0800 Subject: [PATCH] Fix list-style serialization (#31314) In layout2020, 'list-style-position' is disabled behind a pref, so the list_style_position field is an Option. The serialization of the 'list-style' shorthand wasn't correctly handling the case of it being None. --- components/style/properties/shorthands/list.mako.rs | 11 +++++++++-- .../cssom-getPropertyValue-common-checks.html.ini | 6 ------ 2 files changed, 9 insertions(+), 8 deletions(-) delete mode 100644 tests/wpt/meta/css/cssom/cssom-getPropertyValue-common-checks.html.ini diff --git a/components/style/properties/shorthands/list.mako.rs b/components/style/properties/shorthands/list.mako.rs index 10a43f83f4c..183c5ab5daa 100644 --- a/components/style/properties/shorthands/list.mako.rs +++ b/components/style/properties/shorthands/list.mako.rs @@ -113,14 +113,14 @@ #[cfg(feature = "gecko")] let position_is_initial = self.list_style_position == &ListStylePosition::Outside; #[cfg(feature = "servo")] - let position_is_initial = self.list_style_position == Some(&ListStylePosition::Outside); + let position_is_initial = matches!(self.list_style_position, None | Some(&ListStylePosition::Outside)); if !position_is_initial { self.list_style_position.to_css(dest)?; have_one_non_initial_value = true; } if self.list_style_image != &ListStyleImage::None { if have_one_non_initial_value { - dest.write_char(' ')?; + dest.write_char(' ')?; } self.list_style_image.to_css(dest)?; have_one_non_initial_value = true; @@ -137,7 +137,14 @@ have_one_non_initial_value = true; } if !have_one_non_initial_value { + #[cfg(feature = "gecko")] self.list_style_position.to_css(dest)?; + #[cfg(feature = "servo")] + if let Some(position) = self.list_style_position { + position.to_css(dest)?; + } else { + self.list_style_type.to_css(dest)?; + } } Ok(()) } diff --git a/tests/wpt/meta/css/cssom/cssom-getPropertyValue-common-checks.html.ini b/tests/wpt/meta/css/cssom/cssom-getPropertyValue-common-checks.html.ini deleted file mode 100644 index 50c8b190095..00000000000 --- a/tests/wpt/meta/css/cssom/cssom-getPropertyValue-common-checks.html.ini +++ /dev/null @@ -1,6 +0,0 @@ -[cssom-getPropertyValue-common-checks.html] - [All properties (except 'all') can serialize their initial value (computed)] - expected: FAIL - - [All shorthands (except 'all') can serialize their longhands set to their initial value] - expected: FAIL