mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Cleanup Document::handle_mouse_move_event a bit.
This commit is contained in:
parent
521a87180a
commit
e05d9d0646
1 changed files with 7 additions and 8 deletions
|
@ -672,14 +672,13 @@ impl Document {
|
||||||
prev_mouse_over_targets: &mut RootedVec<JS<Element>>) {
|
prev_mouse_over_targets: &mut RootedVec<JS<Element>>) {
|
||||||
// Build a list of elements that are currently under the mouse.
|
// Build a list of elements that are currently under the mouse.
|
||||||
let mouse_over_addresses = self.get_nodes_under_mouse(&point);
|
let mouse_over_addresses = self.get_nodes_under_mouse(&point);
|
||||||
let mut mouse_over_targets: RootedVec<JS<Element>> = RootedVec::new();
|
let mut mouse_over_targets = mouse_over_addresses.iter().map(|node_address| {
|
||||||
for node_address in &mouse_over_addresses {
|
node::from_untrusted_node_address(js_runtime, *node_address)
|
||||||
let node = node::from_untrusted_node_address(js_runtime, *node_address);
|
.inclusive_ancestors()
|
||||||
mouse_over_targets.push(node.r().inclusive_ancestors()
|
.filter_map(Root::downcast::<Element>)
|
||||||
.find(|node| node.is::<Element>())
|
.next()
|
||||||
.map(|node| JS::from_ref(node.downcast::<Element>().unwrap()))
|
.unwrap()
|
||||||
.unwrap());
|
}).collect::<RootedVec<JS<Element>>>();
|
||||||
};
|
|
||||||
|
|
||||||
// Remove hover from any elements in the previous list that are no longer
|
// Remove hover from any elements in the previous list that are no longer
|
||||||
// under the mouse.
|
// under the mouse.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue