From a2f1f12c968ae2434e18fa4d40513a58a4dd5a83 Mon Sep 17 00:00:00 2001 From: Glenn Watson Date: Wed, 25 Feb 2015 13:07:35 +1000 Subject: [PATCH] Fix setting display:none after a layout where the element was visible. Prior to incremental layout, the code would remove the existing construction result. However, with incremental layout the construction result is cloned rather than removed. This change ensures that the previous construction result is cleared when an element's display type changes to none. --- components/layout/construct.rs | 3 ++- tests/ref/basic.list | 1 + tests/ref/hide_after_create.html | 24 ++++++++++++++++++++++++ tests/ref/hide_after_create_ref.html | 10 ++++++++++ 4 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 tests/ref/hide_after_create.html create mode 100644 tests/ref/hide_after_create_ref.html diff --git a/components/layout/construct.rs b/components/layout/construct.rs index 2d031d4f922..20c5b0b44d2 100644 --- a/components/layout/construct.rs +++ b/components/layout/construct.rs @@ -1170,8 +1170,9 @@ impl<'a> PostorderNodeMutTraversal for FlowConstructor<'a> { // results of children. (display::T::none, _, _) => { for child in node.children() { - drop(child.swap_out_construction_result()) + child.set_flow_construction_result(ConstructionResult::None); } + node.set_flow_construction_result(ConstructionResult::None); } // Table items contribute table flow construction results. diff --git a/tests/ref/basic.list b/tests/ref/basic.list index 67dfebfdd6d..30296dc44a4 100644 --- a/tests/ref/basic.list +++ b/tests/ref/basic.list @@ -251,3 +251,4 @@ fragment=top != ../html/acid2.html acid2_ref.html == percentage_height_root.html percentage_height_root_ref.html == canvas_transform_a.html canvas_transform_ref.html != text_decoration_smoke_a.html text_decoration_smoke_ref.html +== hide_after_create.html hide_after_create_ref.html diff --git a/tests/ref/hide_after_create.html b/tests/ref/hide_after_create.html new file mode 100644 index 00000000000..e2fc4db41fb --- /dev/null +++ b/tests/ref/hide_after_create.html @@ -0,0 +1,24 @@ + + + + + + + + diff --git a/tests/ref/hide_after_create_ref.html b/tests/ref/hide_after_create_ref.html new file mode 100644 index 00000000000..1c5cdc2bd21 --- /dev/null +++ b/tests/ref/hide_after_create_ref.html @@ -0,0 +1,10 @@ + + + + + +