Skip to content

Commit

Permalink
Sync 'Track' and 'WebVTT' IDL files with Web-Spec
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=260734

Reviewed by Eric Carlson.

This patch is to add 'interface' web-spec links to relevant 'track' and 'VTT' files
and do minor sync-up (i.e., adding missing ?) and add 'FIXME' where applicable for future work.

* Source/WebCore/html/track/AudioTrack.idl:
* Source/WebCore/html/track/AudioTrackList.idl:
* Source/WebCore/html/track/DataCue.idl:
* Source/WebCore/html/track/TextTrack.idl:
* Source/WebCore/html/track/TextTrackCue.idl:
* Source/WebCore/html/track/TextTrackCueList.idl:
* Source/WebCore/html/track/TextTrackList.idl:
* Source/WebCore/html/track/TrackEvent.idl:
* Source/WebCore/html/track/VideoTrack.idl:
* Source/WebCore/html/track/VideoTrackList.idl:
* Source/WebCore/html/track/VTTCue.idl:
* Source/WebCore/html/track/VTTRegion.idl:

Canonical link: https://commits.webkit.org/267323@main
  • Loading branch information
Ahmad-S792 authored and Ahmad Saleem committed Aug 26, 2023
1 parent af134e6 commit 08c40bd
Show file tree
Hide file tree
Showing 12 changed files with 49 additions and 16 deletions.
6 changes: 4 additions & 2 deletions Source/WebCore/html/track/AudioTrack.idl
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

// https://html.spec.whatwg.org/multipage/media.html#audiotrack

[
Conditional=VIDEO,
ExportMacro=WEBCORE_EXPORT,
Expand All @@ -33,7 +35,7 @@
[EnabledConditionallyReadWriteBySetting=MediaSourceEnabled] attribute [AtomString] DOMString kind;
readonly attribute DOMString label;
[EnabledConditionallyReadWriteBySetting=MediaSourceEnabled] attribute [AtomString] DOMString language;
[EnabledBySetting=TrackConfigurationEnabled] readonly attribute AudioTrackConfiguration configuration;

attribute boolean enabled;

[EnabledBySetting=TrackConfigurationEnabled] readonly attribute AudioTrackConfiguration configuration;
};
6 changes: 5 additions & 1 deletion Source/WebCore/html/track/AudioTrackList.idl
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

// https://html.spec.whatwg.org/multipage/media.html#audiotracklist

[
ActiveDOMObject,
Conditional=VIDEO,
Expand All @@ -31,8 +33,10 @@
Exposed=Window
] interface AudioTrackList : EventTarget {
readonly attribute unsigned long length;

// FIXME: Remove 'item' from below to align with the specification. See: https://bugs.webkit.org/show_bug.cgi?id=260763
getter AudioTrack item(unsigned long index);
AudioTrack getTrackById([AtomString] DOMString id);
AudioTrack? getTrackById([AtomString] DOMString id);

attribute EventHandler onchange;
attribute EventHandler onaddtrack;
Expand Down
3 changes: 3 additions & 0 deletions Source/WebCore/html/track/DataCue.idl
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,14 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

// https://wicg.github.io/datacue/#datacue-interface

[
Conditional=VIDEO,
Exposed=Window
] interface DataCue : TextTrackCue {
[CallWith=CurrentDocument] constructor(unrestricted double startTime, unrestricted double endTime, ArrayBuffer data);
// FIXME: Remove 'unrestricted' from 'startTime' to align with the specification: See: https://bugs.webkit.org/show_bug.cgi?id=260764
[CallWith=CurrentDocument] constructor(unrestricted double startTime, unrestricted double endTime, any value, optional DOMString type);

attribute ArrayBuffer data;
Expand Down
6 changes: 5 additions & 1 deletion Source/WebCore/html/track/TextTrack.idl
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

// https://html.spec.whatwg.org/#texttrack

enum TextTrackMode { "disabled", "hidden", "showing" };
enum TextTrackKind { "subtitles", "captions", "descriptions", "chapters", "metadata", "forced" };

Expand All @@ -35,10 +37,11 @@ enum TextTrackKind { "subtitles", "captions", "descriptions", "chapters", "metad
SkipVTableValidation,
Exposed=Window
] interface TextTrack : EventTarget {
readonly attribute DOMString id;
[ImplementedAs=kindForBindings] attribute TextTrackKind kind;
readonly attribute DOMString label;
[EnabledConditionallyReadWriteBySetting=MediaSourceEnabled] attribute [AtomString] DOMString language;

readonly attribute DOMString id;
readonly attribute DOMString inBandMetadataTrackDispatchType;

attribute TextTrackMode mode;
Expand All @@ -51,6 +54,7 @@ enum TextTrackKind { "subtitles", "captions", "descriptions", "chapters", "metad

attribute EventHandler oncuechange;

// FIXME: Remove 'non-standard'. See: https://bugs.webkit.org/show_bug.cgi?id=260767
readonly attribute VTTRegionList regions;
undefined addRegion(VTTRegion region);
undefined removeRegion(VTTRegion region);
Expand Down
9 changes: 6 additions & 3 deletions Source/WebCore/html/track/TextTrackCue.idl
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

// https://html.spec.whatwg.org/#texttrackcue

[
Conditional=VIDEO,
CustomIsReachable,
Expand All @@ -33,17 +35,18 @@
LegacyFactoryFunctionEnabledBySetting=GenericCueAPIEnabled,
Exposed=Window
] interface TextTrackCue : EventTarget {
[CallWith=CurrentDocument] constructor(double startTime, double endTime, DocumentFragment cueNode);

readonly attribute TextTrack track;
readonly attribute TextTrack? track;

attribute [AtomString] DOMString id;
attribute double startTime;
// FIXME: Add 'unrestricted' to 'endTime' to align with the specification. See: https://bugs.webkit.org/show_bug.cgi?id=260765
attribute double endTime;
attribute boolean pauseOnExit;

attribute EventHandler onenter;
attribute EventHandler onexit;

// FIXME: Add 'unrestricted' to 'endTime' to align with the specification. See: https://bugs.webkit.org/show_bug.cgi?id=260765
[CallWith=CurrentDocument] constructor(double startTime, double endTime, DocumentFragment cueNode);
[EnabledBySetting=GenericCueAPIEnabled] DocumentFragment getCueAsHTML();
};
5 changes: 4 additions & 1 deletion Source/WebCore/html/track/TextTrackCueList.idl
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,15 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

// https://html.spec.whatwg.org/#texttrackcuelist

[
Conditional=VIDEO,
Exposed=Window
] interface TextTrackCueList {
readonly attribute unsigned long length;
// FIXME: Remove 'item' from below to align with the specification. See: https://bugs.webkit.org/show_bug.cgi?id=260763
getter TextTrackCue item(unsigned long index);
TextTrackCue getCueById(DOMString id);
TextTrackCue? getCueById(DOMString id);
};

5 changes: 4 additions & 1 deletion Source/WebCore/html/track/TextTrackList.idl
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

// https://html.spec.whatwg.org/#texttracklist

[
ActiveDOMObject,
Conditional=VIDEO,
Expand All @@ -31,8 +33,9 @@
Exposed=Window
] interface TextTrackList : EventTarget {
readonly attribute unsigned long length;
// FIXME: Remove 'item' from below to align with the specification. See: https://bugs.webkit.org/show_bug.cgi?id=260763
getter TextTrack item(unsigned long index);
TextTrack getTrackById([AtomString] DOMString id);
TextTrack? getTrackById([AtomString] DOMString id);

attribute EventHandler onaddtrack;
attribute EventHandler onchange;
Expand Down
4 changes: 3 additions & 1 deletion Source/WebCore/html/track/TrackEvent.idl
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,13 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

// https://html.spec.whatwg.org/multipage/media.html#the-trackevent-interface

[
Conditional=VIDEO,
Exposed=Window
] interface TrackEvent : Event {
constructor([AtomString] DOMString type, optional TrackEventInit eventInitDict);
constructor([AtomString] DOMString type, optional TrackEventInit eventInitDict = {});

readonly attribute (VideoTrack or AudioTrack or TextTrack)? track;
};
Expand Down
5 changes: 3 additions & 2 deletions Source/WebCore/html/track/VTTCue.idl
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

// https://www.w3.org/TR/webvtt1/#the-vttcue-interface

enum AutoKeyword { "auto" };
typedef (double or AutoKeyword) LineAndPositionSetting;

Expand All @@ -40,6 +42,7 @@ enum AlignSetting { "start", "center", "end", "left", "right" };
] interface VTTCue : TextTrackCue {
[CallWith=CurrentDocument] constructor(double startTime, double endTime, DOMString text);

attribute VTTRegion? region;
attribute DirectionSetting vertical;
attribute boolean snapToLines;
attribute LineAndPositionSetting line;
Expand All @@ -50,6 +53,4 @@ enum AlignSetting { "start", "center", "end", "left", "right" };
attribute AlignSetting align;
attribute DOMString text;
DocumentFragment getCueAsHTML();

attribute VTTRegion? region;
};
8 changes: 6 additions & 2 deletions Source/WebCore/html/track/VTTRegion.idl
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,25 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

// https://www.w3.org/TR/webvtt1/#the-vttregion-interface

// FIXME: Add 'enum' for 'ScrollSetting' to align with the specification. See: https://bugs.webkit.org/show_bug.cgi?id=260766

[
Conditional=VIDEO,
JSGenerateToNativeObject,
Exposed=Window
] interface VTTRegion {
[CallWith=CurrentScriptExecutionContext] constructor();

readonly attribute TextTrack track;

attribute DOMString id;
attribute double width;
attribute long lines;
attribute double regionAnchorX;
attribute double regionAnchorY;
attribute double viewportAnchorX;
attribute double viewportAnchorY;
// FIXME: Use 'enum' 'ScrollSetting' for 'scroll'. See: https://bugs.webkit.org/show_bug.cgi?id=260766
attribute [AtomString] DOMString scroll;
readonly attribute TextTrack track;
};
3 changes: 2 additions & 1 deletion Source/WebCore/html/track/VideoTrack.idl
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

// https://html.spec.whatwg.org/#videotrack

[
Conditional=VIDEO,
GenerateIsReachable,
Expand All @@ -32,7 +34,6 @@
[EnabledConditionallyReadWriteBySetting=MediaSourceEnabled] attribute [AtomString] DOMString kind;
readonly attribute DOMString label;
[EnabledConditionallyReadWriteBySetting=MediaSourceEnabled] attribute [AtomString] DOMString language;

attribute boolean selected;

[EnabledBySetting=TrackConfigurationEnabled] readonly attribute VideoTrackConfiguration configuration;
Expand Down
5 changes: 4 additions & 1 deletion Source/WebCore/html/track/VideoTrackList.idl
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

// https://html.spec.whatwg.org/#videotracklist

[
ActiveDOMObject,
Conditional=VIDEO,
Expand All @@ -31,8 +33,9 @@
Exposed=Window
] interface VideoTrackList : EventTarget {
readonly attribute unsigned long length;
// FIXME: Remove 'item' from below to align with the specification. See: https://bugs.webkit.org/show_bug.cgi?id=260763
getter VideoTrack item(unsigned long index);
VideoTrack getTrackById([AtomString] DOMString id);
VideoTrack? getTrackById([AtomString] DOMString id);
readonly attribute long selectedIndex;

attribute EventHandler onchange;
Expand Down

0 comments on commit 08c40bd

Please sign in to comment.