Diff
Modified: trunk/LayoutTests/ChangeLog (119791 => 119792)
--- trunk/LayoutTests/ChangeLog 2012-06-08 03:15:27 UTC (rev 119791)
+++ trunk/LayoutTests/ChangeLog 2012-06-08 03:21:55 UTC (rev 119792)
@@ -1,3 +1,13 @@
+2012-06-07 Victor Carbune <[email protected]>
+
+ addTextTrack should set track mode to HIDDEN
+ https://bugs.webkit.org/show_bug.cgi?id=88317
+
+ Reviewed by Eric Carlson.
+
+ * media/track/track-texttracks-expected.txt: Updated.
+ * media/track/track-texttracks.html: Updated.
+
2012-06-07 Li Yin <[email protected]>
FileAPI: Blob should support ArrayBufferView instead of ArrayBuffer for Constructor Parameters
Modified: trunk/LayoutTests/media/track/track-texttracks-expected.txt (119791 => 119792)
--- trunk/LayoutTests/media/track/track-texttracks-expected.txt 2012-06-08 03:15:27 UTC (rev 119791)
+++ trunk/LayoutTests/media/track/track-texttracks-expected.txt 2012-06-08 03:21:55 UTC (rev 119792)
@@ -14,6 +14,11 @@
EXPECTED (video.textTracks[1].kind == 'chapters') OK
EXPECTED (video.textTracks[2].kind == 'descriptions') OK
+** Verify the default parameters of the text track object returned by addTextTrack(). **
+EXPECTED (video.textTracks[2].mode == TextTrack.HIDDEN == 'true') OK
+EXPECTED (video.textTracks[2].cues != null == 'true') OK
+EXPECTED (video.textTracks[2].cues.length == 0 == 'true') OK
+
** Add another <track> element, is should insert before the addTextTrack() track.
RUN(trackElement = document.createElement('track'))
RUN(trackElement.setAttribute('kind', 'metadata'))
Modified: trunk/LayoutTests/media/track/track-texttracks.html (119791 => 119792)
--- trunk/LayoutTests/media/track/track-texttracks.html 2012-06-08 03:15:27 UTC (rev 119791)
+++ trunk/LayoutTests/media/track/track-texttracks.html 2012-06-08 03:21:55 UTC (rev 119792)
@@ -27,6 +27,11 @@
testExpected("video.textTracks[1].kind", "chapters");
testExpected("video.textTracks[2].kind", "descriptions");
+ consoleWrite("<br>** Verify the default parameters of the text track object returned by addTextTrack(). **");
+ testExpected("video.textTracks[2].mode == TextTrack.HIDDEN", true);
+ testExpected("video.textTracks[2].cues != null", true);
+ testExpected("video.textTracks[2].cues.length == 0", true);
+
consoleWrite("<br>** Add another <track> element, is should insert before the addTextTrack() track.");
run("trackElement = document.createElement('track')");
run("trackElement.setAttribute('kind', 'metadata')");
Modified: trunk/Source/WebCore/ChangeLog (119791 => 119792)
--- trunk/Source/WebCore/ChangeLog 2012-06-08 03:15:27 UTC (rev 119791)
+++ trunk/Source/WebCore/ChangeLog 2012-06-08 03:21:55 UTC (rev 119792)
@@ -1,3 +1,18 @@
+2012-06-07 Victor Carbune <[email protected]>
+
+ addTextTrack should set track mode to HIDDEN
+ https://bugs.webkit.org/show_bug.cgi?id=88317
+
+ Reviewed by Eric Carlson.
+
+ Updated existing test.
+
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::addTextTrack): Set the default parameters
+ for the newly created TextTrack.
+ * html/track/TextTrack.cpp:
+ (WebCore::TextTrack::TextTrack):
+
2012-06-07 Li Yin <[email protected]>
FileAPI: Blob should support ArrayBufferView instead of ArrayBuffer for Constructor Parameters
Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (119791 => 119792)
--- trunk/Source/WebCore/html/HTMLMediaElement.cpp 2012-06-08 03:15:27 UTC (rev 119791)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp 2012-06-08 03:21:55 UTC (rev 119792)
@@ -2798,7 +2798,7 @@
// 4.8.10.12.4 Text track API
// The addTextTrack(kind, label, language) method of media elements, when invoked, must run the following steps:
-
+
// 1. If kind is not one of the following strings, then throw a SyntaxError exception and abort these steps
if (!TextTrack::isValidKindKeyword(kind)) {
ec = SYNTAX_ERR;
@@ -2808,15 +2808,23 @@
// 2. If the label argument was omitted, let label be the empty string.
// 3. If the language argument was omitted, let language be the empty string.
// 4. Create a new TextTrack object.
+
+ // 5. Create a new text track corresponding to the new object, and set its text track kind to kind, its text
+ // track label to label, its text track language to language...
RefPtr<TextTrack> textTrack = TextTrack::create(ActiveDOMObject::scriptExecutionContext(), this, kind, label, language);
- // 5. Create a new text track corresponding to the new object, and set its text track kind to kind, its text
- // track label to label, its text track language to language, its text track readiness state to the text track
- // loaded state, its text track mode to the text track hidden mode, and its text track list of cues to an empty list.
-
+ // Note, due to side effects when changing track parameters, we have to
+ // first append the track to the text track list.
+
// 6. Add the new text track to the media element's list of text tracks.
textTracks()->append(textTrack);
+ // ... its text track readiness state to the text track loaded state ...
+ textTrack->setReadinessState(TextTrack::Loaded);
+
+ // ... its text track mode to the text track hidden mode, and its text track list of cues to an empty list ...
+ textTrack->setMode(TextTrack::HIDDEN, ec);
+
return textTrack.release();
}
Modified: trunk/Source/WebCore/html/track/TextTrack.cpp (119791 => 119792)
--- trunk/Source/WebCore/html/track/TextTrack.cpp 2012-06-08 03:15:27 UTC (rev 119791)
+++ trunk/Source/WebCore/html/track/TextTrack.cpp 2012-06-08 03:21:55 UTC (rev 119792)
@@ -78,6 +78,7 @@
TextTrack::TextTrack(ScriptExecutionContext* context, TextTrackClient* client, const String& kind, const String& label, const String& language, TextTrackType type)
: TrackBase(context, TrackBase::TextTrack)
+ , m_cues(0)
, m_mediaElement(0)
, m_label(label)
, m_language(language)