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.
This commit is contained in:
Oriol Brufau 2024-02-11 12:51:55 -08:00 committed by GitHub
parent cdc3c369f0
commit cdafaa57a0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 8 deletions

View file

@ -113,7 +113,7 @@
#[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;
@ -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(())
}

View file

@ -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