mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
script: Create structures for TextTrack API
Fill out the basics for the WebIDLs for the following: - TextTrack - TextTrackCue - TextTrackCueList - TextTrackList
This commit is contained in:
parent
92962de76c
commit
62a9bfa0c5
12 changed files with 571 additions and 2 deletions
|
@ -61,6 +61,6 @@ interface HTMLMediaElement : HTMLElement {
|
|||
// tracks
|
||||
// readonly attribute AudioTrackList audioTracks;
|
||||
// readonly attribute VideoTrackList videoTracks;
|
||||
// readonly attribute TextTrackList textTracks;
|
||||
// TextTrack addTextTrack(TextTrackKind kind, optional DOMString label = "", optional DOMString language = "");
|
||||
readonly attribute TextTrackList textTracks;
|
||||
TextTrack addTextTrack(TextTrackKind kind, optional DOMString label = "", optional DOMString language = "");
|
||||
};
|
||||
|
|
30
components/script/dom/webidls/TextTrack.webidl
Normal file
30
components/script/dom/webidls/TextTrack.webidl
Normal file
|
@ -0,0 +1,30 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#texttrack
|
||||
|
||||
enum TextTrackMode { "disabled", "hidden", "showing" };
|
||||
enum TextTrackKind { "subtitles", "captions", "descriptions", "chapters", "metadata" };
|
||||
|
||||
[Exposed=Window]
|
||||
interface TextTrack : EventTarget {
|
||||
readonly attribute TextTrackKind kind;
|
||||
readonly attribute DOMString label;
|
||||
readonly attribute DOMString language;
|
||||
|
||||
readonly attribute DOMString id;
|
||||
// readonly attribute DOMString inBandMetadataTrackDispatchType;
|
||||
|
||||
attribute TextTrackMode mode;
|
||||
|
||||
readonly attribute TextTrackCueList? cues;
|
||||
// readonly attribute TextTrackCueList? activeCues;
|
||||
|
||||
[Throws]
|
||||
void addCue(TextTrackCue cue);
|
||||
[Throws]
|
||||
void removeCue(TextTrackCue cue);
|
||||
|
||||
attribute EventHandler oncuechange;
|
||||
};
|
18
components/script/dom/webidls/TextTrackCue.webidl
Normal file
18
components/script/dom/webidls/TextTrackCue.webidl
Normal file
|
@ -0,0 +1,18 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#texttrackcue
|
||||
|
||||
[Exposed=Window]
|
||||
interface TextTrackCue : EventTarget {
|
||||
readonly attribute TextTrack? track;
|
||||
|
||||
attribute DOMString id;
|
||||
attribute double startTime;
|
||||
attribute double endTime;
|
||||
attribute boolean pauseOnExit;
|
||||
|
||||
attribute EventHandler onenter;
|
||||
attribute EventHandler onexit;
|
||||
};
|
12
components/script/dom/webidls/TextTrackCueList.webidl
Normal file
12
components/script/dom/webidls/TextTrackCueList.webidl
Normal file
|
@ -0,0 +1,12 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#texttrackcuelist
|
||||
|
||||
[Exposed=Window]
|
||||
interface TextTrackCueList {
|
||||
readonly attribute unsigned long length;
|
||||
getter TextTrackCue (unsigned long index);
|
||||
TextTrackCue? getCueById(DOMString id);
|
||||
};
|
16
components/script/dom/webidls/TextTrackList.webidl
Normal file
16
components/script/dom/webidls/TextTrackList.webidl
Normal file
|
@ -0,0 +1,16 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#texttracklist
|
||||
|
||||
[Exposed=Window]
|
||||
interface TextTrackList : EventTarget {
|
||||
readonly attribute unsigned long length;
|
||||
getter TextTrack (unsigned long index);
|
||||
TextTrack? getTrackById(DOMString id);
|
||||
|
||||
attribute EventHandler onchange;
|
||||
attribute EventHandler onaddtrack;
|
||||
attribute EventHandler onremovetrack;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue