diff --git a/components/style/properties/properties.mako.rs b/components/style/properties/properties.mako.rs index b844f73a685..61ea7e4be5a 100644 --- a/components/style/properties/properties.mako.rs +++ b/components/style/properties/properties.mako.rs @@ -1960,10 +1960,14 @@ pub fn apply_declarations<'a, F, I>(viewport_size: Size2D, % 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, } } + // 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. // diff --git a/tests/wpt/mozilla/meta/MANIFEST.json b/tests/wpt/mozilla/meta/MANIFEST.json index 434afa7e5a2..9ecaa48d559 100644 --- a/tests/wpt/mozilla/meta/MANIFEST.json +++ b/tests/wpt/mozilla/meta/MANIFEST.json @@ -11036,6 +11036,12 @@ {} ] ], + "css/float-abspos.html": [ + [ + "/_mozilla/css/float-abspos.html", + {} + ] + ], "css/float_relative_to_position.html": [ [ "/_mozilla/css/float_relative_to_position.html", @@ -20895,6 +20901,10 @@ "2712a0a76b5eeb4d0f2b4a45277d04791a8ff206", "support" ], + "css/float-abspos.html": [ + "d34a9ce0be290bc3c46aa80eb136a91460957346", + "testharness" + ], "css/float_clearance_a.html": [ "372652bf4c345098f864cfc52ad0fb274308b22c", "reftest" diff --git a/tests/wpt/mozilla/tests/css/float-abspos.html b/tests/wpt/mozilla/tests/css/float-abspos.html new file mode 100644 index 00000000000..f691c1756f0 --- /dev/null +++ b/tests/wpt/mozilla/tests/css/float-abspos.html @@ -0,0 +1,20 @@ + + +A positioned element's float value computes to "none" + + + + +
+