mirror of
https://github.com/servo/servo.git
synced 2025-07-24 15:50:21 +01:00
Use task! for notifying about playing
This commit is contained in:
parent
e9f6ea40c2
commit
91c2865e36
1 changed files with 6 additions and 9 deletions
|
@ -171,24 +171,21 @@ impl HTMLMediaElement {
|
||||||
// TODO(nox): Take pending play promises and let promises be the result.
|
// TODO(nox): Take pending play promises and let promises be the result.
|
||||||
|
|
||||||
// Step 2.
|
// Step 2.
|
||||||
|
let target = Trusted::new(self.upcast::<EventTarget>());
|
||||||
let window = window_from_node(self);
|
let window = window_from_node(self);
|
||||||
// FIXME(nox): Why are errors silenced here?
|
// FIXME(nox): Why are errors silenced here?
|
||||||
let _ = window.dom_manipulation_task_source().queue(
|
let _ = window.dom_manipulation_task_source().queue(
|
||||||
box NotifyAboutPlayingTask(Trusted::new(self.upcast())),
|
box task!(notify_about_playing: move || {
|
||||||
window.upcast(),
|
let target = target.root();
|
||||||
);
|
|
||||||
struct NotifyAboutPlayingTask(Trusted<EventTarget>);
|
|
||||||
impl Task for NotifyAboutPlayingTask {
|
|
||||||
fn run(self: Box<Self>) {
|
|
||||||
let target = self.0.root();
|
|
||||||
|
|
||||||
// Step 2.1.
|
// Step 2.1.
|
||||||
target.fire_event(atom!("playing"));
|
target.fire_event(atom!("playing"));
|
||||||
|
|
||||||
// Step 2.2.
|
// Step 2.2.
|
||||||
// FIXME(nox): Resolve pending play promises with promises.
|
// FIXME(nox): Resolve pending play promises with promises.
|
||||||
}
|
}),
|
||||||
}
|
window.upcast(),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#ready-states
|
// https://html.spec.whatwg.org/multipage/#ready-states
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue