diff options
author | Patrick Walton <pcwalton@mimiga.net> | 2015-03-27 19:01:54 -0700 |
---|---|---|
committer | Patrick Walton <pcwalton@mimiga.net> | 2015-03-27 19:07:42 -0700 |
commit | 9695e097077f29bd44ae0cd3faa0cf35ab9e4ef6 (patch) | |
tree | d42331f5e54f817b2360d23c7f9e37a2ca141c4d /components/script/script_task.rs | |
parent | 55f9bd5d6f95cde282909c9128c00e9644332729 (diff) | |
download | servo-9695e097077f29bd44ae0cd3faa0cf35ab9e4ef6.tar.gz servo-9695e097077f29bd44ae0cd3faa0cf35ab9e4ef6.zip |
script: Squash mouse-move events just like resizes.
Otherwise they queue up if the event handler isn't 60FPS.
Diffstat (limited to 'components/script/script_task.rs')
-rw-r--r-- | components/script/script_task.rs | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/components/script/script_task.rs b/components/script/script_task.rs index e5463285200..c289a0576dc 100644 --- a/components/script/script_task.rs +++ b/components/script/script_task.rs @@ -574,13 +574,15 @@ impl ScriptTask { } }; - // Squash any pending resize and reflow events in the queue. + // Squash any pending resize, reflow, and mouse-move events in the queue. + let mut mouse_move_event_index = None; loop { match event { // This has to be handled before the ResizeMsg below, // otherwise the page may not have been added to the // child list yet, causing the find() to fail. - MixedMessage::FromConstellation(ConstellationControlMsg::AttachLayout(new_layout_info)) => { + MixedMessage::FromConstellation(ConstellationControlMsg::AttachLayout( + new_layout_info)) => { self.handle_new_layout(new_layout_info); } MixedMessage::FromConstellation(ConstellationControlMsg::Resize(id, size)) => { @@ -589,6 +591,19 @@ impl ScriptTask { MixedMessage::FromConstellation(ConstellationControlMsg::Viewport(id, rect)) => { self.handle_viewport(id, rect); } + MixedMessage::FromConstellation(ConstellationControlMsg::SendEvent( + _, + MouseMoveEvent(_))) => { + match mouse_move_event_index { + None => { + mouse_move_event_index = Some(sequential.len()); + sequential.push(event); + } + Some(index) => { + sequential[index] = event + } + } + } _ => { sequential.push(event); } |