mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
style: Fix broken 'list-style' serialization
Differential Revision: https://phabricator.services.mozilla.com/D129847
This commit is contained in:
parent
40b7d87bbb
commit
9c6bf6d23b
1 changed files with 31 additions and 1 deletions
|
@ -7,7 +7,6 @@
|
||||||
<%helpers:shorthand name="list-style"
|
<%helpers:shorthand name="list-style"
|
||||||
engines="gecko servo-2013 servo-2020"
|
engines="gecko servo-2013 servo-2020"
|
||||||
sub_properties="list-style-position list-style-image list-style-type"
|
sub_properties="list-style-position list-style-image list-style-type"
|
||||||
derive_serialize="True"
|
|
||||||
spec="https://drafts.csswg.org/css-lists/#propdef-list-style">
|
spec="https://drafts.csswg.org/css-lists/#propdef-list-style">
|
||||||
use crate::properties::longhands::{list_style_image, list_style_position, list_style_type};
|
use crate::properties::longhands::{list_style_image, list_style_position, list_style_type};
|
||||||
use crate::values::specified::Image;
|
use crate::values::specified::Image;
|
||||||
|
@ -104,4 +103,35 @@
|
||||||
_ => Err(input.new_custom_error(StyleParseErrorKind::UnspecifiedError)),
|
_ => Err(input.new_custom_error(StyleParseErrorKind::UnspecifiedError)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<'a> ToCss for LonghandsToSerialize<'a> {
|
||||||
|
fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result where W: fmt::Write {
|
||||||
|
use longhands::list_style_position::SpecifiedValue as ListStylePosition;
|
||||||
|
use longhands::list_style_type::SpecifiedValue as ListStyleType;
|
||||||
|
use longhands::list_style_image::SpecifiedValue as ListStyleImage;
|
||||||
|
let mut have_one_non_initial_value = false;
|
||||||
|
if self.list_style_position != &ListStylePosition::Outside {
|
||||||
|
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_str(" ")?;
|
||||||
|
}
|
||||||
|
self.list_style_image.to_css(dest)?;
|
||||||
|
have_one_non_initial_value = true;
|
||||||
|
}
|
||||||
|
if self.list_style_type != &ListStyleType::disc() {
|
||||||
|
if have_one_non_initial_value {
|
||||||
|
dest.write_str(" ")?;
|
||||||
|
}
|
||||||
|
self.list_style_type.to_css(dest)?;
|
||||||
|
have_one_non_initial_value = true;
|
||||||
|
}
|
||||||
|
if !have_one_non_initial_value {
|
||||||
|
self.list_style_position.to_css(dest)?;
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
}
|
||||||
</%helpers:shorthand>
|
</%helpers:shorthand>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue