aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPu Xingyu <pu.stshine@gmail.com>2016-06-20 23:03:30 +0800
committerPu Xingyu <pu.stshine@gmail.com>2016-07-12 07:13:25 +0800
commit6d0756512dceed7e40b336d79fba49aa330690ad (patch)
treefa5af600740584deb2500b98cf93c54d313abdfd
parentc2a22bd05e0c8282175422df26e188ef63bcc452 (diff)
downloadservo-6d0756512dceed7e40b336d79fba49aa330690ad.tar.gz
servo-6d0756512dceed7e40b336d79fba49aa330690ad.zip
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.
-rw-r--r--components/style/properties/properties.mako.rs6
1 files 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<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