mirror of
https://github.com/servo/servo.git
synced 2025-06-23 08:34:42 +01:00
Modify node traversal loop to avoid JS roots assertion. Fixes #2321.
This commit is contained in:
parent
b1d0dac50d
commit
db81cf9bc7
1 changed files with 15 additions and 18 deletions
|
@ -1148,30 +1148,27 @@ impl ScriptTask {
|
||||||
}
|
}
|
||||||
|
|
||||||
for node_address in node_address.iter() {
|
for node_address in node_address.iter() {
|
||||||
let mut node =
|
|
||||||
|
let temp_node =
|
||||||
node::from_untrusted_node_address(
|
node::from_untrusted_node_address(
|
||||||
self.js_runtime.deref().ptr, *node_address).root();
|
self.js_runtime.deref().ptr, *node_address);
|
||||||
// Traverse node generations until a node that is an element is
|
|
||||||
// found.
|
|
||||||
while !node.is_element() {
|
|
||||||
match node.parent_node() {
|
|
||||||
Some(parent) => node = parent.root(),
|
|
||||||
None => break,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if node.is_element() {
|
let maybe_node = temp_node.root().ancestors().find(|node| node.is_element());
|
||||||
node.set_hover_state(true);
|
match maybe_node {
|
||||||
|
Some(mut node) => {
|
||||||
|
node.set_hover_state(true);
|
||||||
|
|
||||||
match *mouse_over_targets {
|
match *mouse_over_targets {
|
||||||
Some(ref mouse_over_targets) => {
|
Some(ref mouse_over_targets) => {
|
||||||
if !target_compare {
|
if !target_compare {
|
||||||
target_compare = !mouse_over_targets.contains(&node.unrooted());
|
target_compare = !mouse_over_targets.contains(&node.unrooted());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
None => {}
|
||||||
}
|
}
|
||||||
None => {}
|
target_list.push(node.unrooted());
|
||||||
}
|
}
|
||||||
target_list.push(node.unrooted());
|
None => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
match *mouse_over_targets {
|
match *mouse_over_targets {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue