Skip to content

Commit

Permalink
Auto merge of #15155 - emilio:frame-size-cleanup, r=cbrewster
Browse files Browse the repository at this point in the history
constellation: Cleanup the frame size handler.

This is a followup to #15129, addressing my last review comment.

r? anyone

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/15155)
<!-- Reviewable:end -->
  • Loading branch information
bors-servo committed Jan 23, 2017
2 parents b0f9119 + 79ef206 commit 2314815
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions components/constellation/constellation.rs
Expand Up @@ -1329,23 +1329,26 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
fn handle_frame_size_msg(&mut self,
iframe_sizes: Vec<(PipelineId, TypedSize2D<f32, PagePx>)>) {
for (pipeline_id, size) in iframe_sizes {
let result = match self.pipelines.get_mut(&pipeline_id) {
Some(pipeline) => {
if pipeline.size != Some(size) {
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);
Some(pipeline.event_loop.send(msg))
} else {
None
}
let result = {
let pipeline = match self.pipelines.get_mut(&pipeline_id) {
Some(pipeline) => pipeline,
None => continue,
};

if pipeline.size == Some(size) {
continue;
}
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);
}
}
Expand Down

0 comments on commit 2314815

Please sign in to comment.