diff options
author | Josh Matthews <josh@joshmatthews.net> | 2021-03-03 09:36:11 -0500 |
---|---|---|
committer | Josh Matthews <josh@joshmatthews.net> | 2021-03-05 20:00:30 -0500 |
commit | 49ddc5ea3d43b308b636b6e1b9e03b7ecea14119 (patch) | |
tree | 3e1c95988e8aa1f0cc841a46fad9aca7324506b7 /components/servo/lib.rs | |
parent | 10231573be736a0bd4e3c8e85e88a03b748db0ef (diff) | |
download | servo-49ddc5ea3d43b308b636b6e1b9e03b7ecea14119.tar.gz servo-49ddc5ea3d43b308b636b6e1b9e03b7ecea14119.zip |
Only request synchronous repaint when a resize will actually occur.
Diffstat (limited to 'components/servo/lib.rs')
-rw-r--r-- | components/servo/lib.rs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/components/servo/lib.rs b/components/servo/lib.rs index b6a0499f15d..018446457be 100644 --- a/components/servo/lib.rs +++ b/components/servo/lib.rs @@ -549,7 +549,7 @@ where } } - fn handle_window_event(&mut self, event: WindowEvent) { + fn handle_window_event(&mut self, event: WindowEvent) -> bool { match event { WindowEvent::Idle => {}, @@ -558,7 +558,7 @@ where }, WindowEvent::Resize => { - self.compositor.on_resize_window_event(); + return self.compositor.on_resize_window_event(); }, WindowEvent::AllowNavigationResponse(pipeline_id, allowed) => { @@ -745,6 +745,7 @@ where } }, } + return false; } fn receive_messages(&mut self) { @@ -776,18 +777,20 @@ where ::std::mem::replace(&mut self.embedder_events, Vec::new()) } - pub fn handle_events(&mut self, events: Vec<WindowEvent>) { + pub fn handle_events(&mut self, events: Vec<WindowEvent>) -> bool { if self.compositor.receive_messages() { self.receive_messages(); } + let mut need_resize = false; for event in events { - self.handle_window_event(event); + need_resize |= self.handle_window_event(event); } if self.compositor.shutdown_state != ShutdownState::FinishedShuttingDown { self.compositor.perform_updates(); } else { self.embedder_events.push((None, EmbedderMsg::Shutdown)); } + need_resize } pub fn repaint_synchronously(&mut self) { |