From 0aee33081fe4e8e10b3b53f0d114b9bb1c71a7de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Wed, 24 Jan 2018 18:13:53 +0100 Subject: [PATCH] style: Serialize before other align bits. Otherwise the serialisation wouldn't roundtrip with the new syntax, which fixes the position of . Also make Servo and Gecko agree on whether to serialize "unsafe". Bug: 1430817 MozReview-Commit-ID: L3GSMk5pZ3F --- components/style/values/specified/align.rs | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/components/style/values/specified/align.rs b/components/style/values/specified/align.rs index 584a24b61fb..460037925bd 100644 --- a/components/style/values/specified/align.rs +++ b/components/style/values/specified/align.rs @@ -75,7 +75,14 @@ impl ToCss for AlignFlags { where W: Write, { - let s = match *self & !AlignFlags::FLAG_BITS { + match *self & AlignFlags::FLAG_BITS { + AlignFlags::LEGACY => dest.write_str("legacy ")?, + AlignFlags::SAFE => dest.write_str("safe ")?, + // Don't serialize "unsafe", since it's the default. + _ => {} + } + + dest.write_str(match *self & !AlignFlags::FLAG_BITS { AlignFlags::AUTO => "auto", AlignFlags::NORMAL => "normal", AlignFlags::START => "start", @@ -94,16 +101,7 @@ impl ToCss for AlignFlags { AlignFlags::SPACE_AROUND => "space-around", AlignFlags::SPACE_EVENLY => "space-evenly", _ => unreachable!() - }; - dest.write_str(s)?; - - match *self & AlignFlags::FLAG_BITS { - AlignFlags::LEGACY => { dest.write_str(" legacy")?; } - AlignFlags::SAFE => { dest.write_str(" safe")?; } - AlignFlags::UNSAFE => { dest.write_str(" unsafe")?; } - _ => {} - } - Ok(()) + }) } }