mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +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
|
@ -91,7 +91,6 @@ impl BluetoothAdvertisingEventMethods<crate::DomTypeHolder> for BluetoothAdverti
|
|||
type_: DOMString,
|
||||
init: &BluetoothAdvertisingEventInit,
|
||||
) -> Fallible<DomRoot<BluetoothAdvertisingEvent>> {
|
||||
let global = window.upcast::<GlobalScope>();
|
||||
let name = init.name.clone();
|
||||
let appearance = init.appearance;
|
||||
let txPower = init.txPower;
|
||||
|
@ -99,7 +98,7 @@ impl BluetoothAdvertisingEventMethods<crate::DomTypeHolder> for BluetoothAdverti
|
|||
let bubbles = EventBubbles::from(init.parent.bubbles);
|
||||
let cancelable = EventCancelable::from(init.parent.cancelable);
|
||||
Ok(BluetoothAdvertisingEvent::new(
|
||||
global,
|
||||
window.as_global_scope(),
|
||||
proto,
|
||||
Atom::from(type_),
|
||||
bubbles,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue