mirror of
https://github.com/servo/servo.git
synced 2025-06-10 17:43:16 +00:00
Some CanGc fixes in components/script/dom (#33895)
Signed-off-by: taniishkaaa <tanishkasingh2004@gmail.com>
This commit is contained in:
parent
e33bae6d0a
commit
6b87ecc291
5 changed files with 23 additions and 15 deletions
|
@ -1817,7 +1817,11 @@ impl Document {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The entry point for all key processing for web content
|
/// The entry point for all key processing for web content
|
||||||
pub fn dispatch_key_event(&self, keyboard_event: ::keyboard_types::KeyboardEvent) {
|
pub fn dispatch_key_event(
|
||||||
|
&self,
|
||||||
|
keyboard_event: ::keyboard_types::KeyboardEvent,
|
||||||
|
can_gc: CanGc,
|
||||||
|
) {
|
||||||
let focused = self.get_focused_element();
|
let focused = self.get_focused_element();
|
||||||
let body = self.GetBody();
|
let body = self.GetBody();
|
||||||
|
|
||||||
|
@ -1842,6 +1846,7 @@ impl Document {
|
||||||
keyboard_event.modifiers,
|
keyboard_event.modifiers,
|
||||||
0,
|
0,
|
||||||
keyboard_event.key.legacy_keycode(),
|
keyboard_event.key.legacy_keycode(),
|
||||||
|
can_gc,
|
||||||
);
|
);
|
||||||
let event = keyevent.upcast::<Event>();
|
let event = keyevent.upcast::<Event>();
|
||||||
event.fire(target);
|
event.fire(target);
|
||||||
|
@ -1869,6 +1874,7 @@ impl Document {
|
||||||
keyboard_event.modifiers,
|
keyboard_event.modifiers,
|
||||||
keyboard_event.key.legacy_charcode(),
|
keyboard_event.key.legacy_charcode(),
|
||||||
0,
|
0,
|
||||||
|
can_gc,
|
||||||
);
|
);
|
||||||
let ev = event.upcast::<Event>();
|
let ev = event.upcast::<Event>();
|
||||||
ev.fire(target);
|
ev.fire(target);
|
||||||
|
@ -4677,6 +4683,7 @@ impl DocumentMethods for Document {
|
||||||
))),
|
))),
|
||||||
"keyboardevent" => Ok(DomRoot::upcast(KeyboardEvent::new_uninitialized(
|
"keyboardevent" => Ok(DomRoot::upcast(KeyboardEvent::new_uninitialized(
|
||||||
&self.window,
|
&self.window,
|
||||||
|
can_gc,
|
||||||
))),
|
))),
|
||||||
"messageevent" => Ok(DomRoot::upcast(MessageEvent::new_uninitialized(
|
"messageevent" => Ok(DomRoot::upcast(MessageEvent::new_uninitialized(
|
||||||
self.window.upcast(),
|
self.window.upcast(),
|
||||||
|
|
|
@ -54,8 +54,8 @@ impl KeyboardEvent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_uninitialized(window: &Window) -> DomRoot<KeyboardEvent> {
|
pub fn new_uninitialized(window: &Window, can_gc: CanGc) -> DomRoot<KeyboardEvent> {
|
||||||
Self::new_uninitialized_with_proto(window, None, CanGc::note())
|
Self::new_uninitialized_with_proto(window, None, can_gc)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn new_uninitialized_with_proto(
|
fn new_uninitialized_with_proto(
|
||||||
|
@ -87,6 +87,7 @@ impl KeyboardEvent {
|
||||||
modifiers: Modifiers,
|
modifiers: Modifiers,
|
||||||
char_code: u32,
|
char_code: u32,
|
||||||
key_code: u32,
|
key_code: u32,
|
||||||
|
can_gc: CanGc,
|
||||||
) -> DomRoot<KeyboardEvent> {
|
) -> DomRoot<KeyboardEvent> {
|
||||||
Self::new_with_proto(
|
Self::new_with_proto(
|
||||||
window,
|
window,
|
||||||
|
@ -104,7 +105,7 @@ impl KeyboardEvent {
|
||||||
modifiers,
|
modifiers,
|
||||||
char_code,
|
char_code,
|
||||||
key_code,
|
key_code,
|
||||||
CanGc::note(),
|
can_gc,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -290,7 +290,14 @@ impl RTCPeerConnection {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let track = MediaStreamTrack::new(&self.global(), id, ty);
|
let track = MediaStreamTrack::new(&self.global(), id, ty);
|
||||||
let event = RTCTrackEvent::new(&self.global(), atom!("track"), false, false, &track);
|
let event = RTCTrackEvent::new(
|
||||||
|
&self.global(),
|
||||||
|
atom!("track"),
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
&track,
|
||||||
|
CanGc::note(),
|
||||||
|
);
|
||||||
event.upcast::<Event>().fire(self.upcast());
|
event.upcast::<Event>().fire(self.upcast());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,16 +40,9 @@ impl RTCTrackEvent {
|
||||||
bubbles: bool,
|
bubbles: bool,
|
||||||
cancelable: bool,
|
cancelable: bool,
|
||||||
track: &MediaStreamTrack,
|
track: &MediaStreamTrack,
|
||||||
|
can_gc: CanGc,
|
||||||
) -> DomRoot<RTCTrackEvent> {
|
) -> DomRoot<RTCTrackEvent> {
|
||||||
Self::new_with_proto(
|
Self::new_with_proto(global, None, type_, bubbles, cancelable, track, can_gc)
|
||||||
global,
|
|
||||||
None,
|
|
||||||
type_,
|
|
||||||
bubbles,
|
|
||||||
cancelable,
|
|
||||||
track,
|
|
||||||
CanGc::note(),
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn new_with_proto(
|
fn new_with_proto(
|
||||||
|
|
|
@ -1624,7 +1624,7 @@ impl ScriptThread {
|
||||||
},
|
},
|
||||||
|
|
||||||
CompositorEvent::KeyboardEvent(key_event) => {
|
CompositorEvent::KeyboardEvent(key_event) => {
|
||||||
document.dispatch_key_event(key_event);
|
document.dispatch_key_event(key_event, can_gc);
|
||||||
},
|
},
|
||||||
|
|
||||||
CompositorEvent::IMEDismissedEvent => {
|
CompositorEvent::IMEDismissedEvent => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue