From 34b3408a8908917de895d64c231099cc621aa6a4 Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Mon, 22 Sep 2014 14:07:37 -0700 Subject: [PATCH] layout: Translate floats when clearing non-floated blocks. Improves CNN layout considerably. Closes #3439. --- components/layout/block.rs | 2 +- tests/ref/basic.list | 1 + tests/ref/float_clearance_a.html | 13 +++++++++++++ tests/ref/float_clearance_ref.html | 13 +++++++++++++ 4 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 tests/ref/float_clearance_a.html create mode 100644 tests/ref/float_clearance_ref.html diff --git a/components/layout/block.rs b/components/layout/block.rs index fedca650919..a75a2e48274 100644 --- a/components/layout/block.rs +++ b/components/layout/block.rs @@ -906,7 +906,7 @@ impl BlockFlow { clear::right => floats.clearance(ClearRight), clear::both => floats.clearance(ClearBoth), }; - cur_b = cur_b + clearance; + translate_including_floats(&mut cur_b, clearance, &mut floats); // At this point, `cur_b` is at the border edge of the child. flow::mut_base(kid).position.start.b = cur_b; diff --git a/tests/ref/basic.list b/tests/ref/basic.list index 775b6fcfe1c..691ef8b4d12 100644 --- a/tests/ref/basic.list +++ b/tests/ref/basic.list @@ -138,3 +138,4 @@ flaky_gpu,flaky_linux == acid2_noscroll.html acid2_ref_broken.html == percentage_height_float_a.html percentage_height_float_ref.html == img_block_maxwidth_a.html img_block_maxwidth_ref.html == img_block_maxwidth_b.html img_block_maxwidth_ref.html +== float_clearance_a.html float_clearance_ref.html diff --git a/tests/ref/float_clearance_a.html b/tests/ref/float_clearance_a.html new file mode 100644 index 00000000000..a24e90e14ce --- /dev/null +++ b/tests/ref/float_clearance_a.html @@ -0,0 +1,13 @@ + + + + + +
+
hello
+
darkness
+
my old friend
+
+ + + diff --git a/tests/ref/float_clearance_ref.html b/tests/ref/float_clearance_ref.html new file mode 100644 index 00000000000..69f5a101930 --- /dev/null +++ b/tests/ref/float_clearance_ref.html @@ -0,0 +1,13 @@ + + + + + +
+
hello
+
darkness
+
my old friend
+
+ + +