style: Adjust float if the element is positioned per CSS 2.1 section 9.7

We've found crashes related to this in Gecko.
This commit is contained in:
Emilio Cobos Álvarez 2017-02-24 21:28:56 +01:00
parent 050d9d9097
commit e67f5c7585
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C

View file

@ -1953,10 +1953,14 @@ pub fn apply_declarations<'a, F, I>(viewport_size: Size2D<Au>,
% endif % endif
computed_values::display::T::flex | computed_values::display::T::flex |
computed_values::display::T::inline_flex); computed_values::display::T::inline_flex);
let (blockify_root, blockify_item) = match flags.contains(SKIP_ROOT_AND_ITEM_BASED_DISPLAY_FIXUP) {
false => (is_root_element, is_item), let (blockify_root, blockify_item) =
true => (false, false), if flags.contains(SKIP_ROOT_AND_ITEM_BASED_DISPLAY_FIXUP) {
}; (false, false)
} else {
(is_root_element, is_item)
};
if positioned || floated || blockify_root || blockify_item { if positioned || floated || blockify_root || blockify_item {
use computed_values::display::T; use computed_values::display::T;
@ -2013,6 +2017,15 @@ pub fn apply_declarations<'a, F, I>(viewport_size: Size2D<Au>,
} }
} }
// CSS 2.1 section 9.7:
//
// If 'position' has the value 'absolute' or 'fixed', [...] the computed
// value of 'float' is 'none'.
//
if positioned && floated {
style.mutate_box().set_float(longhands::float::computed_value::T::none);
}
// This implements an out-of-date spec. The new spec moves the handling of // This implements an out-of-date spec. The new spec moves the handling of
// this to layout, which Gecko implements but Servo doesn't. // this to layout, which Gecko implements but Servo doesn't.
// //