mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
constellation: Cleanup the frame size handler.
This is a followup to #15129, addressing my last review comment.
This commit is contained in:
parent
7e2329ea4e
commit
79ef2067cd
1 changed files with 18 additions and 15 deletions
|
@ -1329,23 +1329,26 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
|
||||||
fn handle_frame_size_msg(&mut self,
|
fn handle_frame_size_msg(&mut self,
|
||||||
iframe_sizes: Vec<(PipelineId, TypedSize2D<f32, PagePx>)>) {
|
iframe_sizes: Vec<(PipelineId, TypedSize2D<f32, PagePx>)>) {
|
||||||
for (pipeline_id, size) in iframe_sizes {
|
for (pipeline_id, size) in iframe_sizes {
|
||||||
let result = match self.pipelines.get_mut(&pipeline_id) {
|
let result = {
|
||||||
Some(pipeline) => {
|
let pipeline = match self.pipelines.get_mut(&pipeline_id) {
|
||||||
if pipeline.size != Some(size) {
|
Some(pipeline) => pipeline,
|
||||||
pipeline.size = Some(size);
|
None => continue,
|
||||||
let msg = ConstellationControlMsg::Resize(pipeline_id, WindowSizeData {
|
};
|
||||||
visible_viewport: size,
|
|
||||||
initial_viewport: size * ScaleFactor::new(1.0),
|
if pipeline.size == Some(size) {
|
||||||
device_pixel_ratio: self.window_size.device_pixel_ratio,
|
continue;
|
||||||
}, WindowSizeType::Initial);
|
|
||||||
Some(pipeline.event_loop.send(msg))
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
None => None
|
|
||||||
|
pipeline.size = Some(size);
|
||||||
|
let msg = ConstellationControlMsg::Resize(pipeline_id, WindowSizeData {
|
||||||
|
visible_viewport: size,
|
||||||
|
initial_viewport: size * ScaleFactor::new(1.0),
|
||||||
|
device_pixel_ratio: self.window_size.device_pixel_ratio,
|
||||||
|
}, WindowSizeType::Initial);
|
||||||
|
|
||||||
|
pipeline.event_loop.send(msg)
|
||||||
};
|
};
|
||||||
if let Some(Err(e)) = result {
|
if let Err(e) = result {
|
||||||
self.handle_send_error(pipeline_id, e);
|
self.handle_send_error(pipeline_id, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue