servo: Merge #10637 - layout: Do not propagate floats in or out of absolutely positioned flows (from notriddle:absolute_float_line_height); r=pcwalton
authorMichael Howell <michael@notriddle.com>
Sat, 16 Apr 2016 04:55:42 +0500
changeset 338540 2687cdb0624fae55e75de6378bb65511fc637de9
parent 338539 234ab857fb555ca913dca55bfe586575177d687e
child 338541 5b7a48485a8a5825e6041fccfbf7f0e69be725a3
push id31307
push usergszorc@mozilla.com
push dateSat, 04 Feb 2017 00:59:06 +0000
treeherdermozilla-central@94079d43835f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspcwalton
servo: Merge #10637 - layout: Do not propagate floats in or out of absolutely positioned flows (from notriddle:absolute_float_line_height); r=pcwalton Fixes #10625 Source-Repo: https://github.com/servo/servo Source-Revision: 812c4ad69916e29fe2743cee02ab71b000050987
servo/components/layout/sequential.rs
--- a/servo/components/layout/sequential.rs
+++ b/servo/components/layout/sequential.rs
@@ -4,16 +4,17 @@
 
 //! Implements sequential traversals over the DOM and flow trees.
 
 use app_units::Au;
 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};
 use fragment::FragmentBorderBoxIterator;
 use generated_content::ResolveGeneratedContent;
 use gfx::display_list::{DisplayListEntry, StackingContext};
 use incremental::{REFLOW, STORE_OVERFLOW};
 use style::dom::TNode;
@@ -139,17 +140,22 @@ pub fn store_overflow(layout_context: &L
 /// contexts. The speculation typically succeeds, but if it doesn't we have to lay it out again.
 pub fn guess_float_placement(flow: &mut Flow) {
     if !flow::base(flow).restyle_damage.intersects(REFLOW) {
         return
     }
 
     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
 }