mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Add place-self shorthand property (it fails unit-test)
This commit is contained in:
parent
d6f4c8c6dd
commit
b6cbd31b73
2 changed files with 41 additions and 0 deletions
|
@ -186,3 +186,27 @@
|
||||||
}
|
}
|
||||||
</%helpers:shorthand>
|
</%helpers:shorthand>
|
||||||
|
|
||||||
|
<%helpers:shorthand name="place-self" sub_properties="align-self justify-self"
|
||||||
|
spec="https://drafts.csswg.org/css-align/#place-self-property"
|
||||||
|
products="gecko">
|
||||||
|
use values::specified::align::AlignJustifySelf;
|
||||||
|
use parser::Parse;
|
||||||
|
|
||||||
|
pub fn parse_value(context: &ParserContext, input: &mut Parser) -> Result<Longhands, ()> {
|
||||||
|
let align = AlignJustifySelf::parse(context, input)?;
|
||||||
|
let justify = input.try(|input| AlignJustifySelf::parse(context, input)).unwrap_or(align.clone());
|
||||||
|
|
||||||
|
Ok(Longhands {
|
||||||
|
align_self: align,
|
||||||
|
justify_self: justify,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'a> ToCss for LonghandsToSerialize<'a> {
|
||||||
|
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||||
|
self.align_self.to_css(dest)?;
|
||||||
|
dest.write_str(" ")?;
|
||||||
|
self.justify_self.to_css(dest)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</%helpers:shorthand>
|
||||||
|
|
|
@ -1263,4 +1263,21 @@ mod shorthand_serialization {
|
||||||
let serialization = shorthand_properties_to_string(properties);
|
let serialization = shorthand_properties_to_string(properties);
|
||||||
assert_eq!(serialization, "place-content: stretch center;");
|
assert_eq!(serialization, "place-content: stretch center;");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn place_self_serialize_all_available_properties() {
|
||||||
|
use style::properties::longhands::align_self::SpecifiedValue as AlignSelf;
|
||||||
|
use style::properties::longhands::justify_self::SpecifiedValue as JustifySelf;
|
||||||
|
|
||||||
|
let mut properties = Vec::new();
|
||||||
|
|
||||||
|
let align = AlignSelf::auto;
|
||||||
|
let justify = JustifySelf::baseline;
|
||||||
|
|
||||||
|
properties.push(PropertyDeclaration::AlignSelf(align));
|
||||||
|
properties.push(PropertyDeclaration::JustifySelf(justify));
|
||||||
|
|
||||||
|
let serialization = shorthand_properties_to_string(properties);
|
||||||
|
assert_eq!(serialization, "place-self: auto baseline;");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue