servo: Merge #15730 - style: Adjust float if the element is positioned per CSS 2.1 section 9.7 (from emilio:adjust-float); r=SimonSapin

We've found crashes related to this in Gecko.

r? @simonsapin or @heycam

Source-Repo: https://github.com/servo/servo
Source-Revision: eb281531f8f43ec724a46e2c62ae564c59a38c14

--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : 4e6126a1d0c1144a6b6f8bd433c0e180e419b080
This commit is contained in:
Emilio Cobos Álvarez 2017-02-25 12:23:36 -08:00
parent ebb9f20e82
commit b9d06a03b2

View File

@ -1960,10 +1960,14 @@ pub fn apply_declarations<'a, F, I>(viewport_size: Size2D<Au>,
% endif
computed_values::display::T::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),
true => (false, false),
};
let (blockify_root, blockify_item) =
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 {
use computed_values::display::T;
@ -2020,6 +2024,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 to layout, which Gecko implements but Servo doesn't.
//