Remove compositor layers when iframes are removed from doc or display:none.

This commit is contained in:
Glenn Watson 2015-03-03 09:38:39 +10:00
parent 6927bf6ff0
commit 86baef2cc0
10 changed files with 145 additions and 37 deletions

View file

@ -30,7 +30,7 @@ use gfx::text::glyph::CharIndex;
use gfx::text::text_run::{TextRun, TextRunSlice};
use script_traits::UntrustedNodeAddress;
use rustc_serialize::{Encodable, Encoder};
use msg::constellation_msg::{PipelineId, SubpageId};
use msg::constellation_msg::{ConstellationChan, Msg, PipelineId, SubpageId};
use net::image::holder::ImageHolder;
use net::local_image_cache::LocalImageCache;
use servo_util::geometry::{self, Au, ZERO_POINT};
@ -2058,6 +2058,23 @@ impl Fragment {
// box too.
overflow
}
/// Remove any compositor layers associated with this fragment - it is being
/// removed from the tree or had its display property set to none.
/// TODO(gw): This just hides the compositor layer for now. In the future
/// it probably makes sense to provide a hint to the compositor whether
/// the layers should be destroyed to free memory.
pub fn remove_compositor_layers(&self, constellation_chan: ConstellationChan) {
match self.specific {
SpecificFragmentInfo::Iframe(ref iframe_info) => {
let ConstellationChan(ref chan) = constellation_chan;
chan.send(Msg::FrameRect(iframe_info.pipeline_id,
iframe_info.subpage_id,
Rect::zero())).unwrap();
}
_ => {}
}
}
}
impl fmt::Debug for Fragment {