From e3e391b09c427e2de8d04142eefa0a57937bb788 Mon Sep 17 00:00:00 2001 From: fabrizio8 Date: Fri, 2 Nov 2018 22:57:53 -0400 Subject: [PATCH 1/3] fix #22075 Combined on_scroll_window_event with on_scroll_start_window_event and on_scroll_end_window_event --- components/compositing/compositor.rs | 35 ++-------------------------- 1 file changed, 2 insertions(+), 33 deletions(-) diff --git a/components/compositing/compositor.rs b/components/compositing/compositor.rs index bc27ff37748..9cba12dddee 100644 --- a/components/compositing/compositor.rs +++ b/components/compositing/compositor.rs @@ -166,9 +166,6 @@ pub struct IOCompositor { /// image for the reftest framework. ready_to_save_state: ReadyState, - /// Whether a scroll is in progress; i.e. whether the user's fingers are down. - scroll_in_progress: bool, - in_scroll_transaction: Option, /// The webrender renderer. @@ -852,10 +849,10 @@ impl IOCompositor { match phase { TouchEventType::Move => self.on_scroll_window_event(delta, cursor), TouchEventType::Up | TouchEventType::Cancel => { - self.on_scroll_end_window_event(delta, cursor); + self.on_scroll_window_event(delta, cursor); }, TouchEventType::Down => { - self.on_scroll_start_window_event(delta, cursor); + self.on_scroll_window_event(delta, cursor); }, } } @@ -870,34 +867,6 @@ impl IOCompositor { }); } - fn on_scroll_start_window_event( - &mut self, - scroll_location: ScrollLocation, - cursor: DeviceIntPoint, - ) { - self.scroll_in_progress = true; - self.pending_scroll_zoom_events.push(ScrollZoomEvent { - magnification: 1.0, - scroll_location: scroll_location, - cursor: cursor, - event_count: 1, - }); - } - - fn on_scroll_end_window_event( - &mut self, - scroll_location: ScrollLocation, - cursor: DeviceIntPoint, - ) { - self.scroll_in_progress = false; - self.pending_scroll_zoom_events.push(ScrollZoomEvent { - magnification: 1.0, - scroll_location: scroll_location, - cursor: cursor, - event_count: 1, - }); - } - fn process_pending_scroll_events(&mut self) { let had_events = self.pending_scroll_zoom_events.len() > 0; From 85fb000e890117ad51dcdfa7a4721638254519d7 Mon Sep 17 00:00:00 2001 From: fabrizio8 Date: Sat, 3 Nov 2018 00:07:38 -0400 Subject: [PATCH 2/3] removed an unused variable --- components/compositing/compositor.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/components/compositing/compositor.rs b/components/compositing/compositor.rs index 9cba12dddee..74e0857de2d 100644 --- a/components/compositing/compositor.rs +++ b/components/compositing/compositor.rs @@ -320,7 +320,6 @@ impl IOCompositor { time_profiler_chan: state.time_profiler_chan, last_composite_time: 0, ready_to_save_state: ReadyState::Unknown, - scroll_in_progress: false, in_scroll_transaction: None, webrender: state.webrender, webrender_document: state.webrender_document, From b3319360b5d155abbfe658ec1e347e328f5ebe7b Mon Sep 17 00:00:00 2001 From: fabrizio8 Date: Sun, 4 Nov 2018 13:00:39 -0500 Subject: [PATCH 3/3] Removed unused in_scroll_transaction and removed import of std::time:Instant since it was only used by in_scroll_transaction. --- components/compositing/compositor.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/components/compositing/compositor.rs b/components/compositing/compositor.rs index 74e0857de2d..4282b1a5c1f 100644 --- a/components/compositing/compositor.rs +++ b/components/compositing/compositor.rs @@ -32,7 +32,6 @@ use std::fs::{File, create_dir_all}; use std::io::Write; use std::num::NonZeroU32; use std::rc::Rc; -use std::time::Instant; use style_traits::{CSSPixel, DevicePixel, PinchZoomFactor}; use style_traits::cursor::CursorKind; use style_traits::viewport::ViewportConstraints; @@ -166,8 +165,6 @@ pub struct IOCompositor { /// image for the reftest framework. ready_to_save_state: ReadyState, - in_scroll_transaction: Option, - /// The webrender renderer. webrender: webrender::Renderer, @@ -320,7 +317,6 @@ impl IOCompositor { time_profiler_chan: state.time_profiler_chan, last_composite_time: 0, ready_to_save_state: ReadyState::Unknown, - in_scroll_transaction: None, webrender: state.webrender, webrender_document: state.webrender_document, webrender_api: state.webrender_api, @@ -843,7 +839,7 @@ impl IOCompositor { &mut self, delta: ScrollLocation, cursor: DeviceIntPoint, - phase: TouchEventType, + phase: TouchEventType ) { match phase { TouchEventType::Move => self.on_scroll_window_event(delta, cursor), @@ -856,8 +852,11 @@ impl IOCompositor { } } - fn on_scroll_window_event(&mut self, scroll_location: ScrollLocation, cursor: DeviceIntPoint) { - self.in_scroll_transaction = Some(Instant::now()); + fn on_scroll_window_event( + &mut self, + scroll_location: ScrollLocation, + cursor: DeviceIntPoint + ) { self.pending_scroll_zoom_events.push(ScrollZoomEvent { magnification: 1.0, scroll_location: scroll_location,