Changeset 117811 in webkit
- Timestamp:
- May 21, 2012 1:34:21 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r117810 r117811 1 2012-05-21 Anna Cavender <annacc@chromium.org> 2 3 Only render text track cues if kind=captions or kind=subtitles. 4 https://bugs.webkit.org/show_bug.cgi?id=83321 5 6 Reviewed by Eric Carlson. 7 8 * media/track/track-kind-expected.txt: 9 * media/track/track-kind.html: 10 11 1 12 2012-05-21 Peter Kasting <pkasting@google.com> 2 13 -
trunk/LayoutTests/media/track/track-kind-expected.txt
r100453 r117811 1 Tests that the 'addtrack' event is fired when a TextTrack is created. 2 1 Tests that the 'kind' attribute is set properly and that cues are only visible when 'kind' is set to 'captions' or 'subtitles'. 3 2 4 3 ++ Test default attribute value … … 35 34 EXPECTED (trackElement.track.kind == 'subtitles') OK 36 35 EXPECTED (trackElement.getAttribute('kind') == 'subtitles') OK 36 EXPECTED (textTrackDisplayElement(video, 'display').innerText == 'Lorem ipsum dolor sit amet, ') OK 37 37 38 38 ++ 'captions' … … 49 49 EXPECTED (trackElement.track.kind == 'captions') OK 50 50 EXPECTED (trackElement.getAttribute('kind') == 'captions') OK 51 EXPECTED (textTrackDisplayElement(video, 'display').innerText == 'Lorem ipsum dolor sit amet, ') OK 51 52 52 53 ++ 'descriptions' … … 63 64 EXPECTED (trackElement.track.kind == 'descriptions') OK 64 65 EXPECTED (trackElement.getAttribute('kind') == 'descriptions') OK 66 No text track cue with display id '-webkit-media-text-track-display' is currently visible 65 67 66 68 ++ 'chapters' … … 77 79 EXPECTED (trackElement.track.kind == 'chapters') OK 78 80 EXPECTED (trackElement.getAttribute('kind') == 'chapters') OK 81 No text track cue with display id '-webkit-media-text-track-display' is currently visible 79 82 80 83 ++ 'metadata' … … 91 94 EXPECTED (trackElement.track.kind == 'metadata') OK 92 95 EXPECTED (trackElement.getAttribute('kind') == 'metadata') OK 96 No text track cue with display id '-webkit-media-text-track-display' is currently visible 93 97 94 98 END OF TEST -
trunk/LayoutTests/media/track/track-kind.html
r100453 r117811 5 5 <script src=../media-file.js></script> 6 6 <script src=../video-test.js></script> 7 <script src=../media-controls.js></script> 7 8 <script> 8 9 … … 10 11 function setKind(value) 11 12 { 13 consoleWrite("<b>++ '" + value + "'</b>"); 12 14 consoleWrite("<b> set via DOM</b>"); 13 15 run("trackElement.removeAttribute('kind')"); … … 22 24 testExpected("trackElement.track.kind", value); 23 25 testExpected("trackElement.getAttribute('kind')", value); 26 testExpected("textTrackDisplayElement(video, 'display').innerText", "Lorem ipsum dolor sit amet, "); 24 27 consoleWrite(""); 25 28 26 29 } 27 30 28 function start()31 function testKind() 29 32 { 30 findMediaElement();31 consoleWrite("");32 33 trackElement = document.getElementById('track_1');34 35 33 consoleWrite("<b>++ Test default attribute value</b>"); 36 34 testExpected("trackElement.getAttribute('kind')", null); … … 56 54 57 55 consoleWrite("<b>*** Set to known values</b>"); 58 consoleWrite("<b>++ 'subtitles'</b>");59 56 setKind("subtitles"); 60 57 61 consoleWrite("<b>++ 'captions'</b>");62 58 setKind("captions"); 63 59 64 consoleWrite("<b>++ 'descriptions'</b>");65 60 setKind("descriptions"); 66 61 67 consoleWrite("<b>++ 'chapters'</b>");68 62 setKind("chapters"); 69 63 70 consoleWrite("<b>++ 'metadata'</b>");71 64 setKind("metadata"); 72 65 73 66 endTest(); 74 67 } 68 69 function loaded() 70 { 71 findMediaElement(); 72 trackElement = document.getElementById('track_1'); 73 74 waitForEventsAndCall([[video, 'canplaythrough'], [trackElement, 'load']], testKind); 75 76 video.src = findMediaFile('video', '../content/counting'); 77 } 75 78 76 79 </script> 77 80 </head> 78 <body onload=" start()">79 <p>Tests that the ' addtrack' event is fired when a TextTrack is created.</p>81 <body onload="loaded()"> 82 <p>Tests that the 'kind' attribute is set properly and that cues are only visible when 'kind' is set to 'captions' or 'subtitles'.</p> 80 83 <video> 81 <track id=track_1 >84 <track id=track_1 src="captions-webvtt/metadata.vtt" default> 82 85 </video> 83 86 </body> -
trunk/Source/WebCore/ChangeLog
r117809 r117811 1 2012-05-21 Anna Cavender <annacc@chromium.org> 2 3 Only render text track cues if kind=captions or kind=subtitles. 4 https://bugs.webkit.org/show_bug.cgi?id=83321 5 6 Reviewed by Eric Carlson. 7 8 No new tests. Modification to media/track/track-kind.html 9 10 * html/HTMLMediaElement.cpp: 11 (WebCore::HTMLMediaElement::textTrackKindChanged): 12 If the kind changes from a 'visible' kind to a 'non-visible' kind, 13 update the track's mode to HIDDEN. 14 15 * html/shadow/MediaControlElements.cpp: 16 (WebCore::MediaControlTextTrackContainerElement::updateDisplay): 17 Do not render cues from tracks that are not captions or subtitles. 18 19 * html/track/TextTrack.cpp: 20 (WebCore::TextTrack::setMode): 21 If the track's mode changes from SHOWING to HIDDEN or DISABLED, 22 ensure any currently visible cues will no longer be rendered. 23 24 * html/track/TextTrackCue.cpp: 25 (WebCore::TextTrackCue::removeDisplayTree): New method. 26 * html/track/TextTrackCue.h: 27 (TextTrackCue): 28 1 29 2012-05-21 Andreas Kling <kling@webkit.org> 2 30 -
trunk/Source/WebCore/html/HTMLMediaElement.cpp
r117662 r117811 1286 1286 } 1287 1287 1288 void HTMLMediaElement::textTrackKindChanged(TextTrack*) 1289 { 1290 // FIXME(62885): Implement. 1288 void HTMLMediaElement::textTrackKindChanged(TextTrack* track) 1289 { 1290 if (track->kind() != TextTrack::captionsKeyword() && track->kind() != TextTrack::subtitlesKeyword() && track->mode() == TextTrack::SHOWING) 1291 track->setMode(TextTrack::HIDDEN, ASSERT_NO_EXCEPTION); 1291 1292 } 1292 1293 -
trunk/Source/WebCore/html/shadow/MediaControlElements.cpp
r116900 r117811 1285 1285 1286 1286 ASSERT(cue->isActive()); 1287 if (cue->track()->kind() != TextTrack::captionsKeyword() && cue->track()->kind() != TextTrack::subtitlesKeyword()) 1288 continue; 1289 1287 1290 if (!cue->track() || cue->track()->mode() != TextTrack::SHOWING) 1288 1291 continue; -
trunk/Source/WebCore/html/track/TextTrack.cpp
r114026 r117811 143 143 // because they will no longer be accessible from the cues() function. 144 144 if (mode == TextTrack::DISABLED && m_client && m_cues) 145 m_client->textTrackRemoveCues(this, m_cues.get()); 145 m_client->textTrackRemoveCues(this, m_cues.get()); 146 147 if (mode != TextTrack::SHOWING && m_cues) 148 for (size_t i = 0; i < m_cues->length(); ++i) 149 m_cues->item(i)->removeDisplayTree(); 146 150 147 151 // ... Note: If the mode had been showing by default, this will change it to showing, -
trunk/Source/WebCore/html/track/TextTrackCue.cpp
r114760 r117811 609 609 } 610 610 611 void TextTrackCue::removeDisplayTree() 612 { 613 if (m_displayTree->parentNode()) 614 m_displayTree->remove(ASSERT_NO_EXCEPTION); 615 } 616 611 617 std::pair<double, double> TextTrackCue::getPositionCoordinates() 612 618 { -
trunk/Source/WebCore/html/track/TextTrackCue.h
r114640 r117811 103 103 104 104 PassRefPtr<HTMLDivElement> getDisplayTree(); 105 void removeDisplayTree(); 105 106 106 107 virtual const AtomicString& interfaceName() const;
Note: See TracChangeset
for help on using the changeset viewer.