aboutsummaryrefslogtreecommitdiffstats
path: root/components/style
diff options
context:
space:
mode:
authorTing-Yu Lin <tlin@mozilla.com>2023-06-08 16:37:21 +0000
committerMartin Robinson <mrobinson@igalia.com>2023-11-24 08:57:14 +0100
commit019c14cf0b1ee73fa7b607bb5072f84227a2f317 (patch)
treeaf772137cc6d2f4180650263c476e986bfa3da67 /components/style
parentabc0c86fef231acd17b268ecc95a7032b5815265 (diff)
downloadservo-019c14cf0b1ee73fa7b607bb5072f84227a2f317.tar.gz
servo-019c14cf0b1ee73fa7b607bb5072f84227a2f317.zip
style: Make flex-flow serialization interoperable
Differential Revision: https://phabricator.services.mozilla.com/D180270
Diffstat (limited to 'components/style')
-rw-r--r--components/style/properties/shorthands/position.mako.rs16
1 files changed, 15 insertions, 1 deletions
diff --git a/components/style/properties/shorthands/position.mako.rs b/components/style/properties/shorthands/position.mako.rs
index 471e67c0986..6d2b47d345f 100644
--- a/components/style/properties/shorthands/position.mako.rs
+++ b/components/style/properties/shorthands/position.mako.rs
@@ -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"