Skip to content

Commit

Permalink
auto merge of #5064 : glennw/servo/hide-after-layout, r=pcwalton
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bors-servo committed Feb 26, 2015
2 parents 24139a2 + a2f1f12 commit 8ad3c5a
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 1 deletion.
3 changes: 2 additions & 1 deletion components/layout/construct.rs
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions tests/ref/basic.list
Expand Up @@ -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
24 changes: 24 additions & 0 deletions tests/ref/hide_after_create.html
@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html class="reftest-wait">
<style type="text/css">
.hidden {
display: none;
}
body {
background-color: green;
}
iframe {
background-color: red;
border: 0;
}
</style>
<body>
<iframe id="iframe" src="about:blank"></iframe>
</body>
<script type="text/javascript">
window.onload = function() {
document.getElementById("iframe").classList.add("hidden");
document.documentElement.classList.remove("reftest-wait");
}
</script>
</html>
10 changes: 10 additions & 0 deletions tests/ref/hide_after_create_ref.html
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
<style type="text/css">
body {
background-color: green;
}
</style>
<body>
</body>
</html>

0 comments on commit 8ad3c5a

Please sign in to comment.