haikuwebkit/LayoutTests/media/media-captions.html

97 lines
3.0 KiB
HTML
Raw Permalink Normal View History

2009-11-19 Eric Carlson <eric.carlson@apple.com> Reviewed by Dan Bernstein. <rdar://problem/7035231> Support closed caption in <video> element Test: media/media-captions.html * WebCore.base.exp: * accessibility/AccessibilityMediaControls.cpp: (WebCore::AccessibilityMediaControl::controlTypeName): Define ShowClosedCaptionsButton and HideClosedCaptionsButton. * css/CSSPrimitiveValueMappings.h: (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): Add MediaToggleClosedCaptionsButtonPart. * css/CSSSelector.cpp: (WebCore::CSSSelector::extractPseudoType): Define and match mediaControlsToggleClosedCaptionsButton. * css/CSSSelector.h: (WebCore::CSSSelector::): * css/CSSStyleSelector.cpp: (WebCore::CSSStyleSelector::SelectorChecker::checkOneSelector): Define and match PseudoMediaControlsToggleClosedCaptions. * css/CSSValueKeywords.in: Define and use media-toggle-closed-captions-button. * css/mediaControls.css: * css/mediaControlsQuickTime.css: Add webkit-media-controls-toggle-closed-captions-button. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::HTMLMediaElement): Initialize m_closedCaptionsVisible. (WebCore::HTMLMediaElement::loadInternal): Set m_closedCaptionsVisible to false. (WebCore::HTMLMediaElement::hasClosedCaptions): (WebCore::HTMLMediaElement::closedCaptionsVisible): (WebCore::HTMLMediaElement::setClosedCaptionsVisible): New, captions internal methods. (WebCore::HTMLMediaElement::setWebkitClosedCaptionsVisible): (WebCore::HTMLMediaElement::webkitClosedCaptionsVisible): (WebCore::HTMLMediaElement::webkitHasClosedCaptions): New, captions DOM API. * html/HTMLMediaElement.h: * html/HTMLMediaElement.idl: Declare methods needed for captions API. * platform/ThemeTypes.h: Add MediaToggleClosedCaptionsButtonPart. * platform/android/LocalizedStringsAndroid.cpp: (WebCore::localizedMediaControlElementString): (WebCore::localizedMediaControlElementHelpText): (WebCore::localizedMediaTimeDescription): Add empty implmentations. * platform/graphics/MediaPlayer.cpp: (WebCore::NullMediaPlayerPrivate::hasClosedCaptions): (WebCore::NullMediaPlayerPrivate::setClosedCaptionsVisible): New, empty implementations of media engine closed caption functions. (WebCore::MediaPlayer::hasClosedCaptions): (WebCore::MediaPlayer::setClosedCaptionsVisible): New, call media engine closed caption functions. * platform/graphics/MediaPlayer.h: * platform/graphics/MediaPlayerPrivate.h: (WebCore::MediaPlayerPrivateInterface::hasClosedCaptions): (WebCore::MediaPlayerPrivateInterface::setClosedCaptionsVisible): Declare new media engine methods. * platform/graphics/mac/MediaPlayerPrivateQTKit.h: * platform/graphics/mac/MediaPlayerPrivateQTKit.mm: (WebCore::MediaPlayerPrivate::hasClosedCaptions): (WebCore::MediaPlayerPrivate::setClosedCaptionsVisible): New, QTKit implementation of closed caption methods. * platform/gtk/LocalizedStringsGtk.cpp: (WebCore::localizedMediaControlElementString): (WebCore::localizedMediaControlElementHelpText): Add help text for ShowClosedCaptionsButton and HideClosedCaptionsButton. * platform/mac/WebCoreSystemInterface.h: * platform/mac/WebCoreSystemInterface.mm: Declare and initialize wkQTMovieHasClosedCaptions and wkQTMovieSetShowClosedCaptions. * rendering/MediaControlElements.cpp: (WebCore::MediaControlInputElement::MediaControlInputElement): Deal with MEDIA_CONTROLS_TOGGLE_CLOSED_CAPTIONS_BUTTON. (WebCore::MediaControlToggleClosedCaptionsButtonElement::MediaControlToggleClosedCaptionsButtonElement): (WebCore::MediaControlToggleClosedCaptionsButtonElement::defaultEventHandler): (WebCore::MediaControlToggleClosedCaptionsButtonElement::updateDisplayType): New, implement the closed caption toggle button, * rendering/MediaControlElements.h: Define MediaShowClosedCaptionsButton and MediaHideClosedCaptionsButton, declare MediaControlToggleClosedCaptionsButtonElement. * rendering/RenderMedia.cpp: (WebCore::RenderMedia::styleDidChange): (WebCore::RenderMedia::createToggleClosedCaptionsButton): (WebCore::RenderMedia::createStatusDisplay): (WebCore::RenderMedia::updateControls): (WebCore::RenderMedia::forwardEvent): * rendering/RenderMedia.h: Deal with m_toggleClosedCaptionsButton. * rendering/RenderTheme.cpp: (WebCore::RenderTheme::paint): Deal with MediaToggleClosedCaptionsButtonPart. * rendering/RenderTheme.h: * rendering/RenderThemeMac.h: Declare paintMediaToggleClosedCaptionsButton. * rendering/RenderThemeMac.mm: (WebCore::RenderThemeMac::paintMediaToggleClosedCaptionsButton): New. (WebCore::RenderThemeMac::shouldRenderMediaControlPart): Don't render captions toggle button unless we are using the new theme, the movie has captions, and the movie is in a <video> element since we currently rely on QTKit to render the captions. * rendering/style/RenderStyleConstants.h: Define MEDIA_CONTROLS_TOGGLE_CLOSED_CAPTIONS_BUTTON. 2009-11-19 Eric Carlson <eric.carlson@apple.com> Reviewed by Dan Bernstein. <rdar://problem/7035231> Support closed caption in <video> element * media/media-captions-expected.txt: Added. * media/media-captions.html: Added. * media/content/counting-captioned.mov: Added. * platform/gtk/Skipped: * platform/mac-leopard/Skipped: * platform/mac-tiger/Skipped: * platform/win/Skipped: Skipped on platforms that don't support closed captions yet. 2009-11-19 Eric Carlson <eric.carlson@apple.com> Reviewed by Dan Bernstein. <rdar://problem/7035231> Support closed caption in <video> element * English.lproj/Localizable.strings: Add strings for toggle captions button. 2009-11-19 Eric Carlson <eric.carlson@apple.com> Reviewed by Dan Bernstein. <rdar://problem/7035231> Support closed caption in <video> element * WebCoreSupport/WebSystemInterface.m: (InitWebCoreSystemInterface): Add QTMovieHasClosedCaptions and QTMovieSetShowClosedCaptions. * WebCoreSupport/WebViewFactory.mm: (-[WebViewFactory localizedMediaControlElementString:]): (-[WebViewFactory localizedMediaControlElementHelpText:]): Add accessibility help strings for media controller closed caption button. 2009-11-19 Eric Carlson <eric.carlson@apple.com> Reviewed by Dan Bernstein. <rdar://problem/7035231> Support closed caption in <video> element * WebCoreLocalizedStrings.cpp: (WebCore::localizedMediaControlElementString): (WebCore::localizedMediaControlElementHelpText): Add accessibility help strings for media controller closed caption button. 2009-11-19 Eric Carlson <eric.carlson@apple.com> Reviewed by Dan Bernstein. <rdar://problem/7035231> Support closed caption in <video> element * WebKitSystemInterface.h: Add prototypes for WKQTMovieHasClosedCaptions and WKQTMovieSetShowClosedCaptions, define WKMediaUIPartToggleClosedCaptionsButton. Canonical link: https://commits.webkit.org/42620@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@51191 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2009-11-19 18:14:01 +00:00
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>closed caption API test</title>
2011-02-24 Victoria Kirst <vrk@google.com> Reviewed by Mihai Parparita. [chromium] Move media-file.js and video-test.js back to media/ for UILayoutTests https://bugs.webkit.org/show_bug.cgi?id=55089 Media's UILayoutTests rely on video-test.js and media-file.js to be in the media/ folder. * http/tests/media/pdf-served-as-pdf.html: * http/tests/media/reload-after-dialog.html: * http/tests/media/remove-while-loading.html: * http/tests/media/text-served-as-text.html: * http/tests/media/video-buffered.html: * http/tests/media/video-cancel-load.html: * http/tests/media/video-cookie.html: * http/tests/media/video-error-abort.html: * http/tests/media/video-load-twice.html: * http/tests/media/video-play-stall-seek.html: * http/tests/media/video-play-stall.html: * http/tests/media/video-play-suspend.html: * http/tests/media/video-referer.html: * http/tests/media/video-seekable-stall.html: * http/tests/media/video-served-as-text.html: * media/adopt-node-crash.html: * media/audio-constructor-preload.html: * media/audio-constructor-src.html: * media/audio-constructor.html: * media/audio-controls-rendering.html: * media/audio-data-url.html: * media/audio-delete-while-slider-thumb-clicked.html: * media/audio-delete-while-step-button-clicked.html: * media/audio-mpeg-supported.html: * media/audio-mpeg4-supported.html: * media/audio-play-event.html: * media/before-load-member-access.html: * media/broken-video.html: * media/constructors.html: * media/context-menu-actions.html: * media/controls-after-reload.html: * media/controls-css-overload.html: * media/controls-drag-timebar.html: * media/controls-right-click-on-timebar.html: * media/controls-strict.html: * media/controls-styling.html: * media/controls-without-preload.html: * media/event-attributes.html: * media/invalid-media-url-crash.html: * media/media-can-play-mpeg-audio.html: * media/media-can-play-mpeg4-video.html: * media/media-can-play-octet-stream.html: * media/media-can-play-ogg.html: * media/media-can-play-wav-audio.html: * media/media-captions.html: * media/media-constants.html: * media/media-file.js: Renamed from LayoutTests/http/tests/media/media-file.js. * media/media-fullscreen-inline.html: * media/media-fullscreen-not-in-document.html: * media/media-load-event.html: * media/media-startTime.html: * media/remove-from-document-no-load.html: * media/remove-from-document.html: * media/restore-from-page-cache.html: * media/unsupported-rtsp.html: * media/unsupported-tracks.html: * media/video-append-source.html: * media/video-aspect-ratio.html: * media/video-autoplay.html: * media/video-buffered.html: * media/video-can-play-type.html: * media/video-canvas-alpha.html: * media/video-canvas-source.html: * media/video-click-dblckick-standalone.html: * media/video-controls-rendering.html: * media/video-controls-transformed.html: * media/video-controls-visible-audio-only.html: * media/video-controls-zoomed.html: * media/video-controls.html: * media/video-currentTime-delay.html: * media/video-currentTime-set.html: * media/video-currentTime-set2.html: * media/video-currentTime.html: * media/video-delay-load-event.html: * media/video-display-aspect-ratio.html: * media/video-display-none-crash.html: * media/video-display-toggle.html: * media/video-does-not-loop.html: * media/video-dom-autoplay.html: * media/video-dom-preload.html: * media/video-dom-src.html: * media/video-duration-known-after-eos.html: * media/video-error-does-not-exist.html: * media/video-frame-accurate-seek.html: * media/video-layer-crash.html: * media/video-load-networkState.html: * media/video-load-readyState.html: * media/video-loop.html: * media/video-muted.html: * media/video-no-audio.html: * media/video-no-autoplay.html: * media/video-pause-empty-events.html: * media/video-pause-immediately.html: * media/video-play-empty-events.html: * media/video-play-pause-events.html: * media/video-play-pause-exception.html: * media/video-played-collapse.html: * media/video-played-ranges-1.html: * media/video-played-reset.html: * media/video-poster-delayed.html: * media/video-poster-scale.html: * media/video-poster.html: * media/video-preload.html: * media/video-replaces-poster.html: * media/video-reverse-play-duration.html: * media/video-seek-by-small-increment.html: * media/video-seek-no-src-exception.html: * media/video-seek-past-end-paused.html: * media/video-seek-past-end-playing.html: * media/video-seekable.html: * media/video-seeking.html: * media/video-size-intrinsic-scale.html: * media/video-size.html: * media/video-source-error-no-candidate.html: * media/video-source-error.html: * media/video-source-inserted.html: * media/video-source-media.html: * media/video-source-moved.html: * media/video-source-none-supported.html: * media/video-source-removed.html: * media/video-source-type-params.html: * media/video-source-type.html: * media/video-source.html: * media/video-src-change.html: * media/video-src-invalid-remove.html: * media/video-src-none.html: * media/video-src-plus-source.html: * media/video-src-remove.html: * media/video-src-set.html: * media/video-src-source.html: * media/video-src.html: * media/video-test.js: Renamed from LayoutTests/http/tests/media/video-test.js. * media/video-timeupdate-during-playback.html: * media/video-timeupdate-reverse-play.html: * media/video-transformed.html: * media/video-volume-slider.html: * media/video-volume.html: * media/video-width-height.html: * media/video-zoom-controls.html: * media/video-zoom.html: 2011-02-24 Victoria Kirst <vrk@google.com> Reviewed by Mihai Parparita. [chromium] Move media-file.js and video-test.js back to media/ for UILayoutTests https://bugs.webkit.org/show_bug.cgi?id=55089 This adds an alias into the media/ directory so that http/tests/media tests can access the media resources when running in an httpd process. * Scripts/webkitperl/httpd.pm: * Scripts/webkitpy/layout_tests/port/apache_http_server.py: * Scripts/webkitpy/layout_tests/port/http_server.py: Canonical link: https://commits.webkit.org/69549@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@79630 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2011-02-24 23:10:46 +00:00
<script src=video-test.js></script>
2009-11-19 Eric Carlson <eric.carlson@apple.com> Reviewed by Dan Bernstein. <rdar://problem/7035231> Support closed caption in <video> element Test: media/media-captions.html * WebCore.base.exp: * accessibility/AccessibilityMediaControls.cpp: (WebCore::AccessibilityMediaControl::controlTypeName): Define ShowClosedCaptionsButton and HideClosedCaptionsButton. * css/CSSPrimitiveValueMappings.h: (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): Add MediaToggleClosedCaptionsButtonPart. * css/CSSSelector.cpp: (WebCore::CSSSelector::extractPseudoType): Define and match mediaControlsToggleClosedCaptionsButton. * css/CSSSelector.h: (WebCore::CSSSelector::): * css/CSSStyleSelector.cpp: (WebCore::CSSStyleSelector::SelectorChecker::checkOneSelector): Define and match PseudoMediaControlsToggleClosedCaptions. * css/CSSValueKeywords.in: Define and use media-toggle-closed-captions-button. * css/mediaControls.css: * css/mediaControlsQuickTime.css: Add webkit-media-controls-toggle-closed-captions-button. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::HTMLMediaElement): Initialize m_closedCaptionsVisible. (WebCore::HTMLMediaElement::loadInternal): Set m_closedCaptionsVisible to false. (WebCore::HTMLMediaElement::hasClosedCaptions): (WebCore::HTMLMediaElement::closedCaptionsVisible): (WebCore::HTMLMediaElement::setClosedCaptionsVisible): New, captions internal methods. (WebCore::HTMLMediaElement::setWebkitClosedCaptionsVisible): (WebCore::HTMLMediaElement::webkitClosedCaptionsVisible): (WebCore::HTMLMediaElement::webkitHasClosedCaptions): New, captions DOM API. * html/HTMLMediaElement.h: * html/HTMLMediaElement.idl: Declare methods needed for captions API. * platform/ThemeTypes.h: Add MediaToggleClosedCaptionsButtonPart. * platform/android/LocalizedStringsAndroid.cpp: (WebCore::localizedMediaControlElementString): (WebCore::localizedMediaControlElementHelpText): (WebCore::localizedMediaTimeDescription): Add empty implmentations. * platform/graphics/MediaPlayer.cpp: (WebCore::NullMediaPlayerPrivate::hasClosedCaptions): (WebCore::NullMediaPlayerPrivate::setClosedCaptionsVisible): New, empty implementations of media engine closed caption functions. (WebCore::MediaPlayer::hasClosedCaptions): (WebCore::MediaPlayer::setClosedCaptionsVisible): New, call media engine closed caption functions. * platform/graphics/MediaPlayer.h: * platform/graphics/MediaPlayerPrivate.h: (WebCore::MediaPlayerPrivateInterface::hasClosedCaptions): (WebCore::MediaPlayerPrivateInterface::setClosedCaptionsVisible): Declare new media engine methods. * platform/graphics/mac/MediaPlayerPrivateQTKit.h: * platform/graphics/mac/MediaPlayerPrivateQTKit.mm: (WebCore::MediaPlayerPrivate::hasClosedCaptions): (WebCore::MediaPlayerPrivate::setClosedCaptionsVisible): New, QTKit implementation of closed caption methods. * platform/gtk/LocalizedStringsGtk.cpp: (WebCore::localizedMediaControlElementString): (WebCore::localizedMediaControlElementHelpText): Add help text for ShowClosedCaptionsButton and HideClosedCaptionsButton. * platform/mac/WebCoreSystemInterface.h: * platform/mac/WebCoreSystemInterface.mm: Declare and initialize wkQTMovieHasClosedCaptions and wkQTMovieSetShowClosedCaptions. * rendering/MediaControlElements.cpp: (WebCore::MediaControlInputElement::MediaControlInputElement): Deal with MEDIA_CONTROLS_TOGGLE_CLOSED_CAPTIONS_BUTTON. (WebCore::MediaControlToggleClosedCaptionsButtonElement::MediaControlToggleClosedCaptionsButtonElement): (WebCore::MediaControlToggleClosedCaptionsButtonElement::defaultEventHandler): (WebCore::MediaControlToggleClosedCaptionsButtonElement::updateDisplayType): New, implement the closed caption toggle button, * rendering/MediaControlElements.h: Define MediaShowClosedCaptionsButton and MediaHideClosedCaptionsButton, declare MediaControlToggleClosedCaptionsButtonElement. * rendering/RenderMedia.cpp: (WebCore::RenderMedia::styleDidChange): (WebCore::RenderMedia::createToggleClosedCaptionsButton): (WebCore::RenderMedia::createStatusDisplay): (WebCore::RenderMedia::updateControls): (WebCore::RenderMedia::forwardEvent): * rendering/RenderMedia.h: Deal with m_toggleClosedCaptionsButton. * rendering/RenderTheme.cpp: (WebCore::RenderTheme::paint): Deal with MediaToggleClosedCaptionsButtonPart. * rendering/RenderTheme.h: * rendering/RenderThemeMac.h: Declare paintMediaToggleClosedCaptionsButton. * rendering/RenderThemeMac.mm: (WebCore::RenderThemeMac::paintMediaToggleClosedCaptionsButton): New. (WebCore::RenderThemeMac::shouldRenderMediaControlPart): Don't render captions toggle button unless we are using the new theme, the movie has captions, and the movie is in a <video> element since we currently rely on QTKit to render the captions. * rendering/style/RenderStyleConstants.h: Define MEDIA_CONTROLS_TOGGLE_CLOSED_CAPTIONS_BUTTON. 2009-11-19 Eric Carlson <eric.carlson@apple.com> Reviewed by Dan Bernstein. <rdar://problem/7035231> Support closed caption in <video> element * media/media-captions-expected.txt: Added. * media/media-captions.html: Added. * media/content/counting-captioned.mov: Added. * platform/gtk/Skipped: * platform/mac-leopard/Skipped: * platform/mac-tiger/Skipped: * platform/win/Skipped: Skipped on platforms that don't support closed captions yet. 2009-11-19 Eric Carlson <eric.carlson@apple.com> Reviewed by Dan Bernstein. <rdar://problem/7035231> Support closed caption in <video> element * English.lproj/Localizable.strings: Add strings for toggle captions button. 2009-11-19 Eric Carlson <eric.carlson@apple.com> Reviewed by Dan Bernstein. <rdar://problem/7035231> Support closed caption in <video> element * WebCoreSupport/WebSystemInterface.m: (InitWebCoreSystemInterface): Add QTMovieHasClosedCaptions and QTMovieSetShowClosedCaptions. * WebCoreSupport/WebViewFactory.mm: (-[WebViewFactory localizedMediaControlElementString:]): (-[WebViewFactory localizedMediaControlElementHelpText:]): Add accessibility help strings for media controller closed caption button. 2009-11-19 Eric Carlson <eric.carlson@apple.com> Reviewed by Dan Bernstein. <rdar://problem/7035231> Support closed caption in <video> element * WebCoreLocalizedStrings.cpp: (WebCore::localizedMediaControlElementString): (WebCore::localizedMediaControlElementHelpText): Add accessibility help strings for media controller closed caption button. 2009-11-19 Eric Carlson <eric.carlson@apple.com> Reviewed by Dan Bernstein. <rdar://problem/7035231> Support closed caption in <video> element * WebKitSystemInterface.h: Add prototypes for WKQTMovieHasClosedCaptions and WKQTMovieSetShowClosedCaptions, define WKMediaUIPartToggleClosedCaptionsButton. Canonical link: https://commits.webkit.org/42620@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@51191 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2009-11-19 18:14:01 +00:00
<script>
var movieInfo =
{
current : -1,
movies :
[
{
url : "content/test.wav",
description : "Audio-only file without captions",
hasCaptions : false,
},
{
url : "content/counting-captioned.mov",
description : "QuickTime movie with captions.",
hasCaptions : true,
},
]
};
function canplaythrough()
{
var movie = movieInfo.movies[movieInfo.current];
testExpected("mediaElement.webkitHasClosedCaptions", movie.hasCaptions);
testExpected("mediaElement.webkitClosedCaptionsVisible", false);
// Try to enable captions, they should only be enabled after if the movie has captions.
consoleWrite("*** enabling captions");
mediaElement.webkitClosedCaptionsVisible = true;
testExpected("mediaElement.webkitClosedCaptionsVisible", movie.hasCaptions);
openNextMovie();
}
function openNextMovie()
{
consoleWrite("");
movieInfo.current++;
if (movieInfo.current >= movieInfo.movies.length)
{
endTest();
return;
}
var url = movieInfo.movies[movieInfo.current].url;
video.src = url;
var desc = "<b>Loading</b> <em>\""+ url + "\"</em>" +
". " + movieInfo.movies[movieInfo.current].description + ".</em>";
consoleWrite(desc);
if (movieInfo.current > 0)
video.load();
}
function start()
{
findMediaElement();
waitForEvent("error");
waitForEvent("loadstart");
waitForEvent("waiting");
waitForEvent("ratechange");
waitForEvent("durationchange");
waitForEvent("pause");
waitForEvent("play");
waitForEvent("playing");
[Mac] add "automatic" text track menu item https://bugs.webkit.org/show_bug.cgi?id=113822 Reviewed by Jer Noble. Source/WebCore: No new tests, existing tests updated. * English.lproj/Localizable.strings: Add new track menu item. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::HTMLMediaElement): Initialize m_captionDisplayMode. (WebCore::HTMLMediaElement::finishParsingChildren): LoadTextTrackResource -> ConfigureTextTracks. (WebCore::HTMLMediaElement::scheduleDelayedAction): Ditto. (WebCore::HTMLMediaElement::loadTimerFired): Ditto. (WebCore::HTMLMediaElement::loadInternal): Ditto. Flag the caption menu as invalid so it will be rebuilt again. (WebCore::HTMLMediaElement::mediaPlayerDidAddTrack): LoadTextTrackResource -> ConfigureTextTracks. (WebCore::HTMLMediaElement::didAddTrack): Ditto. (WebCore::HTMLMediaElement::configureTextTrackGroup): Deal with new track display modes. (WebCore::HTMLMediaElement::HTMLMediaElement::hasClosedCaptions): Minor cleanup. (WebCore::HTMLMediaElement::configureTextTrackGroup): Add some logging. (WebCore::HTMLMediaElement::configureTextTracks): Call updateActiveTextTrackCues so cue display is updated. (WebCore::HTMLMediaElement::captionPreferencesChanged): Deal with new track display modes. (WebCore::HTMLMediaElement::markCaptionAndSubtitleTracksAsUnconfigured): Add some logging. * html/HTMLMediaElement.h: Ditto. * html/shadow/MediaControlElementTypes.cpp: Remove trackIndexAttributeName and trackListIndexForElement. * html/shadow/MediaControlElementTypes.h: Ditto. * html/shadow/MediaControlElements.cpp: (WebCore::MediaControlClosedCaptionsTrackListElement::defaultEventHandler): Don't use track index, everything we need is in the track<->element map now. (WebCore::MediaControlClosedCaptionsTrackListElement::updateDisplay): Ditto. Always rebuild the track list because clear the map each time the menu goes away because it refs every track. (WebCore::MediaControlClosedCaptionsTrackListElement::rebuildTrackListMenu): Don't set the track index attribute on the menu items, just use the map. * html/shadow/MediaControlElements.h: * html/shadow/MediaControlsApple.cpp: (WebCore::MediaControlsApple::changedClosedCaptionsVisibility): resetTrackListMenu is gone. (WebCore::MediaControlsApple::reset): Ditto. (WebCore::MediaControlsApple::closedCaptionTracksChanged): Ditto. * html/track/TextTrack.cpp: (WebCore::TextTrack::captionMenuOffItem): New, static TextTrack used for the menu "Off" item. (WebCore::TextTrack::captionMenuAutomaticItem): New, static TextTrack used for the menu "Automatic" item. * html/track/TextTrack.h: * page/CaptionUserPreferences.cpp: (WebCore::CaptionUserPreferences::shouldShowCaptions): Removed, we use captionDisplayMode instead. (WebCore::CaptionUserPreferences::captionDisplayMode): New. (WebCore::CaptionUserPreferences::setCaptionDisplayMode): New. (WebCore::CaptionUserPreferences::setPreferredLanguage): Make the parameter a const reference. (WebCore::CaptionUserPreferences::textTrackSelectionScore): Return 0 if the user doesn't want captions or subtitles. (WebCore::CaptionUserPreferences::textTrackLanguageSelectionScore): Take language as a parameter instead of assuming that it is always the entire language list. * page/CaptionUserPreferences.h: * page/CaptionUserPreferencesMac.h: * page/CaptionUserPreferencesMac.mm: (WebCore::CaptionUserPreferencesMac::shouldShowCaptions): Removed, we use captionDisplayMode instead. (WebCore::CaptionUserPreferencesMac::captionDisplayMode): New. (WebCore::CaptionUserPreferencesMac::setCaptionDisplayMode): New. (WebCore::CaptionUserPreferencesMac::setPreferredLanguage): Make the parameter a const reference. (WebCore::CaptionUserPreferencesMac::textTrackSelectionScore): Deal with "Automatic" mode. captions or subtitles. (WebCore::CaptionUserPreferences::textTrackLanguageSelectionScore): Take language as a parameter instead of assuming that it is always the entire language list. (WebCore::CaptionUserPreferencesMac::sortedTrackListForMenu): Insert "Off" and "Automatic" items. * platform/LocalizedStrings.cpp: (WebCore::textTrackAutomaticMenuItemText): New. * platform/LocalizedStrings.h: * platform/graphics/MediaPlayer.cpp: (WebCore::MediaPlayer::languageOfPrimaryAudioTrack): New. * platform/graphics/MediaPlayer.h: * platform/graphics/MediaPlayerPrivate.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::MediaPlayerPrivateAVFoundationObjC::languageOfPrimaryAudioTrack): Return the language of the main audio track. LayoutTests: * media/media-captions.html: Opportunistic fix - don't look at state until we get the 'canplaythrough' event because the media engine state may not have been processed until that time. * media/track/track-cue-container-rendering-position.html: Don't assume that a cue has been rendered immediately when the 'canplaythrough' event comes through. * media/track/track-cue-rendering-mode-changed.html: Ditto. * media/track/track-in-band-expected.txt: Don't check if cues have loaded, it doesn't matter for this test. * media/track/track-in-band.html: Ditto. * media/track/track-user-preferences-expected.txt: Changed name of utility function from menuIndexForLanguage to indexOfMenuItemBeginningWith. * media/track/track-user-preferences.html: Move menuIndexForLanguage to trackmenu-test.js and change name to indexOfMenuItemBeginningWith. Clarify the message logged when a track loads but it should not. * media/trackmenu-test.js: Move some functions here from track-user-preferences.html (trackMenuList): (indexOfMenuItemBeginningWith): (selectCaptionMenuItem): * media/video-controls-captions-trackmenu-sorted.html: Update for new menu item. * media/video-controls-captions-trackmenu.html: Ditto. * platform/mac/media/video-controls-captions-trackmenu-expected.txt: Ditto. * platform/mac/media/video-controls-captions-trackmenu-sorted-expected.txt: Ditto. Canonical link: https://commits.webkit.org/132321@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@147675 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-04-04 22:23:47 +00:00
waitForEvent('canplaythrough', canplaythrough);
2009-11-19 Eric Carlson <eric.carlson@apple.com> Reviewed by Dan Bernstein. <rdar://problem/7035231> Support closed caption in <video> element Test: media/media-captions.html * WebCore.base.exp: * accessibility/AccessibilityMediaControls.cpp: (WebCore::AccessibilityMediaControl::controlTypeName): Define ShowClosedCaptionsButton and HideClosedCaptionsButton. * css/CSSPrimitiveValueMappings.h: (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): Add MediaToggleClosedCaptionsButtonPart. * css/CSSSelector.cpp: (WebCore::CSSSelector::extractPseudoType): Define and match mediaControlsToggleClosedCaptionsButton. * css/CSSSelector.h: (WebCore::CSSSelector::): * css/CSSStyleSelector.cpp: (WebCore::CSSStyleSelector::SelectorChecker::checkOneSelector): Define and match PseudoMediaControlsToggleClosedCaptions. * css/CSSValueKeywords.in: Define and use media-toggle-closed-captions-button. * css/mediaControls.css: * css/mediaControlsQuickTime.css: Add webkit-media-controls-toggle-closed-captions-button. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::HTMLMediaElement): Initialize m_closedCaptionsVisible. (WebCore::HTMLMediaElement::loadInternal): Set m_closedCaptionsVisible to false. (WebCore::HTMLMediaElement::hasClosedCaptions): (WebCore::HTMLMediaElement::closedCaptionsVisible): (WebCore::HTMLMediaElement::setClosedCaptionsVisible): New, captions internal methods. (WebCore::HTMLMediaElement::setWebkitClosedCaptionsVisible): (WebCore::HTMLMediaElement::webkitClosedCaptionsVisible): (WebCore::HTMLMediaElement::webkitHasClosedCaptions): New, captions DOM API. * html/HTMLMediaElement.h: * html/HTMLMediaElement.idl: Declare methods needed for captions API. * platform/ThemeTypes.h: Add MediaToggleClosedCaptionsButtonPart. * platform/android/LocalizedStringsAndroid.cpp: (WebCore::localizedMediaControlElementString): (WebCore::localizedMediaControlElementHelpText): (WebCore::localizedMediaTimeDescription): Add empty implmentations. * platform/graphics/MediaPlayer.cpp: (WebCore::NullMediaPlayerPrivate::hasClosedCaptions): (WebCore::NullMediaPlayerPrivate::setClosedCaptionsVisible): New, empty implementations of media engine closed caption functions. (WebCore::MediaPlayer::hasClosedCaptions): (WebCore::MediaPlayer::setClosedCaptionsVisible): New, call media engine closed caption functions. * platform/graphics/MediaPlayer.h: * platform/graphics/MediaPlayerPrivate.h: (WebCore::MediaPlayerPrivateInterface::hasClosedCaptions): (WebCore::MediaPlayerPrivateInterface::setClosedCaptionsVisible): Declare new media engine methods. * platform/graphics/mac/MediaPlayerPrivateQTKit.h: * platform/graphics/mac/MediaPlayerPrivateQTKit.mm: (WebCore::MediaPlayerPrivate::hasClosedCaptions): (WebCore::MediaPlayerPrivate::setClosedCaptionsVisible): New, QTKit implementation of closed caption methods. * platform/gtk/LocalizedStringsGtk.cpp: (WebCore::localizedMediaControlElementString): (WebCore::localizedMediaControlElementHelpText): Add help text for ShowClosedCaptionsButton and HideClosedCaptionsButton. * platform/mac/WebCoreSystemInterface.h: * platform/mac/WebCoreSystemInterface.mm: Declare and initialize wkQTMovieHasClosedCaptions and wkQTMovieSetShowClosedCaptions. * rendering/MediaControlElements.cpp: (WebCore::MediaControlInputElement::MediaControlInputElement): Deal with MEDIA_CONTROLS_TOGGLE_CLOSED_CAPTIONS_BUTTON. (WebCore::MediaControlToggleClosedCaptionsButtonElement::MediaControlToggleClosedCaptionsButtonElement): (WebCore::MediaControlToggleClosedCaptionsButtonElement::defaultEventHandler): (WebCore::MediaControlToggleClosedCaptionsButtonElement::updateDisplayType): New, implement the closed caption toggle button, * rendering/MediaControlElements.h: Define MediaShowClosedCaptionsButton and MediaHideClosedCaptionsButton, declare MediaControlToggleClosedCaptionsButtonElement. * rendering/RenderMedia.cpp: (WebCore::RenderMedia::styleDidChange): (WebCore::RenderMedia::createToggleClosedCaptionsButton): (WebCore::RenderMedia::createStatusDisplay): (WebCore::RenderMedia::updateControls): (WebCore::RenderMedia::forwardEvent): * rendering/RenderMedia.h: Deal with m_toggleClosedCaptionsButton. * rendering/RenderTheme.cpp: (WebCore::RenderTheme::paint): Deal with MediaToggleClosedCaptionsButtonPart. * rendering/RenderTheme.h: * rendering/RenderThemeMac.h: Declare paintMediaToggleClosedCaptionsButton. * rendering/RenderThemeMac.mm: (WebCore::RenderThemeMac::paintMediaToggleClosedCaptionsButton): New. (WebCore::RenderThemeMac::shouldRenderMediaControlPart): Don't render captions toggle button unless we are using the new theme, the movie has captions, and the movie is in a <video> element since we currently rely on QTKit to render the captions. * rendering/style/RenderStyleConstants.h: Define MEDIA_CONTROLS_TOGGLE_CLOSED_CAPTIONS_BUTTON. 2009-11-19 Eric Carlson <eric.carlson@apple.com> Reviewed by Dan Bernstein. <rdar://problem/7035231> Support closed caption in <video> element * media/media-captions-expected.txt: Added. * media/media-captions.html: Added. * media/content/counting-captioned.mov: Added. * platform/gtk/Skipped: * platform/mac-leopard/Skipped: * platform/mac-tiger/Skipped: * platform/win/Skipped: Skipped on platforms that don't support closed captions yet. 2009-11-19 Eric Carlson <eric.carlson@apple.com> Reviewed by Dan Bernstein. <rdar://problem/7035231> Support closed caption in <video> element * English.lproj/Localizable.strings: Add strings for toggle captions button. 2009-11-19 Eric Carlson <eric.carlson@apple.com> Reviewed by Dan Bernstein. <rdar://problem/7035231> Support closed caption in <video> element * WebCoreSupport/WebSystemInterface.m: (InitWebCoreSystemInterface): Add QTMovieHasClosedCaptions and QTMovieSetShowClosedCaptions. * WebCoreSupport/WebViewFactory.mm: (-[WebViewFactory localizedMediaControlElementString:]): (-[WebViewFactory localizedMediaControlElementHelpText:]): Add accessibility help strings for media controller closed caption button. 2009-11-19 Eric Carlson <eric.carlson@apple.com> Reviewed by Dan Bernstein. <rdar://problem/7035231> Support closed caption in <video> element * WebCoreLocalizedStrings.cpp: (WebCore::localizedMediaControlElementString): (WebCore::localizedMediaControlElementHelpText): Add accessibility help strings for media controller closed caption button. 2009-11-19 Eric Carlson <eric.carlson@apple.com> Reviewed by Dan Bernstein. <rdar://problem/7035231> Support closed caption in <video> element * WebKitSystemInterface.h: Add prototypes for WKQTMovieHasClosedCaptions and WKQTMovieSetShowClosedCaptions, define WKMediaUIPartToggleClosedCaptionsButton. Canonical link: https://commits.webkit.org/42620@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@51191 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2009-11-19 18:14:01 +00:00
consoleWrite("<b>Test before movie is open:</b>");
testExpected("mediaElement.webkitHasClosedCaptions", false);
testExpected("mediaElement.webkitClosedCaptionsVisible", false);
openNextMovie();
}
</script>
</head>
<body onload="start()">
<video controls></video>
<p>Test media element close caption API.</p>
</body>
</html>