• dino@apple.com's avatar
    [Mac] Captions menu should indicate language and type of track · 53a29d41
    dino@apple.com authored
    Reviewed by Eric Carlson.
    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.
    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
CaptionUserPreferencesMac.mm 18.9 KB