From f695789aaa08bb4f542cbeb965afedbe7a51c645 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Sun, 26 Feb 2017 13:23:18 +0100 Subject: [PATCH] stylo: Fix adjustment of the display property to save mOriginalDisplay properly. --- components/style/properties/gecko.mako.rs | 18 +++++++++++++++++- components/style/properties/properties.mako.rs | 4 +++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/components/style/properties/gecko.mako.rs b/components/style/properties/gecko.mako.rs index 901779eba59..57039bc053f 100644 --- a/components/style/properties/gecko.mako.rs +++ b/components/style/properties/gecko.mako.rs @@ -1420,10 +1420,26 @@ fn static_assert() { self.gecko.mDisplay = result; self.gecko.mOriginalDisplay = result; } + + /// Set the display value from the style adjustment code. This is pretty + /// much like set_display, but without touching the mOriginalDisplay field, + /// which we want to keep. + pub fn set_adjusted_display(&mut self, v: longhands::display::computed_value::T) { + use properties::longhands::display::computed_value::T as Keyword; + let result = match v { + % for value in display_keyword.values_for('gecko'): + Keyword::${to_rust_ident(value)} => + structs::${display_keyword.gecko_constant(value)}, + % endfor + }; + self.gecko.mDisplay = result; + } + pub fn copy_display_from(&mut self, other: &Self) { self.gecko.mDisplay = other.gecko.mDisplay; - self.gecko.mOriginalDisplay = other.gecko.mOriginalDisplay; + self.gecko.mOriginalDisplay = other.gecko.mDisplay; } + <%call expr="impl_keyword_clone('display', 'mDisplay', display_keyword)"> // overflow-y is implemented as a newtype of overflow-x, so we need special handling. diff --git a/components/style/properties/properties.mako.rs b/components/style/properties/properties.mako.rs index bb5be1bbd25..1078fb2e283 100644 --- a/components/style/properties/properties.mako.rs +++ b/components/style/properties/properties.mako.rs @@ -2006,13 +2006,15 @@ pub fn apply_declarations<'a, F, I>(viewport_size: Size2D, }; if let Some(computed_display) = computed_display { let box_ = style.mutate_box(); - box_.set_display(computed_display); % if product == "servo": + box_.set_display(computed_display); box_.set__servo_display_for_hypothetical_box(if blockify_root || blockify_item { computed_display } else { specified_display }); + % else: + box_.set_adjusted_display(computed_display); % endif } }