Auto merge of #10637 - notriddle:absolute_float_line_height, r=pcwalton

layout: Do not propagate floats in or out of absolutely positioned flows

Fixes #10625

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10637)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-04-16 05:25:12 +05:30
commit 812c4ad699
4 changed files with 44 additions and 4 deletions

View file

@ -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

View file

@ -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",

View file

@ -0,0 +1,6 @@
<!doctype html>
<meta charset="utf-8">
<title>Line-height should be respected after a float</title>
<link rel="match" href="absolute_line_height_after_float_ref.html">
<div style="float: left; padding: 0 0 0 1px;"></div>
<span style="position: absolute; right: 0; top: 0; line-height: 100px;">X</span>

View file

@ -0,0 +1,4 @@
<!doctype html>
<meta charset="utf-8">
<title>Reference</title>
<span style="position: absolute; right: 0; top: 0; line-height: 100px;">X</span>