From 03be4583e0adde8c1331697a1440e9a32f1b4dcc Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Fri, 15 Apr 2016 14:15:44 -0700 Subject: [PATCH 1/2] Do not propagate floats in or out of absolutely positioned flows. Fixes #10625 --- components/layout/sequential.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/components/layout/sequential.rs b/components/layout/sequential.rs index 6ca7332497a..bc4668f33c6 100644 --- a/components/layout/sequential.rs +++ b/components/layout/sequential.rs @@ -9,6 +9,7 @@ use context::{LayoutContext, SharedLayoutContext}; use display_list_builder::DisplayListBuildState; use euclid::point::Point2D; use floats::SpeculatedFloatPlacement; +use flow::IS_ABSOLUTELY_POSITIONED; use flow::{PostorderFlowTraversal, PreorderFlowTraversal}; use flow::{self, Flow, ImmutableFlowUtils, InorderFlowTraversal, MutableFlowUtils}; use flow_ref::{self, FlowRef}; @@ -144,10 +145,15 @@ pub fn guess_float_placement(flow: &mut Flow) { let mut floats_in = SpeculatedFloatPlacement::compute_floats_in_for_first_child(flow); for kid in flow::mut_base(flow).child_iter_mut() { - floats_in.compute_floats_in(kid); - flow::mut_base(kid).speculated_float_placement_in = floats_in; - guess_float_placement(kid); - floats_in = flow::base(kid).speculated_float_placement_out; + if flow::base(kid).flags.contains(IS_ABSOLUTELY_POSITIONED) { + // Do not propagate floats in or out, but do propogate between kids. + guess_float_placement(kid); + } else { + floats_in.compute_floats_in(kid); + flow::mut_base(kid).speculated_float_placement_in = floats_in; + guess_float_placement(kid); + floats_in = flow::base(kid).speculated_float_placement_out; + } } floats_in.compute_floats_out(flow); flow::mut_base(flow).speculated_float_placement_out = floats_in From 2ecadc913aaf16a4dbaaf881857448a60cac0080 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Fri, 15 Apr 2016 15:36:56 -0700 Subject: [PATCH 2/2] Add reftest for #10625 --- tests/wpt/mozilla/meta/MANIFEST.json | 24 +++++++++++++++++++ .../css/absolute_line_height_after_float.html | 6 +++++ .../absolute_line_height_after_float_ref.html | 4 ++++ 3 files changed, 34 insertions(+) create mode 100644 tests/wpt/mozilla/tests/css/absolute_line_height_after_float.html create mode 100644 tests/wpt/mozilla/tests/css/absolute_line_height_after_float_ref.html diff --git a/tests/wpt/mozilla/meta/MANIFEST.json b/tests/wpt/mozilla/meta/MANIFEST.json index 121842c43ff..d56fdb61efc 100644 --- a/tests/wpt/mozilla/meta/MANIFEST.json +++ b/tests/wpt/mozilla/meta/MANIFEST.json @@ -106,6 +106,18 @@ "url": "/_mozilla/css/absolute_inline_containing_block_a.html" } ], + "css/absolute_line_height_after_float.html": [ + { + "path": "css/absolute_line_height_after_float.html", + "references": [ + [ + "/_mozilla/css/absolute_line_height_after_float_ref.html", + "==" + ] + ], + "url": "/_mozilla/css/absolute_line_height_after_float.html" + } + ], "css/absolute_table.html": [ { "path": "css/absolute_table.html", @@ -6732,6 +6744,18 @@ "url": "/_mozilla/css/absolute_inline_containing_block_a.html" } ], + "css/absolute_line_height_after_float.html": [ + { + "path": "css/absolute_line_height_after_float.html", + "references": [ + [ + "/_mozilla/css/absolute_line_height_after_float_ref.html", + "==" + ] + ], + "url": "/_mozilla/css/absolute_line_height_after_float.html" + } + ], "css/absolute_table.html": [ { "path": "css/absolute_table.html", diff --git a/tests/wpt/mozilla/tests/css/absolute_line_height_after_float.html b/tests/wpt/mozilla/tests/css/absolute_line_height_after_float.html new file mode 100644 index 00000000000..b8fe85ef6ec --- /dev/null +++ b/tests/wpt/mozilla/tests/css/absolute_line_height_after_float.html @@ -0,0 +1,6 @@ + + +Line-height should be respected after a float + +
+X diff --git a/tests/wpt/mozilla/tests/css/absolute_line_height_after_float_ref.html b/tests/wpt/mozilla/tests/css/absolute_line_height_after_float_ref.html new file mode 100644 index 00000000000..87b5a67edef --- /dev/null +++ b/tests/wpt/mozilla/tests/css/absolute_line_height_after_float_ref.html @@ -0,0 +1,4 @@ + + +Reference +X