aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/script_task.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/script_task.rs')
-rw-r--r--components/script/script_task.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/components/script/script_task.rs b/components/script/script_task.rs
index bd20c027d79..7df8bef26aa 100644
--- a/components/script/script_task.rs
+++ b/components/script/script_task.rs
@@ -91,6 +91,7 @@ use std::any::Any;
use std::borrow::ToOwned;
use std::cell::{Cell, RefCell};
use std::collections::HashSet;
+use std::mem;
use std::option::Option;
use std::ptr;
use std::rc::Rc;
@@ -1395,11 +1396,12 @@ impl ScriptTask {
}
let page = get_page(&self.root_page(), pipeline_id);
let document = page.document().root();
+ // We temporarily steal the list of targets over which the mouse is to pass it to
+ // handle_mouse_move_event() in a safe RootedVec container.
let mut mouse_over_targets = RootedVec::new();
- mouse_over_targets.append(&mut *self.mouse_over_targets.borrow_mut());
-
+ mem::swap(&mut *self.mouse_over_targets.borrow_mut(), &mut *mouse_over_targets);
document.r().handle_mouse_move_event(self.js_runtime.rt(), point, &mut mouse_over_targets);
- *self.mouse_over_targets.borrow_mut() = mouse_over_targets.clone();
+ mem::swap(&mut *self.mouse_over_targets.borrow_mut(), &mut *mouse_over_targets);
}
KeyEvent(key, state, modifiers) => {