mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
auto merge of #5428 : pcwalton/servo/squash-mouse-move, r=jdm
Otherwise they queue up if the event handler isn't 60FPS. r? @jdm
This commit is contained in:
commit
c1cc31b9d6
1 changed files with 17 additions and 2 deletions
|
@ -578,13 +578,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)) => {
|
||||
|
@ -593,6 +595,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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue