diff options
author | Tim Kuehn <tkuehn@cmu.edu> | 2013-07-29 22:48:19 -0700 |
---|---|---|
committer | Tim Kuehn <tkuehn@cmu.edu> | 2013-07-29 22:48:19 -0700 |
commit | 1d4b0844b4d24240f4fc07ddc189af9848e64d0e (patch) | |
tree | 2fcad527f05d831c6726f097e2d3e2291c152262 /src | |
parent | 80675351b3195071bafac7b7af76c8bee9085ba4 (diff) | |
download | servo-1d4b0844b4d24240f4fc07ddc189af9848e64d0e.tar.gz servo-1d4b0844b4d24240f4fc07ddc189af9848e64d0e.zip |
refactored for more code reuse in constellation
Diffstat (limited to 'src')
-rw-r--r-- | src/components/main/constellation.rs | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/src/components/main/constellation.rs b/src/components/main/constellation.rs index 4ffe5e3230d..b5783533da9 100644 --- a/src/components/main/constellation.rs +++ b/src/components/main/constellation.rs @@ -509,17 +509,12 @@ impl Constellation { // from a pending frame. The only time that we will grant paint permission is // when the message originates from a pending frame or the current frame. - for self.current_frame().iter().advance |current_frame| { + for self.current_frame().iter().advance |¤t_frame| { // Messages originating in the current frame are not navigations; // TODO(tkuehn): In fact, this kind of message might be provably // impossible to occur. if current_frame.contains(pipeline_id) { - let (port, chan) = comm::stream(); - self.compositor_chan.send(SetIds(current_frame.to_sendable(), chan)); - port.recv(); - for current_frame.iter().advance |frame| { - frame.pipeline.grant_paint_permission(); - } + self.set_ids(current_frame); return true; } } @@ -608,12 +603,7 @@ impl Constellation { // Grants a frame tree permission to paint; optionally updates navigation to reflect a new page fn grant_paint_permission(&mut self, frame_tree: @mut FrameTree) { // Give permission to paint to the new frame and all child frames - let (port, chan) = comm::stream(); - self.compositor_chan.send(SetIds(frame_tree.to_sendable(), chan)); - port.recv(); - for frame_tree.iter().advance |frame| { - frame.pipeline.grant_paint_permission(); - } + self.set_ids(frame_tree); // Don't call navigation_context.load() on a Navigate type (or None, as in the case of // parsed iframes that finish loading) @@ -633,5 +623,14 @@ impl Constellation { _ => {} } } + + fn set_ids(&self, frame_tree: @mut FrameTree) { + let (port, chan) = comm::stream(); + self.compositor_chan.send(SetIds(frame_tree.to_sendable(), chan)); + port.recv(); + for frame_tree.iter().advance |frame| { + frame.pipeline.grant_paint_permission(); + } + } } |