mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +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
|
@ -205,6 +205,7 @@ use crate::stylesheet_set::StylesheetSetRef;
|
|||
use crate::task::TaskBox;
|
||||
use crate::task_source::TaskSourceName;
|
||||
use crate::timers::OneshotTimerCallback;
|
||||
use crate::DomTypes;
|
||||
|
||||
/// The number of times we are allowed to see spurious `requestAnimationFrame()` calls before
|
||||
/// falling back to fake ones.
|
||||
|
@ -6214,3 +6215,13 @@ fn is_named_element_with_id_attribute(elem: &Element) -> bool {
|
|||
// behaviour is actually implemented
|
||||
elem.is::<HTMLImageElement>() && elem.get_name().is_some_and(|name| !name.is_empty())
|
||||
}
|
||||
|
||||
pub(crate) trait DocumentHelpers<D: DomTypes> {
|
||||
fn ensure_safe_to_run_script_or_layout(&self);
|
||||
}
|
||||
|
||||
impl DocumentHelpers<crate::DomTypeHolder> for Document {
|
||||
fn ensure_safe_to_run_script_or_layout(&self) {
|
||||
Document::ensure_safe_to_run_script_or_layout(self)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue