mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Clean up the cast calls
This commit is contained in:
parent
13ea3ac413
commit
68014af78e
66 changed files with 412 additions and 718 deletions
|
@ -150,8 +150,7 @@ pub fn dispatch_event(target: &EventTarget, pseudo_target: Option<&EventTarget>,
|
|||
let mut chain: RootedVec<JS<EventTarget>> = RootedVec::new();
|
||||
if let Some(target_node) = target.downcast::<Node>() {
|
||||
for ancestor in target_node.ancestors() {
|
||||
let ancestor_target = ancestor.upcast::<EventTarget>();
|
||||
chain.push(JS::from_ref(ancestor_target))
|
||||
chain.push(JS::from_ref(ancestor.upcast()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -161,13 +160,9 @@ pub fn dispatch_event(target: &EventTarget, pseudo_target: Option<&EventTarget>,
|
|||
let target = event.GetTarget();
|
||||
match target {
|
||||
Some(ref target) => {
|
||||
let node: Option<&Node> = target.downcast::<Node>();
|
||||
match node {
|
||||
Some(node) => {
|
||||
let vtable = vtable_for(&node);
|
||||
vtable.handle_event(event);
|
||||
}
|
||||
None => {}
|
||||
if let Some(node) = target.downcast::<Node>() {
|
||||
let vtable = vtable_for(&node);
|
||||
vtable.handle_event(event);
|
||||
}
|
||||
}
|
||||
None => {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue