Bug 909993 - Add WebIDL for TextTrackCue and fix link in VTTCue.webidl. r=rillian,bz

This commit is contained in:
Brendan Long 2015-07-24 17:11:00 -07:00
parent e970b16593
commit fedeae77c9
5 changed files with 29 additions and 13 deletions

View File

@ -45,11 +45,13 @@ SpecialPowers.pushPrefEnv({"set": [["media.webvtt.regions.enabled", true]]},
is(cueList.length, 6, "Cue list length should be 6.");
// Check that the typedef of TextTrackCue works in Gecko.
is(window.TextTrackCue, undefined, "TextTrackCue should be undefined.");
isnot(window.TextTrackCue, undefined, "TextTrackCue should be defined.");
isnot(window.VTTCue, undefined, "VTTCue should be defined.");
// Check if first cue was parsed correctly.
var cue = cueList[0];
ok(cue instanceof TextTrackCue, "Cue should be an instanceof TextTrackCue.");
ok(cue instanceof VTTCue, "Cue should be an instanceof VTTCue.");
is(cue.id, "1", "Cue's ID should be 1.");
is(cue.startTime, 0.5, "Cue's start time should be 0.5.");
is(cue.endTime, 0.7, "Cue's end time should be 0.7.");

View File

@ -1275,6 +1275,8 @@ var interfaceNamesInGlobalScope =
"TextMetrics",
// IMPORTANT: Do not change this list without review from a DOM peer!
"TextTrack",
// IMPORTANT: Do not change this list without review from a DOM peer!
"TextTrackCue",
// IMPORTANT: Do not change this list without review from a DOM peer!
"TextTrackCueList",
// IMPORTANT: Do not change this list without review from a DOM peer!

View File

@ -0,0 +1,21 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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 http://mozilla.org/MPL/2.0/.
*
* The origin of this IDL file is
* https://html.spec.whatwg.org/#texttrackcue
*/
[Pref="media.webvtt.enabled"]
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;
};

View File

@ -4,7 +4,7 @@
* You can obtain one at http://mozilla.org/MPL/2.0/.
*
* The origin of this IDL file is
* http://www.whatwg.org/specs/web-apps/current-work/#texttrackcue
* http://dev.w3.org/html5/webvtt/#the-vttcue-interface
*/
enum AutoKeyword { "auto" };
@ -25,13 +25,7 @@ enum DirectionSetting {
[Constructor(double startTime, double endTime, DOMString text),
Pref="media.webvtt.enabled"]
interface VTTCue : EventTarget {
readonly attribute TextTrack? track;
attribute DOMString id;
attribute double startTime;
attribute double endTime;
attribute boolean pauseOnExit;
interface VTTCue : TextTrackCue {
[Pref="media.webvtt.regions.enabled"]
attribute VTTRegion? region;
attribute DirectionSetting vertical;
@ -48,10 +42,6 @@ interface VTTCue : EventTarget {
attribute AlignSetting align;
attribute DOMString text;
DocumentFragment getCueAsHTML();
attribute EventHandler onenter;
attribute EventHandler onexit;
};
// Mozilla extensions.

View File

@ -521,6 +521,7 @@ WEBIDL_FILES = [
'TextDecoder.webidl',
'TextEncoder.webidl',
'TextTrack.webidl',
'TextTrackCue.webidl',
'TextTrackCueList.webidl',
'TextTrackList.webidl',
'ThreadSafeChromeUtils.webidl',