mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Add place-items shorthand property (it fails unit-test)
This commit is contained in:
parent
b6cbd31b73
commit
bfa408255f
2 changed files with 49 additions and 0 deletions
|
@ -210,3 +210,35 @@
|
|||
}
|
||||
}
|
||||
</%helpers:shorthand>
|
||||
|
||||
<%helpers:shorthand name="place-items" sub_properties="align-items justify-items"
|
||||
spec="https://drafts.csswg.org/css-align/#place-items-property"
|
||||
products="gecko">
|
||||
use values::specified::align::{AlignItems, JustifyItems};
|
||||
use parser::Parse;
|
||||
|
||||
impl From<AlignItems> for JustifyItems {
|
||||
fn from(align: AlignItems) -> JustifyItems {
|
||||
JustifyItems(align.0)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn parse_value(context: &ParserContext, input: &mut Parser) -> Result<Longhands, ()> {
|
||||
let align = AlignItems::parse(context, input)?;
|
||||
let justify = input.try(|input| JustifyItems::parse(context, input))
|
||||
.unwrap_or(JustifyItems::from(align));
|
||||
|
||||
Ok(Longhands {
|
||||
align_items: align,
|
||||
justify_items: justify,
|
||||
})
|
||||
}
|
||||
|
||||
impl<'a> ToCss for LonghandsToSerialize<'a> {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
self.align_items.to_css(dest)?;
|
||||
dest.write_str(" ")?;
|
||||
self.justify_items.to_css(dest)
|
||||
}
|
||||
}
|
||||
</%helpers:shorthand>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue