From 86baef2cc0acfee669b5ffad7eca9ac10a59ad6f Mon Sep 17 00:00:00 2001 From: Glenn Watson Date: Tue, 3 Mar 2015 09:38:39 +1000 Subject: Remove compositor layers when iframes are removed from doc or display:none. --- components/layout/util.rs | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) (limited to 'components/layout/util.rs') diff --git a/components/layout/util.rs b/components/layout/util.rs index 8d4d72e7466..5b3bccd5b07 100644 --- a/components/layout/util.rs +++ b/components/layout/util.rs @@ -4,7 +4,7 @@ #![allow(unsafe_blocks)] -use construct::ConstructionResult; +use construct::{ConstructionItem, ConstructionResult}; use incremental::RestyleDamage; use parallel::DomParallelInfo; use wrapper::{LayoutNode, TLayoutNode, ThreadSafeLayoutNode}; @@ -13,6 +13,7 @@ use azure::azure_hl::Color; use gfx::display_list::OpaqueNode; use gfx; use libc::{c_void, uintptr_t}; +use msg::constellation_msg::ConstellationChan; use script::dom::bindings::js::LayoutJS; use script::dom::node::{Node, SharedLayoutData}; use script::layout_interface::{LayoutChan, TrustedNodeAddress}; @@ -79,8 +80,26 @@ pub struct LayoutDataWrapper { } impl LayoutDataWrapper { - pub fn clear(&self) { - // TODO: Clear items related to this node, e.g. compositor layers + pub fn remove_compositor_layers(&self, constellation_chan: ConstellationChan) { + match self.data.flow_construction_result { + ConstructionResult::None => {} + ConstructionResult::Flow(ref flow_ref, _) => { + flow_ref.remove_compositor_layers(constellation_chan); + } + ConstructionResult::ConstructionItem(ref construction_item) => { + match construction_item { + &ConstructionItem::InlineFragments(ref inline_fragments) => { + for fragment in inline_fragments.fragments.iter() { + fragment.remove_compositor_layers(constellation_chan.clone()); + } + } + &ConstructionItem::Whitespace(..) => {} + &ConstructionItem::TableColumnFragment(ref fragment) => { + fragment.remove_compositor_layers(constellation_chan.clone()); + } + } + } + } } } -- cgit v1.2.3