Changeset 159711 in webkit
- Timestamp:
- Nov 22, 2013, 1:44:22 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/media/track/track-id-expected.txt (modified) (1 diff)
-
LayoutTests/media/track/track-id.html (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/html/track/TextTrackList.cpp (modified) (1 diff)
-
Source/WebCore/html/track/TextTrackList.h (modified) (1 diff)
-
Source/WebCore/html/track/TextTrackList.idl (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r159705 r159711 1 2013-11-22 Brendan Long <b.long@cablelabs.com> 2 3 Add TextTrackList::getTrackById(). 4 https://bugs.webkit.org/show_bug.cgi?id=124785 5 6 Reviewed by Eric Carlson. 7 8 Update this test to make it more interesting. It now checks that the "id" 9 changes when the <track> id changes, makes sure TextTrack::id is readonly, 10 and looks the track up by id with getTrackById(). 11 12 * media/track/track-id-expected.txt: 13 * media/track/track-id.html: 14 1 15 2013-11-22 Filip Pizlo <fpizlo@apple.com> 2 16 -
trunk/LayoutTests/media/track/track-id-expected.txt
r158760 r159711 1 Tests that the 'id' attribute on a TextTrack matches the track element.1 Tests that the TextTrack "id" attribute is appropriately set. 2 2 3 3 4 EXPECTED (video.textTracks[0].id == 'Test-ID-123') OK5 4 5 ++ Test default attribute value 6 EXPECTED (textTrack.id == 'LoremIpsum') OK 7 EXPECTED (video.textTracks[0].id == 'LoremIpsum') OK 8 9 ++ Make sure we can look tracks up by id 10 EXPECTED (video.textTracks.getTrackById('LoremIpsum') == '[object TextTrack]') OK 11 12 ++ Test that it's readonly 13 RUN(textTrack.id = 'newvalue';) 14 EXPECTED (textTrack.id == 'LoremIpsum') OK 6 15 END OF TEST 7 16 -
trunk/LayoutTests/media/track/track-id.html
r158760 r159711 2 2 <html> 3 3 <head> 4 4 5 <script src=../media-file.js></script> 5 6 <script src=../video-test.js></script> 6 7 <script> 7 8 8 function loaded() 9 var textTrack; 10 11 function start() 9 12 { 10 13 findMediaElement(); 11 var trackElement = video.firstElementChild;14 consoleWrite(""); 12 15 13 te stExpected("video.textTracks[0].id", trackElement.id);16 textTrack = document.getElementById("LoremIpsum").track; 14 17 18 consoleWrite("<b>++ Test default attribute value</b>"); 19 testExpected("textTrack.id", "LoremIpsum"); 20 testExpected("video.textTracks[0].id", "LoremIpsum"); 15 21 consoleWrite(""); 22 23 consoleWrite("<b>++ Make sure we can look tracks up by id</b>"); 24 testExpected("video.textTracks.getTrackById('LoremIpsum')", textTrack); 25 consoleWrite(""); 26 27 consoleWrite("<b>++ Test that it's readonly</b>"); 28 run("textTrack.id = 'newvalue';"); 29 testExpected("textTrack.id", "LoremIpsum"); 30 16 31 endTest(); 17 32 } 18 33 19 setCaptionDisplayMode('Automatic');20 21 34 </script> 22 35 </head> 23 <body onload=" loaded()">24 <p>Tests that the 'id' attribute on a TextTrack matches the track element.</p>36 <body onload="start()"> 37 <p>Tests that the TextTrack "id" attribute is appropriately set.</p> 25 38 <video> 26 <track id=" Test-ID-123" src="captions-webvtt/captions-fast.vtt">39 <track id="LoremIpsum" src="captions-webvtt/captions-fast.vtt"> 27 40 </video> 28 41 </body> -
trunk/Source/WebCore/ChangeLog
r159702 r159711 1 2013-11-22 Brendan Long <b.long@cablelabs.com> 2 3 Add TextTrackList::getTrackById(). 4 https://bugs.webkit.org/show_bug.cgi?id=124785 5 6 Reviewed by Eric Carlson. 7 8 Test: media/track/track-id.html 9 10 * html/track/TextTrackList.cpp: Add getTrackById() 11 (TextTrackList::getTrackById): 12 * html/track/TextTrackList.h: Same. 13 * html/track/TextTrackList.idl: Same. 14 1 15 2013-11-22 Hans Muller <hmuller@adobe.com> 2 16 -
trunk/Source/WebCore/html/track/TextTrackList.cpp
r158821 r159711 128 128 } 129 129 130 TextTrack* TextTrackList::getTrackById(const AtomicString& id) 131 { 132 // 4.8.10.12.5 Text track API 133 // The getTrackById(id) method must return the first TextTrack in the 134 // TextTrackList object whose id IDL attribute would return a value equal 135 // to the value of the id argument. 136 for (unsigned i = 0; i < length(); ++i) { 137 TextTrack* track = item(i); 138 if (track->id() == id) 139 return track; 140 } 141 142 // When no tracks match the given argument, the method must return null. 143 return nullptr; 144 } 145 130 146 void TextTrackList::invalidateTrackIndexesAfterTrack(TextTrack* track) 131 147 { -
trunk/Source/WebCore/html/track/TextTrackList.h
r158821 r159711 49 49 50 50 TextTrack* item(unsigned index) const; 51 TextTrack* getTrackById(const AtomicString&); 51 52 TextTrack* lastItem() const { return item(length() - 1); } 52 53 -
trunk/Source/WebCore/html/track/TextTrackList.idl
r159061 r159711 32 32 readonly attribute unsigned long length; 33 33 getter TextTrack item(unsigned long index); 34 TextTrack getTrackById(DOMString id); 34 35 35 36 attribute EventListener onaddtrack;
Note:
See TracChangeset
for help on using the changeset viewer.