From c2db10217c4d78a917dfb28b5d9f6bdb727a5556 Mon Sep 17 00:00:00 2001 From: Philipp Hartwig Date: Fri, 18 Sep 2015 23:08:10 +0200 Subject: [PATCH] Use computed `display` property for hypothetical box of root element The root element should never be treated as an inline element by the flow construction. Closes #7558. --- components/style/properties.mako.rs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/components/style/properties.mako.rs b/components/style/properties.mako.rs index 374b9b875d06..4b7145dbf0c9 100644 --- a/components/style/properties.mako.rs +++ b/components/style/properties.mako.rs @@ -554,10 +554,14 @@ pub mod longhands { } #[inline] - pub fn derive_from_display(_: super::display::computed_value::T, + pub fn derive_from_display(computed_value: super::display::computed_value::T, context: &computed::Context) -> computed_value::T { - context.display + if context.is_root_element { + computed_value + } else { + context.display + } } @@ -6643,7 +6647,12 @@ pub fn cascade(viewport_size: Size2D, // The initial value of display may be changed at computed value time. if !seen.get_display() { let box_ = Arc::make_mut(&mut style.box_); - box_.display = box_.display.to_computed_value(&context); + let computed_value = box_.display.to_computed_value(&context); + box_.display = computed_value; + box_._servo_display_for_hypothetical_box = + longhands::_servo_display_for_hypothetical_box::derive_from_display( + computed_value, + &context); } // The initial value of outline width may be changed at computed value time.