From 41ffec0378f23c0781fedc8e9d578d69b4d48f0c Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Thu, 11 Sep 2014 16:15:23 -0700 Subject: [PATCH] layout: Don't crash on floated generated content. It doesn't construct the float correctly, but at least it doesn't crash anymore. Fixes Reddit. Closes #3287. --- components/layout/construct.rs | 4 +++- tests/ref/basic.list | 1 + tests/ref/floated_generated_content_a.html | 15 +++++++++++++++ tests/ref/floated_generated_content_b.html | 9 +++++++++ 4 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 tests/ref/floated_generated_content_a.html create mode 100644 tests/ref/floated_generated_content_b.html diff --git a/components/layout/construct.rs b/components/layout/construct.rs index 0f832bacfb8..e30838acbc5 100644 --- a/components/layout/construct.rs +++ b/components/layout/construct.rs @@ -833,7 +833,9 @@ impl<'a, 'b> PostorderNodeMutTraversal for FlowConstructor<'a, 'b> { } // Inline items contribute inline fragment construction results. - (display::inline, float::none, _) => { + // + // FIXME(pcwalton, #3307): This is not sufficient to handle floated generated content. + (display::inline, _, _) => { let construction_result = self.build_fragments_for_inline(node); node.set_flow_construction_result(construction_result) } diff --git a/tests/ref/basic.list b/tests/ref/basic.list index cfb9e4d8f8a..b54708ebbd0 100644 --- a/tests/ref/basic.list +++ b/tests/ref/basic.list @@ -118,3 +118,4 @@ flaky_gpu,flaky_linux == acid2_noscroll.html acid2_ref_broken.html == iframe/simple.html iframe/simple_ref.html == iframe/multiple_external.html iframe/multiple_external_ref.html +== floated_generated_content_a.html floated_generated_content_b.html diff --git a/tests/ref/floated_generated_content_a.html b/tests/ref/floated_generated_content_a.html new file mode 100644 index 00000000000..0ba5f509f19 --- /dev/null +++ b/tests/ref/floated_generated_content_a.html @@ -0,0 +1,15 @@ + + + + + + +
Toast! Toast! Toast!
+ + + diff --git a/tests/ref/floated_generated_content_b.html b/tests/ref/floated_generated_content_b.html new file mode 100644 index 00000000000..ae2001e7ece --- /dev/null +++ b/tests/ref/floated_generated_content_b.html @@ -0,0 +1,9 @@ + + + + + +
Toast! Toast! Toast!
+ + +