mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
script: Expose NodeTraits::owner_global
/ Window::as_global_scope
(#34843)
Expose two new helpers and start using them as much as possible. - `NodeTraits::owner_global`: which gets the `GlobalScope` that currenty owns a `Node`. This may be different than `.global()` in the case that the `Node` was adopted by a different `Document`. - `Window::as_global_scope`: A helper to avoid having to cast so much when treating a `Window` like a `GlobalScope`. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
17e2ca3f01
commit
e42b4b793d
33 changed files with 262 additions and 258 deletions
|
@ -82,16 +82,16 @@ impl VirtualMethods for HTMLDetailsElement {
|
|||
let counter = self.toggle_counter.get() + 1;
|
||||
self.toggle_counter.set(counter);
|
||||
|
||||
let window = self.owner_window();
|
||||
let this = Trusted::new(self);
|
||||
window.task_manager().dom_manipulation_task_source().queue(
|
||||
task!(details_notification_task_steps: move || {
|
||||
self.owner_global()
|
||||
.task_manager()
|
||||
.dom_manipulation_task_source()
|
||||
.queue(task!(details_notification_task_steps: move || {
|
||||
let this = this.root();
|
||||
if counter == this.toggle_counter.get() {
|
||||
this.upcast::<EventTarget>().fire_event(atom!("toggle"), CanGc::note());
|
||||
}
|
||||
}),
|
||||
);
|
||||
}));
|
||||
self.upcast::<Node>().dirty(NodeDamage::OtherNodeDamage)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue