mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-11 10:41:30 +00:00
LibWeb: Implement HTMLTrackElement.readyState
This commit is contained in:
parent
4f4fdce62a
commit
1d12cb69d4
Notes:
github-actions[bot]
2024-08-06 06:58:30 +00:00
Author: https://github.com/jamierocks
Commit: 1d12cb69d4
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/977
Reviewed-by: https://github.com/tcl3 ✅
5 changed files with 38 additions and 1 deletions
|
@ -0,0 +1 @@
|
|||
track.readyState == NONE: true
|
|
@ -0,0 +1,8 @@
|
|||
<!DOCTYPE html>
|
||||
<script src="../include.js"></script>
|
||||
<script>
|
||||
test(() => {
|
||||
const track = document.createElement('track');
|
||||
println(`track.readyState == NONE: ${track.readyState === HTMLTrackElement.NONE}`);
|
||||
});
|
||||
</script>
|
|
@ -56,4 +56,30 @@ void HTMLTrackElement::attribute_changed(FlyString const& name, Optional<String>
|
|||
}
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/media.html#dom-track-readystate
|
||||
WebIDL::UnsignedShort HTMLTrackElement::ready_state()
|
||||
{
|
||||
// The readyState attribute must return the numeric value corresponding to the text track readiness state of the track element's text track, as defined by the following list:
|
||||
switch (m_track->readiness_state()) {
|
||||
case TextTrack::ReadinessState::NotLoaded:
|
||||
// NONE (numeric value 0)
|
||||
// The text track not loaded state.
|
||||
return 0;
|
||||
case TextTrack::ReadinessState::Loading:
|
||||
// LOADING (numeric value 1)
|
||||
// The text track loading state.
|
||||
return 1;
|
||||
case TextTrack::ReadinessState::Loaded:
|
||||
// LOADED (numeric value 2)
|
||||
// The text track loaded state.
|
||||
return 2;
|
||||
case TextTrack::ReadinessState::FailedToLoad:
|
||||
// ERROR (numeric value 3)
|
||||
// The text track failed to load state.
|
||||
return 3;
|
||||
}
|
||||
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,6 +19,8 @@ class HTMLTrackElement final : public HTMLElement {
|
|||
public:
|
||||
virtual ~HTMLTrackElement() override;
|
||||
|
||||
WebIDL::UnsignedShort ready_state();
|
||||
|
||||
JS::Handle<TextTrack> track() { return m_track; }
|
||||
|
||||
private:
|
||||
|
|
|
@ -26,7 +26,7 @@ interface HTMLTrackElement : HTMLElement {
|
|||
const unsigned short LOADING = 1;
|
||||
const unsigned short LOADED = 2;
|
||||
const unsigned short ERROR = 3;
|
||||
[FIXME] readonly attribute unsigned short readyState;
|
||||
readonly attribute unsigned short readyState;
|
||||
|
||||
readonly attribute TextTrack track;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue