Blockify elements in a flex container

A inline-level child of a flex container should be converted to its
block equivalent. according to CSS2.1 § 9.7.
This commit is contained in:
Pu Xingyu 2016-06-20 23:03:30 +08:00
parent c2a22bd05e
commit 6d0756512d

View file

@ -1876,7 +1876,9 @@ pub fn cascade<C: ComputedValues>(
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<C: ComputedValues>(
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