diff options
Diffstat (limited to 'components')
-rw-r--r-- | components/compositing/compositor.rs | 10 | ||||
-rw-r--r-- | components/compositing/windowing.rs | 3 | ||||
-rw-r--r-- | components/msg/constellation_msg.rs | 1 |
3 files changed, 14 insertions, 0 deletions
diff --git a/components/compositing/compositor.rs b/components/compositing/compositor.rs index 0613d337bad..2bc78a39297 100644 --- a/components/compositing/compositor.rs +++ b/components/compositing/compositor.rs @@ -851,6 +851,10 @@ impl<Window: WindowMethods> IOCompositor<Window> { self.on_zoom_window_event(magnification); } + WindowEvent::ResetZoom => { + self.on_zoom_reset_window_event(); + } + WindowEvent::PinchZoom(magnification) => { self.on_pinch_zoom_window_event(magnification); } @@ -1066,6 +1070,12 @@ impl<Window: WindowMethods> IOCompositor<Window> { self.scene.set_root_layer_size(self.window_size.as_f32()); } + fn on_zoom_reset_window_event(&mut self) { + self.page_zoom = ScaleFactor::new(1.0); + self.update_zoom_transform(); + self.send_window_size(); + } + fn on_zoom_window_event(&mut self, magnification: f32) { self.page_zoom = ScaleFactor::new((self.page_zoom.get() * magnification).max(1.0)); self.update_zoom_transform(); diff --git a/components/compositing/windowing.rs b/components/compositing/windowing.rs index 03aafb887b4..c343f37abda 100644 --- a/components/compositing/windowing.rs +++ b/components/compositing/windowing.rs @@ -64,6 +64,8 @@ pub enum WindowEvent { Zoom(f32), /// Simulated "pinch zoom" gesture for non-touch platforms (e.g. ctrl-scrollwheel). PinchZoom(f32), + /// Sent when the user resets zoom to default. + ResetZoom, /// Sent when the user uses chrome navigation (i.e. backspace or shift-backspace). Navigation(WindowNavigateMsg), /// Sent when the user quits the application @@ -86,6 +88,7 @@ impl Debug for WindowEvent { WindowEvent::Scroll(..) => write!(f, "Scroll"), WindowEvent::Zoom(..) => write!(f, "Zoom"), WindowEvent::PinchZoom(..) => write!(f, "PinchZoom"), + WindowEvent::ResetZoom => write!(f, "ResetZoom"), WindowEvent::Navigation(..) => write!(f, "Navigation"), WindowEvent::Quit => write!(f, "Quit"), } diff --git a/components/msg/constellation_msg.rs b/components/msg/constellation_msg.rs index a25a9c318e2..67436e5b09c 100644 --- a/components/msg/constellation_msg.rs +++ b/components/msg/constellation_msg.rs @@ -192,6 +192,7 @@ pub enum Key { bitflags! { flags KeyModifiers: u8 { + const NONE = 0x00, const SHIFT = 0x01, const CONTROL = 0x02, const ALT = 0x04, |