From 6d0756512dceed7e40b336d79fba49aa330690ad Mon Sep 17 00:00:00 2001 From: Pu Xingyu Date: Mon, 20 Jun 2016 23:03:30 +0800 Subject: [PATCH] Blockify elements in a flex container MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A inline-level child of a flex container should be converted to its block equivalent. according to CSS2.1 ยง 9.7. --- components/style/properties/properties.mako.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/components/style/properties/properties.mako.rs b/components/style/properties/properties.mako.rs index 9bb65979f4e..a15bd3225f2 100644 --- a/components/style/properties/properties.mako.rs +++ b/components/style/properties/properties.mako.rs @@ -1876,7 +1876,9 @@ pub fn cascade( longhands::position::SpecifiedValue::absolute | longhands::position::SpecifiedValue::fixed); let floated = style.get_box().clone_float() != longhands::float::SpecifiedValue::none; - if positioned || floated || is_root_element { + let is_flex_item = + context.inherited_style.get_box().clone_display() == computed_values::display::T::flex; + if positioned || floated || is_root_element || is_flex_item { use computed_values::display::T; let specified_display = style.get_box().clone_display(); @@ -1897,7 +1899,7 @@ pub fn cascade( let box_ = style.mutate_box(); box_.set_display(computed_display); % if product == "servo": - box_.set__servo_display_for_hypothetical_box(if is_root_element { + box_.set__servo_display_for_hypothetical_box(if is_root_element || is_flex_item { computed_display } else { specified_display