mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
style: Make flex-flow serialization interoperable
Differential Revision: https://phabricator.services.mozilla.com/D180270
This commit is contained in:
parent
abc0c86fef
commit
019c14cf0b
1 changed files with 15 additions and 1 deletions
|
@ -9,7 +9,6 @@
|
|||
servo_pref="layout.flexbox.enabled",
|
||||
sub_properties="flex-direction flex-wrap"
|
||||
extra_prefixes="webkit"
|
||||
derive_serialize="True"
|
||||
spec="https://drafts.csswg.org/css-flexbox/#flex-flow-property">
|
||||
use crate::properties::longhands::{flex_direction, flex_wrap};
|
||||
|
||||
|
@ -43,6 +42,21 @@
|
|||
flex_wrap: unwrap_or_initial!(flex_wrap, wrap),
|
||||
})
|
||||
}
|
||||
|
||||
impl<'a> ToCss for LonghandsToSerialize<'a> {
|
||||
fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result where W: fmt::Write {
|
||||
if *self.flex_direction == flex_direction::get_initial_specified_value() &&
|
||||
*self.flex_wrap != flex_wrap::get_initial_specified_value() {
|
||||
return self.flex_wrap.to_css(dest)
|
||||
}
|
||||
self.flex_direction.to_css(dest)?;
|
||||
if *self.flex_wrap != flex_wrap::get_initial_specified_value() {
|
||||
dest.write_char(' ')?;
|
||||
self.flex_wrap.to_css(dest)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
</%helpers:shorthand>
|
||||
|
||||
<%helpers:shorthand name="flex"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue