diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog index 0032f9698b152358bfe763c8125256460b20ec38..6f883bfd99b1831a841d0cfda71aeeba9a6603a9 100644 --- a/LayoutTests/ChangeLog +++ b/LayoutTests/ChangeLog @@ -1,3 +1,20 @@ +2013-03-27 Eric Carlson + + [Mac] webkitClosedCaptionsVisible doesn't work + https://bugs.webkit.org/show_bug.cgi?id=113417 + + Reviewed by Jer Noble. + + * media/track/track-in-band-legacy-api-expected.txt: Added. + * media/track/track-in-band-legacy-api.html: Added. + + * platform/chromium/TestExpectations: Skip new test. + * platform/efl/TestExpectations: Ditto. + * platform/gtk/TestExpectations: Ditto. + * platform/mac/TestExpectations: Ditto. + * platform/qt/TestExpectations: Ditto. + * platform/win/TestExpectations: Ditto. + 2013-03-27 Eric Carlson [Mac] Text track menu items sometimes labeled incorrectly diff --git a/LayoutTests/media/track/track-in-band-legacy-api-expected.txt b/LayoutTests/media/track/track-in-band-legacy-api-expected.txt new file mode 100644 index 0000000000000000000000000000000000000000..6c761cf69469ac739db28dbe7a0061324ee2118e --- /dev/null +++ b/LayoutTests/media/track/track-in-band-legacy-api-expected.txt @@ -0,0 +1,27 @@ +Test that in-band tracks work with .webkitClosedCaptionsVisible. + +EVENT(canplaythrough) + +** Check initial in-band track states +EXPECTED (video.textTracks.length == '1') OK +RUN(inbandTrack1 = video.textTracks[0]) +EXPECTED (inbandTrack1.mode == 'disabled') OK +EXPECTED (inbandTrack1.cues == 'null') OK +EXPECTED (inbandTrack1.language == 'en') OK +EXPECTED (inbandTrack1.kind == 'captions') OK + +** Enable cues and let them load +RUN(video.webkitClosedCaptionsVisible = true) +RUN(video.play()) +EVENT(seeked) + +** Test to make sure captions are displaying +EXPECTED (inbandTrack1.cues != 'null') OK +EXPECTED (textTrackDisplayElement(video, 'cue').textContent != 'null') OK + +** Disable captions, cues should be flushed +RUN(video.webkitClosedCaptionsVisible = false) +EXPECTED (inbandTrack1.cues == 'null') OK + +END OF TEST + diff --git a/LayoutTests/media/track/track-in-band-legacy-api.html b/LayoutTests/media/track/track-in-band-legacy-api.html new file mode 100644 index 0000000000000000000000000000000000000000..9d86a9e922583de12846de0a72b149183731af74 --- /dev/null +++ b/LayoutTests/media/track/track-in-band-legacy-api.html @@ -0,0 +1,56 @@ + + + + In-band tracks enabled/disabled with legacy API + + + + + + + + +

Test that in-band tracks work with .webkitClosedCaptionsVisible.

+ + diff --git a/LayoutTests/platform/chromium/TestExpectations b/LayoutTests/platform/chromium/TestExpectations index 783ecac45eed766e563480b9a342fda5a80ba47a..4bc1d67af42288db7b4289bdb1c44f3b6b3fef89 100644 --- a/LayoutTests/platform/chromium/TestExpectations +++ b/LayoutTests/platform/chromium/TestExpectations @@ -3578,6 +3578,7 @@ webkit.org/b/94002 [ Mac Debug ] inspector/debugger/live-edit.html [ Crash Pass webkit.org/b/103767 [ Win Mac Linux ] media/track/track-in-band.html [ Skip ] webkit.org/b/103767 [ Win Mac Linux ] media/track/track-in-band-cues-added-once.html [ Skip ] webkit.org/b/103767 [ Win Mac Linux ] media/track/track-in-band-style.html [ Skip ] +webkit.org/b/103767 [ Win Mac Linux ] media/track/track-in-band-legacy-api.html [ Skip ] # Flaky on Win (perhaps due to lighttpd?) webkit.org/b/104489 [ Win ] http/tests/w3c/webperf/submission/Google/resource-timing/html/test_resource_attribute_order.html [ Failure Pass ] diff --git a/LayoutTests/platform/efl/TestExpectations b/LayoutTests/platform/efl/TestExpectations index af404d1d50def822605d53d576f55c5184126508..dda0f66a7ce8a98c467cb0527620111194fc11e3 100644 --- a/LayoutTests/platform/efl/TestExpectations +++ b/LayoutTests/platform/efl/TestExpectations @@ -1622,6 +1622,7 @@ webkit.org/b/61138 http/tests/w3c/webperf/submission/Google/resource-timing [ Sk Bug(EFL) media/track/track-in-band.html [ Skip ] Bug(EFL) media/track/track-in-band-cues-added-once.html [ Skip ] Bug(EFL) media/track/track-in-band-style.html [ Skip ] +Bug(EFL) media/track/track-in-band-legacy-api.html [ Skip ] # All debug bots timeout (crash) on this one webkit.org/b/56496 [ Debug ] fast/js/array-sort-modifying-tostring.html [ Crash Pass ] diff --git a/LayoutTests/platform/gtk/TestExpectations b/LayoutTests/platform/gtk/TestExpectations index cd7abe11b15bbb5eca1ba59812317cfd7315756f..639d1f68937d8e13ff9cf4485db9d107b057a1fb 100644 --- a/LayoutTests/platform/gtk/TestExpectations +++ b/LayoutTests/platform/gtk/TestExpectations @@ -406,6 +406,7 @@ webkit.org/b/103926 media/track/opera/track/webvtt/rendering/adhoc/voice_with_ev webkit.org/b/103771 media/track/track-in-band.html [ Failure ] webkit.org/b/103771 media/track/track-in-band-cues-added-once.html [ Timeout ] webkit.org/b/103771 media/track/track-in-band-style.html [ Timeout ] +webkit.org/b/103771 media/track/track-in-band-legacy-api.html [ Timeout ] #Incorrect rebaseline webkit.org/b/107818 media/controls-styling.html [ Failure ] diff --git a/LayoutTests/platform/mac/TestExpectations b/LayoutTests/platform/mac/TestExpectations index 73f8acf13229d835baf7c5e1b14a7c9ad9f5b25b..dd6144f054f5cd0bef804bc9f2a9e731e63cadfa 100644 --- a/LayoutTests/platform/mac/TestExpectations +++ b/LayoutTests/platform/mac/TestExpectations @@ -1355,6 +1355,7 @@ Bug(jernoble) [ MountainLion Lion SnowLeopard ] media/video-src-blob.html webkit.org/b/103663 [ MountainLion Lion SnowLeopard ] media/track/track-in-band.html webkit.org/b/103663 [ MountainLion Lion SnowLeopard ] media/track/track-in-band-cues-added-once.html webkit.org/b/103663 [ MountainLion Lion SnowLeopard ] media/track/track-in-band-style.html +webkit.org/b/103663 [ MountainLion Lion SnowLeopard ] media/track/track-in-band-legacy-api.html # These two tests sometimes timeout webkit.org/b/112492 media/track/track-language-preference.html [ Failure Pass ] diff --git a/LayoutTests/platform/qt/TestExpectations b/LayoutTests/platform/qt/TestExpectations index 7c3b040e926fb3bda49c2012f5cee86792376499..231dde12b22134c93128fc46dd86eb8b66535f72 100644 --- a/LayoutTests/platform/qt/TestExpectations +++ b/LayoutTests/platform/qt/TestExpectations @@ -2618,6 +2618,7 @@ webkit.org/b/112893 editing/spelling/spellcheck-paste-continuous-disabled.html [ webkit.org/b/103769 media/track/track-in-band.html [ Skip ] webkit.org/b/103769 media/track/track-in-band-cues-added-once.html [ Skip ] webkit.org/b/103769 media/track/track-in-band-style.html [ Skip ] +webkit.org/b/103769 media/track/track-in-band-legacy-api.html [ Skip ] webkit.org/b/104150 fast/media/implicit-media-all.html [ ImageOnlyFailure ] diff --git a/LayoutTests/platform/win/TestExpectations b/LayoutTests/platform/win/TestExpectations index 414573e9cd16f6c624cb1b97982bf06964259fde..a6d16505d175b5537777450cce69cb2f2d9f08c8 100644 --- a/LayoutTests/platform/win/TestExpectations +++ b/LayoutTests/platform/win/TestExpectations @@ -2515,6 +2515,7 @@ fast/js/kde/Array.html webkit.org/b/103770 media/track/track-in-band.html [ Skip ] webkit.org/b/103770 media/track/track-in-band-cues-added-once.html [ Skip ] webkit.org/b/103770 media/track/track-in-band-style.html [ Skip ] +webkit.org/b/103770 media/track/track-in-band-legacy-api.html [ Skip ] # https://bugs.webkit.org/show_bug.cgi?id=97026 fast/events/keydown-leftright-keys.html diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index caceb51a99f3fa11886fa669859a0a3c67abf12e..e7727c0819c56e35ee30d3a9d0c08ead068f5962 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,27 @@ +2013-03-27 Eric Carlson + + [Mac] webkitClosedCaptionsVisible doesn't work + https://bugs.webkit.org/show_bug.cgi?id=113417 + + Reviewed by Jer Noble. + + Test: media/track/track-in-band-legacy-api.html + + * html/HTMLMediaElement.cpp: + (WebCore::HTMLMediaElement::HTMLMediaElement): Delete m_disableCaptions, it is no longer used. + (WebCore::HTMLMediaElement::configureTextTrackGroup): Pass this to textTrackSelectionScore. + (WebCore::HTMLMediaElement::setClosedCaptionsVisible): Delete m_disableCaptions, it is no longer used. + * html/HTMLMediaElement.h: Ditto. + + * page/CaptionUserPreferences.cpp: + (WebCore::CaptionUserPreferences::textTrackSelectionScore): Add an HTMLMediaElement parameter. + * page/CaptionUserPreferences.h: + + * page/CaptionUserPreferencesMac.h: + * page/CaptionUserPreferencesMac.mm: + (WebCore::CaptionUserPreferencesMac::textTrackSelectionScore): Return a score if the media element + is showing captions, even if the preference says captions are disabled. + 2013-03-27 Eric Carlson [Mac] Text track menu items sometimes labeled incorrectly diff --git a/Source/WebCore/html/HTMLMediaElement.cpp b/Source/WebCore/html/HTMLMediaElement.cpp index c044dc395e2d0ab1c7288ce47f4c16860b9e4548..9f9006f7ef41ad1f22c06680b087d5a819cb9cf3 100644 --- a/Source/WebCore/html/HTMLMediaElement.cpp +++ b/Source/WebCore/html/HTMLMediaElement.cpp @@ -297,7 +297,6 @@ HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName, Document* docum , m_lastTextTrackUpdateTime(-1) , m_textTracks(0) , m_ignoreTrackDisplayUpdate(0) - , m_disableCaptions(false) #endif #if ENABLE(WEB_AUDIO) , m_audioSourceNode(0) @@ -317,11 +316,6 @@ HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName, Document* docum #if ENABLE(VIDEO_TRACK) document->registerForCaptionPreferencesChangedCallbacks(this); - if (document->page()) { - CaptionUserPreferences* captionPreferences = document->page()->group().captionPreferences(); - if (captionPreferences->userHasCaptionPreferences()) - m_disableCaptions = !captionPreferences->shouldShowCaptions(); - } #endif } @@ -3098,7 +3092,7 @@ void HTMLMediaElement::configureTextTrackGroup(const TrackGroup& group) if (m_processingPreferenceChange && textTrack->mode() == TextTrack::showingKeyword()) currentlyEnabledTracks.append(textTrack); - int trackScore = captionPreferences ? captionPreferences->textTrackSelectionScore(textTrack.get()) : 0; + int trackScore = captionPreferences ? captionPreferences->textTrackSelectionScore(textTrack.get(), this) : 0; if (trackScore) { // * If the text track kind is { [subtitles or captions] [descriptions] } and the user has indicated an interest in having a // track with this text track kind, text track language, and text track label enabled, and there is no @@ -4295,10 +4289,7 @@ void HTMLMediaElement::setClosedCaptionsVisible(bool closedCaptionVisible) #if ENABLE(VIDEO_TRACK) if (RuntimeEnabledFeatures::webkitVideoTrackEnabled()) { m_processingPreferenceChange = true; - m_disableCaptions = !m_closedCaptionsVisible; - markCaptionAndSubtitleTracksAsUnconfigured(); - updateTextTrackDisplay(); } #else diff --git a/Source/WebCore/html/HTMLMediaElement.h b/Source/WebCore/html/HTMLMediaElement.h index ecffb6ddeff8f13ac3759039cd5fe4e639413e04..11de6c61f4ee02ef41d68c75735f2b1cb818deb9 100644 --- a/Source/WebCore/html/HTMLMediaElement.h +++ b/Source/WebCore/html/HTMLMediaElement.h @@ -705,7 +705,6 @@ private: CueList m_currentlyActiveCues; int m_ignoreTrackDisplayUpdate; - bool m_disableCaptions; #endif #if ENABLE(WEB_AUDIO) diff --git a/Source/WebCore/page/CaptionUserPreferences.cpp b/Source/WebCore/page/CaptionUserPreferences.cpp index 6c1512f497c026b632beef04b7097093a644cc70..d231058a2b9e1db161b4cb1f6f00c21f9f5c71d6 100644 --- a/Source/WebCore/page/CaptionUserPreferences.cpp +++ b/Source/WebCore/page/CaptionUserPreferences.cpp @@ -192,7 +192,7 @@ Vector > CaptionUserPreferences::sortedTrackListForMenu(TextTr return tracksForMenu; } -int CaptionUserPreferences::textTrackSelectionScore(TextTrack* track) const +int CaptionUserPreferences::textTrackSelectionScore(TextTrack* track, HTMLMediaElement*) const { int trackScore = 0; diff --git a/Source/WebCore/page/CaptionUserPreferences.h b/Source/WebCore/page/CaptionUserPreferences.h index 0a277ca2d0801c3565dee0c6aee2a566d41c6744..b7c1aeb24bebeb8d5b71a90ceacca0a8ec551e56 100644 --- a/Source/WebCore/page/CaptionUserPreferences.h +++ b/Source/WebCore/page/CaptionUserPreferences.h @@ -37,6 +37,7 @@ namespace WebCore { +class HTMLMediaElement; class PageGroup; class TextTrackList; @@ -49,7 +50,7 @@ public: virtual bool shouldShowCaptions() const; virtual void setShouldShowCaptions(bool); - virtual int textTrackSelectionScore(TextTrack*) const; + virtual int textTrackSelectionScore(TextTrack*, HTMLMediaElement*) const; virtual int textTrackLanguageSelectionScore(TextTrack*) const; virtual bool userPrefersCaptions() const; diff --git a/Source/WebCore/page/CaptionUserPreferencesMac.h b/Source/WebCore/page/CaptionUserPreferencesMac.h index 7de618f342e831cd8c9557c1f9f709844d3b9395..ad234cade5cb4f740f8f20ad4d1109c27c744446 100644 --- a/Source/WebCore/page/CaptionUserPreferencesMac.h +++ b/Source/WebCore/page/CaptionUserPreferencesMac.h @@ -60,7 +60,7 @@ public: #endif - virtual int textTrackSelectionScore(TextTrack*) const OVERRIDE; + virtual int textTrackSelectionScore(TextTrack*, HTMLMediaElement*) const OVERRIDE; virtual Vector > sortedTrackListForMenu(TextTrackList*) OVERRIDE; virtual String displayNameForTrack(TextTrack*) const OVERRIDE; diff --git a/Source/WebCore/page/CaptionUserPreferencesMac.mm b/Source/WebCore/page/CaptionUserPreferencesMac.mm index 106d0887312a4dcc82feadb3452fed9102e6935b..4a6e5eac9e08430ec7f97177ba3bec3af9a6536e 100644 --- a/Source/WebCore/page/CaptionUserPreferencesMac.mm +++ b/Source/WebCore/page/CaptionUserPreferencesMac.mm @@ -33,6 +33,7 @@ #import "CoreText/CoreText.h" #import "DOMWrapperWorld.h" #import "FloatConversion.h" +#import "HTMLMediaElement.h" #import "KURL.h" #import "Language.h" #import "LocalizedStrings.h" @@ -536,9 +537,9 @@ static String trackDisplayName(TextTrack* track) RetainPtr languageCF(AdoptCF, CFLocaleCopyDisplayNameForPropertyValue(currentLocale.get(), kCFLocaleLanguageCode, localeIdentifier.get())); String language = languageCF.get(); if (!label.isEmpty()) { - if (language.isEmpty() || label.contains(language)) { + if (language.isEmpty() || label.contains(language)) displayName.append(label); - } else { + else { RetainPtr localeDict(AdoptCF, CFLocaleCreateComponentsFromLocaleIdentifier(kCFAllocatorDefault, localeIdentifier.get())); if (localeDict) { CFStringRef countryCode = 0; @@ -600,9 +601,9 @@ static String languageIdentifier(const String& languageCode) return lowercaseLanguageCode; } -int CaptionUserPreferencesMac::textTrackSelectionScore(TextTrack* track) const +int CaptionUserPreferencesMac::textTrackSelectionScore(TextTrack* track, HTMLMediaElement* mediaElement) const { - if (!shouldShowCaptions()) + if (!shouldShowCaptions() && !mediaElement->webkitClosedCaptionsVisible()) return 0; if (track->kind() != TextTrack::captionsKeyword() && track->kind() != TextTrack::subtitlesKeyword()) return 0;