1. 27 Mar, 2013 1 commit
  2. 20 Mar, 2013 1 commit
    • eric.carlson@apple.com's avatar
      Allow ports specific text track menu · 62bb7dc9
      eric.carlson@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=112800
      
      Reviewed by Dean Jackson.
      
      Source/WebCore: 
      
      No new tests, existing tests updated for changes.
      
      * English.lproj/Localizable.strings: Add localizable strings for text track names.
      
      * html/HTMLMediaElement.cpp:
      (WebCore::HTMLMediaElement::HTMLMediaElement): userPrefersCaptions -> shouldShowCaptions.
      (WebCore::HTMLMediaElement::setSelectedTextTrack): toggleTrackAtIndex -> setSelectedTextTrack.
      (WebCore::HTMLMediaElement::userPrefersCaptions): userPrefersCaptions -> shouldShowCaptions.
      (WebCore::HTMLMediaElement::userIsInterestedInThisTrackKind): Get preferences from CaptionUserPreferences
          instead of from Settings.
      (WebCore::HTMLMediaElement::setSelectedTextTrack): Renamed from toggleTrackAtIndex. Now takes
          a TextTrack* instead of an int.
      (WebCore::HTMLMediaElement::captionPreferencesChanged): Don't force a recalculation unless 
          captions are enabled/disabled to avoid unnecessary thrash.
      * html/HTMLMediaElement.h:
      
      * html/shadow/MediaControlElements.cpp:
      (WebCore::MediaControlClosedCaptionsTrackListElement::defaultEventHandler): Use the menu to track
          map instead of just the track index.
      (WebCore::MediaControlClosedCaptionsTrackListElement::updateDisplay): Build and configure the
          menu from the menu to track map.
      (WebCore::MediaControlClosedCaptionsTrackListElement::rebuildTrackListMenu): Start with a list
          of tracks already sorted according to platform specific rules. Build a menu to track map
          so tracks are retained while the menu is visible.
      * html/shadow/MediaControlElements.h:
      
      * html/shadow/MediaControls.cpp:
      (WebCore::MediaControls::textTrackPreferencesChanged): Call closedCaptionTracksChanged so the
          track menu will be rebuilt before it is shown again.
      
      * html/track/InbandTextTrack.cpp:
      (WebCore::InbandTextTrack::containsOnlyForcedSubtitles): New, passthrough to the private track.
      (WebCore::InbandTextTrack::isMainProgramContent): Ditto.
      (WebCore::InbandTextTrack::isEasyToRead): Ditto.
      * html/track/InbandTextTrack.h:
      * html/track/TextTrack.h:
      
      * html/track/TextTrackList.cpp:
      (WebCore::TextTrackList::contains): New.
      * html/track/TextTrackList.h:
      
      * page/CaptionUserPreferences.cpp:
      (WebCore::CaptionUserPreferences::CaptionUserPreferences): Pull in from .h ditto.
      (WebCore::CaptionUserPreferences::~CaptionUserPreferences): Ditto.
      (WebCore::CaptionUserPreferences::shouldShowCaptions): Renamed from userPrefersCaptions. 
      (WebCore::CaptionUserPreferences::setShouldShowCaptions): New.
      (WebCore::CaptionUserPreferences::userPrefersCaptions): Ditto.
      (WebCore::CaptionUserPreferences::setUserPrefersCaptions): Ditto.
      (WebCore::CaptionUserPreferences::userPrefersSubtitles): Ditto.
      (WebCore::CaptionUserPreferences::setUserPrefersSubtitles): Ditto.
      (WebCore::CaptionUserPreferences::userPrefersTextDescriptions): Ditto.
      (WebCore::CaptionUserPreferences::setUserPrefersTextDescriptions): Ditto.
      (WebCore::CaptionUserPreferences::displayNameForTrack): Ditto.
      (WebCore::CaptionUserPreferences::sortedTrackListForMenu): Ditto.
      * page/CaptionUserPreferences.h:
      
      * page/CaptionUserPreferencesMac.h:
      * page/CaptionUserPreferencesMac.mm:
      (WebCore::CaptionUserPreferencesMac::shouldShowCaptions): Renamed from userPrefersCaptions. 
      (WebCore::CaptionUserPreferencesMac::userPrefersCaptions): New.
      (WebCore::CaptionUserPreferences::userPrefersSubtitles): Ditto.
      (WebCore::trackDisplayName): Update logic used to build track title.
      (WebCore::CaptionUserPreferencesMac::displayNameForTrack): Call trackDisplayName.
      (WebCore::textTrackCompare): Text track title sort comparison function.
      (WebCore::CaptionUserPreferencesMac::sortedTrackListForMenu): New. Sort the list of tracks
          according to title, language, and user preferences.
      
      * platform/Language.cpp:
      (WebCore::displayNameForLanguageLocale): Don't leak the CFLocale.
              
      * platform/LocalizedStrings.cpp:
      (WebCore::textTrackCountryAndLanguageMenuItemText): New.
      (WebCore::textTrackLanguageMenuItemText): Ditto.
      (WebCore::closedCaptionTrackMenuItemText): Ditto.
      (WebCore::sdhTrackMenuItemText): Ditto.
      (WebCore::easyReaderTrackMenuItemText): Ditto.
      * platform/LocalizedStrings.h:
      
      * platform/graphics/InbandTextTrackPrivate.h:
      * platform/graphics/avfoundation/objc/InbandTextTrackPrivateAVFObjC.h:
      * platform/graphics/avfoundation/objc/InbandTextTrackPrivateAVFObjC.mm:
      (WebCore::InbandTextTrackPrivateAVFObjC::containsOnlyForcedSubtitles): New, return AVFoundation property.
      (WebCore::InbandTextTrackPrivateAVFObjC::isMainProgramContent): Ditto.
      (WebCore::InbandTextTrackPrivateAVFObjC::isEasyToRead): Ditto.
      
      * testing/InternalSettings.cpp:
      (WebCore::InternalSettings::setShouldDisplayTrackKind): Set setting via CaptionUserPreferences
          instead of from Settings.
      (WebCore::InternalSettings::shouldDisplayTrackKind): Get setting from CaptionUserPreferences
          instead of from Settings.
      
      Source/WebKit: 
      
      * WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in: Add new exports.
      * win/WebKit.vcproj/WebKitExports.def.in: Ditto.
      
      LayoutTests: 
      
      * media/track/track-user-preferences-expected.txt:
      * media/track/track-user-preferences.html:
      * media/video-controls-captions-trackmenu-localized.html:
      * media/video-controls-captions-trackmenu-sorted.html:
      * media/video-controls-captions-trackmenu.html:
      * platform/mac/media/video-controls-captions-trackmenu-expected.txt:
      * platform/mac/media/video-controls-captions-trackmenu-localized-expected.txt:
      * platform/mac/media/video-controls-captions-trackmenu-sorted-expected.txt:
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@146380 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      62bb7dc9
  3. 06 Feb, 2013 1 commit
    • dino@apple.com's avatar
      Minor updates to captions menu UI · a020e6b6
      dino@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=109005
      
      Reviewed by Eric Carlson.
      
      Now that we only have a single section in the captions menu, remove the
      unnecessary wrapper element. Also update the UI for Mac so that the menu
      grows in size dynamically, and change the text we display for a caption
      that has neither label or language identifiers.
      
      Covered by existing tests.
      
      * English.lproj/Localizable.strings: New string for an unknown caption label.
      * css/fullscreenQuickTime.css: New rules for the captions menu.
      (video:-webkit-full-screen::-webkit-media-controls-closed-captions-container):
      (video:-webkit-full-screen::-webkit-media-controls-closed-captions-track-list):
      * css/mediaControlsQuickTime.css: Ditto.
      (video::-webkit-media-controls-closed-captions-container):
      (video::-webkit-media-controls-closed-captions-track-list):
      * html/shadow/MediaControlElements.cpp:
      (WebCore::MediaControlClosedCaptionsTrackListElement::rebuildTrackListMenu):
          Remove the <section> element container.
      * platform/LocalizedStrings.cpp:
      (WebCore::textTrackNoLabelText): New string for an unknown caption label.
      
      LayoutTests:
      
      A caption track without a label or language is now given the menu
      title 'Unknown'. Note also that the test includes some intentional
      failure text.
      
      * media/video-controls-captions-trackmenu-localized.html:
      * platform/mac/media/video-controls-captions-trackmenu-localized-expected.txt:
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@142003 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      a020e6b6
  4. 05 Feb, 2013 2 commits
    • eric.carlson@apple.com's avatar
      [Mac] Complete plumbing so captions menu can indicate track type · eb3dd61d
      eric.carlson@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=108994
      
      Reviewed by Dean Jackson.
      
      Source/WebCore: 
      
      Plumb "isClosedCaptions" through to the Mac media engine.
      
      Updated media/video-controls-captions-trackmenu-localized.html and results.
      
      * html/track/InbandTextTrack.cpp:
      (WebCore::InbandTextTrack::isClosedCaptions): New, pass the call through to the private track.
      * html/track/InbandTextTrack.h:
      (InbandTextTrack):
      * html/track/TextTrack.cpp:
      (WebCore::TextTrack::TextTrack): Lose the member variable, this won't be accessed often enough
          to make it worth caching the value.
      * html/track/TextTrack.h:
      (WebCore::TextTrack::isClosedCaptions): Make virtual so derived classes can oveerride.
      * platform/graphics/InbandTextTrackPrivate.h:
      (WebCore::InbandTextTrackPrivate::isClosedCaptions): New.
      * platform/graphics/avfoundation/objc/InbandTextTrackPrivateAVFObjC.h:
      * platform/graphics/avfoundation/objc/InbandTextTrackPrivateAVFObjC.mm:
      (WebCore::InbandTextTrackPrivateAVFObjC::isClosedCaptions): New.
      
      LayoutTests: 
      
      Update test results now that the Mac media engine identifies CC tracks.
      
      * media/video-controls-captions-trackmenu-localized.html:
      * platform/mac/media/video-controls-captions-trackmenu-localized-expected.txt:
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@141957 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      eb3dd61d
    • dino@apple.com's avatar
      [Mac] Captions menu should indicate language and type of track · 53a29d41
      dino@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=108882
      
      Reviewed by Eric Carlson.
      
      Source/WebCore:
      
      On Mac, we want a specific format for menu items in a caption list. Since
      other ports might want different formats, move the generation of the label
      into CaptionsUserPreferences where it can be overridden.
      
      This required CaptionsUserPreferences to become public on the PageGroup, so
      it could be used when creating the menu. Also, since CaptionsUserPreferences
      was hidden on Mountain Lion and below, be a little more specific about
      which pieces can be seen on which builds.
      
      Covered by existing media/video-controls-captions-trackmenu tests.
      
      * English.lproj/Localizable.strings: Remove textTrackClosedCaptionsText.
      * html/shadow/MediaControlElements.cpp:
      (WebCore::MediaControlClosedCaptionsTrackListElement::rebuildTrackListMenu): Build only
          one section and get the track's display name from the user preferences.
      * page/CaptionUserPreferences.h:
      (WebCore::CaptionUserPreferences::displayNameForTrack): Default implementation of
          virtual function that provides a label for a captions menu item.
      * page/CaptionUserPreferencesMac.h: Add the new virtual function, and expose just
          a bit of this class outside 10.9 builds.
      * page/CaptionUserPreferencesMac.mm:
      (WebCore::CaptionUserPreferencesMac::CaptionUserPreferencesMac): Guard features for system version.
      (WebCore::CaptionUserPreferencesMac::~CaptionUserPreferencesMac): Ditto.
      (WebCore::CaptionUserPreferencesMac::displayNameForTrack): New OS X-specific method that
          returns a string for the menu label.
      * page/PageGroup.cpp:
      (WebCore::PageGroup::captionPreferences): Unguard for system version.
      * page/PageGroup.h: Make captionPreferences public.
      * platform/LocalizedStrings.cpp: Remove textTrackClosedCaptionsText - not needed any more.
      * platform/LocalizedStrings.h: Remove textTrackClosedCaptionsText.
      
      LayoutTests:
      
      Now that the captions menu can be labelled in a platform-specific way, move
      the results into the platform directory. At the moment, they are skipped
      everywhere but Mac. Also update the tests to the new menu structure, which
      only has a single list of entries.
      
      * media/video-controls-captions-trackmenu-localized.html: Updated for new menu structure.
      * media/video-controls-captions-trackmenu-expected.txt: Removed.
      * media/video-controls-captions-trackmenu-localized-expected.txt: Removed.
      * media/video-controls-captions-trackmenu-sorted-expected.txt: Removed.
      * media/video-controls-captions-trackmenu-sorted.html: Updated for new menu structure.
      * media/video-controls-captions-trackmenu.html: Updated for new menu structure.
      * platform/mac/media/video-controls-captions-trackmenu-expected.txt: New platform specific results.
      * platform/mac/media/video-controls-captions-trackmenu-localized-expected.txt: Ditto.
      * platform/mac/media/video-controls-captions-trackmenu-sorted-expected.txt: Ditto.
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@141864 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      53a29d41
  5. 20 Dec, 2012 1 commit
  6. 18 Dec, 2012 1 commit
    • dino@apple.com's avatar
      Track menu needs localization · 6a507318
      dino@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=105233
      
      Reviewed by Eric Carlson.
      
      Source/WebCore:
      
      Allow the UI strings in the closed captions menu to be localized, and
      profile strings for the English locale.
      
      Test: media/video-controls-captions-trackmenu-localized.html
      
      * English.lproj/Localizable.strings: Adds the four new captions strings.
      * html/shadow/MediaControlElements.cpp:
      (WebCore::MediaControlClosedCaptionsTrackListElement::rebuildTrackListMenu): Use localized getters.
      * platform/LocalizedStrings.cpp:
      (WebCore::textTrackClosedCaptionsText): New localized string getter.
      (WebCore::textTrackSubtitlesText): Ditto.
      (WebCore::textTrackOffText): Ditto.
      (WebCore::textTrackNoLabelText): Ditto.
      * platform/LocalizedStrings.h:
      
      LayoutTests:
      
      Test to exercise the localization of strings in the captions menu.
      While I was here I merged some common code into a helper file.
      
      * media/trackmenu-test.js: Added. New helper file to run common test operations.
      * media/video-controls-captions-trackmenu-localized-expected.txt: Added.
      * media/video-controls-captions-trackmenu-localized.html: Added.
      * media/video-controls-captions-trackmenu-sorted.html: Updated to use helper functions.
      * platform/chromium/TestExpectations: Skip unimplemented test.
      * platform/efl/TestExpectations: Ditto.
      * platform/gtk/TestExpectations: Ditto.
      * platform/qt/TestExpectations: Ditto.
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@138071 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      6a507318