diff --git a/servo/ports/glutin/window.rs b/servo/ports/glutin/window.rs index af8cf8a242be..1ff972f9b643 100644 --- a/servo/ports/glutin/window.rs +++ b/servo/ports/glutin/window.rs @@ -204,17 +204,7 @@ impl Window { MouseScrollDelta::LineDelta(dx, dy) => (dx, dy * LINE_HEIGHT), MouseScrollDelta::PixelDelta(dx, dy) => (dx, dy), }; - - if !self.key_modifiers.get().intersects(LEFT_CONTROL | RIGHT_CONTROL) { - self.scroll_window(dx, dy); - } else { - let factor = if dy > 0. { - 1.1 - } else { - 1.0 / 1.1 - }; - self.pinch_zoom(factor); - } + self.scroll_window(dx, dy); }, Event::Refresh => { self.event_queue.borrow_mut().push(WindowEvent::Refresh); @@ -234,10 +224,6 @@ impl Window { self.key_modifiers.set(modifiers); } - fn pinch_zoom(&self, factor: f32) { - self.event_queue.borrow_mut().push(WindowEvent::PinchZoom(factor)); - } - /// Helper function to send a scroll event. fn scroll_window(&self, dx: f32, dy: f32) { let mouse_pos = self.mouse_pos.get(); @@ -646,12 +632,19 @@ impl WindowMethods for Window { fn handle_key(&self, key: Key, mods: constellation_msg::KeyModifiers) { match (mods, key) { - (_, Key::Equal) if mods & !SHIFT == CMD_OR_CONTROL => { - self.event_queue.borrow_mut().push(WindowEvent::Zoom(1.1)); + (_, Key::Equal) => { + if mods & !SHIFT == CMD_OR_CONTROL { + self.event_queue.borrow_mut().push(WindowEvent::Zoom(1.1)); + } else if mods & !SHIFT == CMD_OR_CONTROL | ALT { + self.event_queue.borrow_mut().push(WindowEvent::PinchZoom(1.1)); + } } (CMD_OR_CONTROL, Key::Minus) => { self.event_queue.borrow_mut().push(WindowEvent::Zoom(1.0 / 1.1)); } + (_, Key::Minus) if mods == CMD_OR_CONTROL | ALT => { + self.event_queue.borrow_mut().push(WindowEvent::PinchZoom(1.0 / 1.1)); + } (CMD_OR_CONTROL, Key::Num0) | (CMD_OR_CONTROL, Key::Kp0) => { self.event_queue.borrow_mut().push(WindowEvent::ResetZoom);