mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Use a stack guard and a macro for RootedVec instead of return_address.
This commit is contained in:
parent
0db1faf876
commit
b79a7d468e
8 changed files with 77 additions and 71 deletions
|
@ -9,7 +9,6 @@ use dom::bindings::global::GlobalRoot;
|
|||
use dom::bindings::inheritance::Castable;
|
||||
use dom::bindings::js::{JS, Root, RootedReference};
|
||||
use dom::bindings::reflector::Reflectable;
|
||||
use dom::bindings::trace::RootedVec;
|
||||
use dom::document::Document;
|
||||
use dom::event::{Event, EventPhase};
|
||||
use dom::eventtarget::{CompiledEventListener, EventTarget, ListenerPhase};
|
||||
|
@ -128,12 +127,12 @@ pub fn dispatch_event(target: &EventTarget,
|
|||
|
||||
// Step 3. The "invoke" algorithm is only used on `target` separately,
|
||||
// so we don't put it in the path.
|
||||
let mut event_path: RootedVec<JS<EventTarget>> = RootedVec::new();
|
||||
rooted_vec!(let mut event_path);
|
||||
|
||||
// Step 4.
|
||||
if let Some(target_node) = target.downcast::<Node>() {
|
||||
for ancestor in target_node.ancestors() {
|
||||
event_path.push(JS::from_ref(ancestor.upcast()));
|
||||
event_path.push(JS::from_ref(ancestor.upcast::<EventTarget>()));
|
||||
}
|
||||
let top_most_ancestor_or_target =
|
||||
Root::from_ref(event_path.r().last().cloned().unwrap_or(target));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue