mirror of
https://github.com/servo/servo.git
synced 2025-08-08 06:55:31 +01:00
Use Window in new methods instead of GlobalScope for interfaces with … (#36133)
…Window-only constructors <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #36118 (GitHub issue number if applicable) <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because ___ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> --------- Signed-off-by: richarddushime <mudaherarich@gmail.com> Signed-off-by: Richard Dushime <45734838+richarddushime@users.noreply.github.com>
This commit is contained in:
parent
2ce306f450
commit
60baa8ce11
40 changed files with 226 additions and 240 deletions
|
@ -11,12 +11,11 @@ use crate::dom::bindings::codegen::Bindings::GamepadEventBinding;
|
|||
use crate::dom::bindings::codegen::Bindings::GamepadEventBinding::GamepadEventMethods;
|
||||
use crate::dom::bindings::error::Fallible;
|
||||
use crate::dom::bindings::inheritance::Castable;
|
||||
use crate::dom::bindings::reflector::{DomGlobal, reflect_dom_object_with_proto};
|
||||
use crate::dom::bindings::reflector::reflect_dom_object_with_proto;
|
||||
use crate::dom::bindings::root::{Dom, DomRoot};
|
||||
use crate::dom::bindings::str::DOMString;
|
||||
use crate::dom::event::Event;
|
||||
use crate::dom::gamepad::Gamepad;
|
||||
use crate::dom::globalscope::GlobalScope;
|
||||
use crate::dom::window::Window;
|
||||
use crate::script_runtime::CanGc;
|
||||
|
||||
|
@ -40,18 +39,18 @@ impl GamepadEvent {
|
|||
}
|
||||
|
||||
pub(crate) fn new(
|
||||
global: &GlobalScope,
|
||||
window: &Window,
|
||||
type_: Atom,
|
||||
bubbles: bool,
|
||||
cancelable: bool,
|
||||
gamepad: &Gamepad,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<GamepadEvent> {
|
||||
Self::new_with_proto(global, None, type_, bubbles, cancelable, gamepad, can_gc)
|
||||
Self::new_with_proto(window, None, type_, bubbles, cancelable, gamepad, can_gc)
|
||||
}
|
||||
|
||||
fn new_with_proto(
|
||||
global: &GlobalScope,
|
||||
window: &Window,
|
||||
proto: Option<HandleObject>,
|
||||
type_: Atom,
|
||||
bubbles: bool,
|
||||
|
@ -61,7 +60,7 @@ impl GamepadEvent {
|
|||
) -> DomRoot<GamepadEvent> {
|
||||
let ev = reflect_dom_object_with_proto(
|
||||
Box::new(GamepadEvent::new_inherited(gamepad)),
|
||||
global,
|
||||
window,
|
||||
proto,
|
||||
can_gc,
|
||||
);
|
||||
|
@ -73,7 +72,7 @@ impl GamepadEvent {
|
|||
}
|
||||
|
||||
pub(crate) fn new_with_type(
|
||||
global: &GlobalScope,
|
||||
window: &Window,
|
||||
event_type: GamepadEventType,
|
||||
gamepad: &Gamepad,
|
||||
can_gc: CanGc,
|
||||
|
@ -83,7 +82,7 @@ impl GamepadEvent {
|
|||
GamepadEventType::Disconnected => "gamepaddisconnected",
|
||||
};
|
||||
|
||||
GamepadEvent::new(global, name.into(), false, false, gamepad, can_gc)
|
||||
GamepadEvent::new(window, name.into(), false, false, gamepad, can_gc)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -97,7 +96,7 @@ impl GamepadEventMethods<crate::DomTypeHolder> for GamepadEvent {
|
|||
init: &GamepadEventBinding::GamepadEventInit,
|
||||
) -> Fallible<DomRoot<GamepadEvent>> {
|
||||
Ok(GamepadEvent::new_with_proto(
|
||||
&window.global(),
|
||||
window,
|
||||
proto,
|
||||
Atom::from(type_),
|
||||
init.parent.bubbles,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue