mirror of
https://github.com/servo/servo.git
synced 2025-08-04 21:20:23 +01:00
Utilize Constellation::frame
utility.
This commit is contained in:
parent
5b8041147d
commit
b13b8035ae
1 changed files with 5 additions and 9 deletions
|
@ -1146,10 +1146,8 @@ impl<LTF: LayoutThreadFactory, STF: ScriptThreadFactory> Constellation<LTF, STF>
|
||||||
|
|
||||||
fn handle_get_pipeline(&mut self, frame_id: Option<FrameId>,
|
fn handle_get_pipeline(&mut self, frame_id: Option<FrameId>,
|
||||||
resp_chan: IpcSender<Option<PipelineId>>) {
|
resp_chan: IpcSender<Option<PipelineId>>) {
|
||||||
let current_pipeline_id = frame_id.or(self.root_frame_id).map(|frame_id| {
|
let current_pipeline_id = frame_id.or(self.root_frame_id)
|
||||||
let frame = self.frames.get(&frame_id).unwrap();
|
.map(|frame_id| self.frame(frame_id).current);
|
||||||
frame.current
|
|
||||||
});
|
|
||||||
let pipeline_id = self.pending_frames.iter().rev()
|
let pipeline_id = self.pending_frames.iter().rev()
|
||||||
.find(|x| x.old_pipeline_id == current_pipeline_id)
|
.find(|x| x.old_pipeline_id == current_pipeline_id)
|
||||||
.map(|x| x.new_pipeline_id).or(current_pipeline_id);
|
.map(|x| x.new_pipeline_id).or(current_pipeline_id);
|
||||||
|
@ -1257,10 +1255,8 @@ impl<LTF: LayoutThreadFactory, STF: ScriptThreadFactory> Constellation<LTF, STF>
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
WebDriverCommandMsg::TakeScreenshot(pipeline_id, reply) => {
|
WebDriverCommandMsg::TakeScreenshot(pipeline_id, reply) => {
|
||||||
let current_pipeline_id = self.root_frame_id.map(|frame_id| {
|
let current_pipeline_id = self.root_frame_id
|
||||||
let frame = self.frames.get(&frame_id).unwrap();
|
.map(|frame_id| self.frame(frame_id).current);
|
||||||
frame.current
|
|
||||||
});
|
|
||||||
if Some(pipeline_id) == current_pipeline_id {
|
if Some(pipeline_id) == current_pipeline_id {
|
||||||
self.compositor_proxy.send(ToCompositorMsg::CreatePng(reply));
|
self.compositor_proxy.send(ToCompositorMsg::CreatePng(reply));
|
||||||
} else {
|
} else {
|
||||||
|
@ -1398,7 +1394,7 @@ impl<LTF: LayoutThreadFactory, STF: ScriptThreadFactory> Constellation<LTF, STF>
|
||||||
if let Some(root_frame_id) = self.root_frame_id {
|
if let Some(root_frame_id) = self.root_frame_id {
|
||||||
// Send Resize (or ResizeInactive) messages to each
|
// Send Resize (or ResizeInactive) messages to each
|
||||||
// pipeline in the frame tree.
|
// pipeline in the frame tree.
|
||||||
let frame = self.frames.get(&root_frame_id).unwrap();
|
let frame = self.frame(root_frame_id);
|
||||||
|
|
||||||
let pipeline = self.pipelines.get(&frame.current).unwrap();
|
let pipeline = self.pipelines.get(&frame.current).unwrap();
|
||||||
let _ = pipeline.script_chan.send(ConstellationControlMsg::Resize(pipeline.id, new_size));
|
let _ = pipeline.script_chan.send(ConstellationControlMsg::Resize(pipeline.id, new_size));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue