diff --git a/components/compositing/compositor.rs b/components/compositing/compositor.rs index 78f9f83c43d..7211749653c 100644 --- a/components/compositing/compositor.rs +++ b/components/compositing/compositor.rs @@ -298,9 +298,7 @@ impl IOCompositor { (Msg::SetFrameTree(frame_tree, response_chan, new_constellation_chan), ShutdownState::NotShuttingDown) => { - self.set_frame_tree(&frame_tree, - response_chan, - new_constellation_chan); + self.set_frame_tree(&frame_tree, response_chan, new_constellation_chan); self.send_viewport_rects_for_all_layers(); self.get_title_for_main_frame(); } @@ -326,7 +324,10 @@ impl IOCompositor { (Msg::AssignPaintedBuffers(pipeline_id, epoch, replies), ShutdownState::NotShuttingDown) => { for (layer_id, new_layer_buffer_set) in replies.into_iter() { - self.assign_painted_buffers(pipeline_id, layer_id, new_layer_buffer_set, epoch); + self.assign_painted_buffers(pipeline_id, + layer_id, + new_layer_buffer_set, + epoch); } self.remove_outstanding_paint_msg(); } @@ -580,7 +581,8 @@ impl IOCompositor { return root_layer; } - fn find_pipeline_root_layer(&self, pipeline_id: PipelineId) -> Option>> { + fn find_pipeline_root_layer(&self, pipeline_id: PipelineId) + -> Option>> { if !self.pipeline_details.contains_key(&pipeline_id) { panic!("Tried to create or update layer for unknown pipeline") } @@ -683,22 +685,19 @@ impl IOCompositor { fn scroll_layer_to_fragment_point_if_necessary(&mut self, pipeline_id: PipelineId, layer_id: LayerId) { - match self.fragment_point.take() { - Some(point) => { - if !self.move_layer(pipeline_id, layer_id, Point2D::from_untyped(&point)) { - panic!("Compositor: Tried to scroll to fragment with unknown layer."); - } - - self.start_scrolling_timer_if_necessary(); + if let Some(point) = self.fragment_point.take() { + if !self.move_layer(pipeline_id, layer_id, Point2D::from_untyped(&point)) { + panic!("Compositor: Tried to scroll to fragment with unknown layer."); } - None => {} + + self.start_scrolling_timer_if_necessary(); } } fn start_scrolling_timer_if_necessary(&mut self) { match self.composition_request { - CompositionRequest::CompositeNow | CompositionRequest::CompositeOnScrollTimeout(_) => - return, + CompositionRequest::CompositeNow(_) | + CompositionRequest::CompositeOnScrollTimeout(_) => return, CompositionRequest::NoCompositingNecessary => {} } @@ -1160,19 +1159,15 @@ impl IOCompositor { origin: Point2D::zero(), size: self.window_size.as_f32(), }; - // paint the scene. - match self.scene.root { - Some(ref layer) => { - match self.context { - None => { - debug!("compositor: not compositing because context not yet set up") - } - Some(context) => { - rendergl::render_scene(layer.clone(), context, &self.scene); - } + + // Paint the scene. + if let Some(ref layer) = self.scene.root { + match self.context { + Some(context) => rendergl::render_scene(layer.clone(), context, &self.scene), + None => { + debug!("compositor: not compositing because context not yet set up") } } - None => {} } }); diff --git a/ports/glutin/window.rs b/ports/glutin/window.rs index ea4858de7b7..036ac5484c3 100644 --- a/ports/glutin/window.rs +++ b/ports/glutin/window.rs @@ -218,7 +218,7 @@ impl Window { fn scroll_window(&self, dx: f32, dy: f32) { let mouse_pos = self.mouse_pos.get(); let event = WindowEvent::Scroll(TypedPoint2D(dx as f32, dy as f32), - TypedPoint2D(mouse_pos.x as i32, mouse_pos.y as i32)); + TypedPoint2D(mouse_pos.x as i32, mouse_pos.y as i32)); self.event_queue.borrow_mut().push(event); } @@ -683,9 +683,8 @@ impl CompositorProxy for GlutinCompositorProxy { fn send(&mut self, msg: compositor_task::Msg) { // Send a message and kick the OS event loop awake. self.sender.send(msg).unwrap(); - match self.window_proxy { - Some(ref window_proxy) => window_proxy.wakeup_event_loop(), - None => {} + if let Some(ref window_proxy) = self.window_proxy { + window_proxy.wakeup_event_loop() } } fn clone_compositor_proxy(&self) -> Box {