mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
script: Make callbacks generic over DOM interfaces. (#35459)
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
parent
2b0d2ecc73
commit
a433b20259
9 changed files with 141 additions and 97 deletions
|
@ -77,7 +77,7 @@ pub(crate) enum CommonEventHandler {
|
|||
}
|
||||
|
||||
impl CommonEventHandler {
|
||||
fn parent(&self) -> &CallbackFunction {
|
||||
fn parent(&self) -> &CallbackFunction<crate::DomTypeHolder> {
|
||||
match *self {
|
||||
CommonEventHandler::EventHandler(ref handler) => &handler.parent,
|
||||
CommonEventHandler::ErrorEventHandler(ref handler) => &handler.parent,
|
||||
|
@ -612,7 +612,7 @@ impl EventTarget {
|
|||
}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
pub(crate) fn set_event_handler_common<T: CallbackContainer>(
|
||||
pub(crate) fn set_event_handler_common<T: CallbackContainer<crate::DomTypeHolder>>(
|
||||
&self,
|
||||
ty: &str,
|
||||
listener: Option<Rc<T>>,
|
||||
|
@ -628,7 +628,7 @@ impl EventTarget {
|
|||
}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
pub(crate) fn set_error_event_handler<T: CallbackContainer>(
|
||||
pub(crate) fn set_error_event_handler<T: CallbackContainer<crate::DomTypeHolder>>(
|
||||
&self,
|
||||
ty: &str,
|
||||
listener: Option<Rc<T>>,
|
||||
|
@ -644,7 +644,7 @@ impl EventTarget {
|
|||
}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
pub(crate) fn set_beforeunload_event_handler<T: CallbackContainer>(
|
||||
pub(crate) fn set_beforeunload_event_handler<T: CallbackContainer<crate::DomTypeHolder>>(
|
||||
&self,
|
||||
ty: &str,
|
||||
listener: Option<Rc<T>>,
|
||||
|
@ -660,7 +660,7 @@ impl EventTarget {
|
|||
}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
pub(crate) fn get_event_handler_common<T: CallbackContainer>(
|
||||
pub(crate) fn get_event_handler_common<T: CallbackContainer<crate::DomTypeHolder>>(
|
||||
&self,
|
||||
ty: &str,
|
||||
can_gc: CanGc,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue