1. 27 Mar, 2013 1 commit
    • eric.carlson@apple.com's avatar
      [Mac] webkitClosedCaptionsVisible doesn't work · 92907e15
      eric.carlson@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=113417
      
      Reviewed by Jer Noble.
      
      Source/WebCore: 
      
      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.
      
      LayoutTests: 
      
      * 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.
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@147001 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      92907e15
  2. 22 Mar, 2013 1 commit
    • eric.carlson@apple.com's avatar
      Cleanup text track selection logic · d4e6f18f
      eric.carlson@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=113062
      
      Reviewed by Jer Noble.
      
      No new tests, covered by existing tests.
      
      * html/HTMLMediaElement.cpp:
      (WebCore::HTMLMediaElement::userIsInterestedInThisTrackKind): Remove.
      (WebCore::HTMLMediaElement::configureTextTrackGroup): Don't look at track attributes directly,
          use captionPreferences->textTrackSelectionScore to calculate track rank.
      (WebCore::HTMLMediaElement::setClosedCaptionsVisible): Set m_processingPreferenceChange here
          instead of in captionPreferencesChanged.
      (WebCore::HTMLMediaElement::captionPreferencesChanged): Don't suppress calls to setClosedCaptionsVisible,
          existing code already makes sure we don't do unnecessary work.
      * html/HTMLMediaElement.h:
      
      * html/shadow/MediaControlElements.cpp:
      (WebCore::MediaControlTextTrackContainerElement::updateDisplay): Drive by cleanup, don't
          process inactive cues.
      
      * html/shadow/MediaControlsApple.cpp:
      (WebCore::MediaControlsApple::changedClosedCaptionsVisibility): Call resetTrackListMenu instead
          of updateDisplay so we only mark the menu as needing a recalculation and do the work when
          it is displayed.
      
      * page/CaptionUserPreferences.cpp:
      (WebCore::CaptionUserPreferences::shouldShowCaptions): When in testing mode, return true if
          the caption or subtitle preference has been set.
      (WebCore::CaptionUserPreferences::setShouldShowCaptions): In testing mode, clear the caption
          and subtitle preference when passed false.
      (WebCore::CaptionUserPreferences::textTrackSelectionScore): Calculate the track score based on
          track type preference and preferred language.
      (WebCore::CaptionUserPreferences::textTrackLanguageSelectionScore): Score a track according to
          the language presence and position in the preferred languages list.
      * page/CaptionUserPreferences.h:
      
      * page/CaptionUserPreferencesMac.h:
      * page/CaptionUserPreferencesMac.mm:
      (WebCore::CaptionUserPreferencesMac::textTrackSelectionScore): Calculate track language score 
          according to user preferences.
      
      * platform/Language.cpp:
      (WebCore::indexOfBestMatchingLanguageInList): Repurposed the static bestMatchingLanguage
          function to return the location of a language in a Vector.
      (WebCore::preferredLanguageFromList): Removed.
      * platform/Language.h:
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@146647 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      d4e6f18f
  3. 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
  4. 14 Mar, 2013 1 commit
    • jer.noble@apple.com's avatar
      Crash in DumpRenderTree at com.apple.WebCore:... · c3419e02
      jer.noble@apple.com authored
      Crash in DumpRenderTree at com.apple.WebCore: WebCore::CaptionUserPreferences::captionPreferencesChanged + 185
      https://bugs.webkit.org/show_bug.cgi?id=112051
      
      Reviewed by Eric Carlson.
      
      No new tests; fixes a crash during media/video-controls-captions-trackmenu.html.
      
      Instead of relying on a registration system which can fail when an element's document does not have a page,
      Elements will register for captionPreferencesChanged() notifications directly with their owning Document.
      CaptionUserPreferences, in turn, will notify all Documents in its PageGroup, rather than only directly
      registered listeners.
      
      * dom/Document.cpp:
      (WebCore::Document::registerForCaptionPreferencesChangedCallbacks): Added. Notify the CaptionUserPreferences that someone
          is interested in captionPreferencesChanged notfications.
      (WebCore::Document::unregisterForCaptionPreferencesChangedCallbacks): Added.
      (WebCore::Document::captionPreferencesChanged): Added. Pass to all registered elements.
      * dom/Document.h:
      * dom/Element.h:
      (WebCore::Element::captionPreferencesChanged): Added. Empty; intended
          to be overridden by subclasses.
      * history/CachedPage.cpp:
      (WebCore::CachedPage::CachedPage): Initialize m_needsCaptionPreferenceChanged member.
      (WebCore::CachedPage::restore): Call captionPreferencesChanged() if necessary.
      * history/CachedPage.h:
      (WebCore::CachedPage::markForCaptionPreferencesChanged): Set the m_needsCaptionPreferenceChanged member.
      * history/PageCache.cpp:
      (WebCore::PageCache::markPagesForCaptionPreferencesChanged): Pass to every CachedPage.
      * history/PageCache.h:
      * html/HTMLMediaElement.cpp:
      (WebCore::HTMLMediaElement::HTMLMediaElement): Register with the Document.
      (WebCore::HTMLMediaElement::~HTMLMediaElement): Unregister with same.
      (WebCore::HTMLMediaElement::attach): Remove previous registration call.
      * html/HTMLMediaElement.h:
      * page/CaptionUserPreferences.cpp:
      (WebCore::CaptionUserPreferences::captionPreferencesChanged): Pass to the
          PageGroup.
      * page/CaptionUserPreferences.h:
      (WebCore::CaptionUserPreferences::setInterestedInCaptionPreferenceChanges):
          Empty; intended to be overridden by subclasses.
      * page/CaptionUserPreferencesMac.h:
      * page/CaptionUserPreferencesMac.mm:
      (WebCore::CaptionUserPreferencesMac::setInterestedInCaptionPreferenceChanges):
          Renamed from registerForPreferencesChangedCallbacks().
      (WebCore::CaptionUserPreferencesMac::captionPreferencesChanged):
          Replace call to havePreferenceChangeListeners() with m_listeningForPreferenceChanges.
      * page/Page.cpp:
      (WebCore::Page::captionPreferencesChanged):
          Pass to every contained Document.
      * page/Page.h:
      * page/CaptionUserPreferences.cpp:
      (WebCore::CaptionUserPreferences::captionPreferencesChanged): Pass to the PageGroup.
      * page/CaptionUserPreferences.h:
      * page/PageGroup.cpp:
      (WebCore::PageGroup::captionPreferencesChanged): Pass to every page, as well as pages in the PageCache.
      * page/PageGroup.h:
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@145826 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      c3419e02
  5. 07 Mar, 2013 1 commit
  6. 28 Feb, 2013 1 commit
  7. 20 Feb, 2013 1 commit
  8. 13 Feb, 2013 1 commit
    • eric.carlson@apple.com's avatar
      [Mac] Caption menu should have only one item selected · 70109507
      eric.carlson@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=109730
      
      Reviewed by Dean Jackson.
      
      Source/WebCore: 
      
      No new tests, media/track/track-user-preferences.html was modified to test the changes.
      
      * CMakeLists.txt: Add CaptionUserPreferences.cpp.
      * GNUmakefile.list.am: Ditto.
      * Target.pri: Ditto.
      * WebCore.gypi: Ditto.
      * WebCore.vcproj/WebCore.vcproj: Ditto.
      * WebCore.vcxproj/WebCore.vcxproj: Ditto.
      * WebCore.xcodeproj/project.pbxproj: Ditto.
      
      * html/HTMLMediaElement.cpp:
      (WebCore::HTMLMediaElement::HTMLMediaElement): Initialize m_processingPreferenceChange.
      (WebCore::HTMLMediaElement::configureTextTrackGroup): Only end up with one selected track when
          called because of a preferences change.
      (WebCore::HTMLMediaElement::captionPreferencesChanged): Call setClosedCaptionsVisible instead
          of calling markCaptionAndSubtitleTracksAsUnconfigured directly.
      (WebCore::HTMLMediaElement::markCaptionAndSubtitleTracksAsUnconfigured): Process all tracks, 
          not just track elements.
      * html/HTMLMediaElement.h:
      
      * page/CaptionUserPreferences.cpp: Added so the functionality can be tested in DRT.
      (WebCore::CaptionUserPreferences::registerForPreferencesChangedCallbacks):
      (WebCore::CaptionUserPreferences::unregisterForPreferencesChangedCallbacks):
      (WebCore::CaptionUserPreferences::setUserPrefersCaptions):
      (WebCore::CaptionUserPreferences::captionPreferencesChanged):
      (WebCore::CaptionUserPreferences::preferredLanguages):
      (WebCore::CaptionUserPreferences::setPreferredLanguage):
      (WebCore::CaptionUserPreferences::displayNameForTrack):
      * page/CaptionUserPreferences.h:
      
      * page/CaptionUserPreferencesMac.h:
      * page/CaptionUserPreferencesMac.mm:
      (WebCore::CaptionUserPreferencesMac::registerForPreferencesChangedCallbacks): Moved some logic
          to base class.
      (WebCore::CaptionUserPreferencesMac::captionPreferencesChanged): Ditto.
      
      LayoutTests: 
      
      * media/track/track-user-preferences-expected.txt:
      * media/track/track-user-preferences.html: Update test to check for reactions to preferences.
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@142809 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      70109507
  9. 11 Feb, 2013 1 commit
    • eric.carlson@apple.com's avatar
      [Mac] Track language selection should be sticky · b54d1c88
      eric.carlson@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=109466
      
      Reviewed by Dean Jackson.
      
      .: 
      
      * Source/autotools/symbols.filter: Export PageGroup::captionPreferences and Page::initGroup.
      
      Source/WebCore: 
      
      Choosing a text track from the caption menu should make that track's language the
      preferred caption language. Turning captions off from the menu should disable captions
      in videos loaded subsequently.
      
      OS X has system support for these settings, so changes made by DRT should not change the
      settings on the user's system. Add support for all other ports in DRT only.
      
      Test: media/track/track-user-preferences.html
      
      * WebCore.exp.in: Export PageGroup::captionPreferences().
      
      * html/HTMLMediaElement.cpp:
      (WebCore::HTMLMediaElement::HTMLMediaElement): Use page()->group().captionPreferences().
      (WebCore::HTMLMediaElement::attach): Ditto.
      (WebCore::HTMLMediaElement::detach): Ditto.
      (WebCore::HTMLMediaElement::userPrefersCaptions): Ditto.
      (WebCore::HTMLMediaElement::configureTextTrackGroup): Ditto. Update for 
          preferredLanguageFromList change.
      (WebCore::HTMLMediaElement::toggleTrackAtIndex): Set user prefs for captions visible and
          caption language as appropriate.
      
      * html/shadow/MediaControlElements.cpp:
      (WebCore::MediaControlClosedCaptionsTrackListElement::defaultEventHandler): Remove unneeded comment.
      (WebCore::MediaControlTextTrackContainerElement::updateSizes):  Use page()->group().captionPreferences().
      
      * html/shadow/MediaControlsApple.cpp:
      (WebCore::MediaControlsApple::closedCaptionTracksChanged): Update caption menu button visibility.
      
      * page/CaptionUserPreferences.h:
      (WebCore::CaptionUserPreferences::userPrefersCaptions): Support "testing" mode.
      (WebCore::CaptionUserPreferences::setUserPrefersCaptions): Ditto.
      (WebCore::CaptionUserPreferences::registerForPreferencesChangedCallbacks): Ditto.
      (WebCore::CaptionUserPreferences::unregisterForPreferencesChangedCallbacks): Ditto.
      (WebCore::CaptionUserPreferences::setPreferredLanguage): Ditto.
      (WebCore::CaptionUserPreferences::preferredLanguages): Ditto.
      (WebCore::CaptionUserPreferences::testingMode): Ditto.
      (WebCore::CaptionUserPreferences::setTestingMode): Ditto.
      (WebCore::CaptionUserPreferences::CaptionUserPreferences): Ditto.
      
      * page/CaptionUserPreferencesMac.h:
      * page/CaptionUserPreferencesMac.mm:
      (WebCore::CaptionUserPreferencesMac::userPrefersCaptions): Support "testing" mode.
      (WebCore::CaptionUserPreferencesMac::setUserPrefersCaptions): Ditto.
      (WebCore::CaptionUserPreferencesMac::userHasCaptionPreferences): Ditto.
      (WebCore::CaptionUserPreferencesMac::registerForPreferencesChangedCallbacks): Change name from
          registerForCaptionPreferencesChangedCallbacks. Support "testing" mode.
      (WebCore::CaptionUserPreferencesMac::unregisterForPreferencesChangedCallbacks):  Change name from
          unregisterForCaptionPreferencesChangedCallbacks. Support "testing" mode.
      (WebCore::CaptionUserPreferencesMac::captionsStyleSheetOverride): Support "testing" mode.
      (WebCore::CaptionUserPreferencesMac::captionFontSizeScale): Ditto.
      (WebCore::CaptionUserPreferencesMac::setPreferredLanguage): Ditto.
      (WebCore::CaptionUserPreferencesMac::preferredLanguages): Ditto. Return the platform override when set.
      
      * page/PageGroup.cpp:
      (WebCore::PageGroup::registerForCaptionPreferencesChangedCallbacks): Remove because it is already
          available from the caption preference object.
      (WebCore::PageGroup::unregisterForCaptionPreferencesChangedCallbacks): Ditto.
      (WebCore::PageGroup::userPrefersCaptions): Ditto.
      (WebCore::PageGroup::userHasCaptionPreferences): Ditto.
      (WebCore::PageGroup::captionFontSizeScale): Ditto.
      * page/PageGroup.h:
      
      * platform/Language.cpp:
      (WebCore::preferredLanguageFromList): Take the list of preferred languages instead of assuming
          the system list.
      * platform/Language.h:
      
      * testing/Internals.cpp:
      (WebCore::Internals::resetToConsistentState): Disable caption testing mode.
      (WebCore::Internals::Internals): Enable caption testing mode so the user's system
          preferences are not modified.
      
      LayoutTests: 
      
      * media/track/track-user-preferences-expected.txt: Added.
      * media/track/track-user-preferences.html: Added.
      
      * platform/chromium/TestExpectations: Skip new test, it depends on the track menu.
      * platform/efl/TestExpectations: Ditto.
      * platform/gtk/TestExpectations: Ditto.
      * platform/qt/TestExpectations: Ditto.
      * platform/win/TestExpectations: Ditto.
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@142580 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      b54d1c88
  10. 09 Feb, 2013 1 commit
    • eric.carlson@apple.com's avatar
      [Mac] Do not assume MediaAccessibility framework is installed · 4ef7e2a7
      eric.carlson@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=109365
      
      Reviewed by Sam Weinig.
      
      * page/CaptionUserPreferencesMac.h:
      * page/CaptionUserPreferencesMac.mm:
      (WebCore::CaptionUserPreferencesMac::userPrefersCaptions): Call the base class if the framework
          is not available.
      (WebCore::CaptionUserPreferencesMac::setUserPrefersCaptions): Ditto.
      (WebCore::CaptionUserPreferencesMac::userHasCaptionPreferences): Ditto.
      (WebCore::CaptionUserPreferencesMac::registerForCaptionPreferencesChangedCallbacks): Ditto.
      (WebCore::CaptionUserPreferencesMac::unregisterForCaptionPreferencesChangedCallbacks): Ditto.
      (WebCore::CaptionUserPreferencesMac::captionsStyleSheetOverride): Ditto.
      (WebCore::CaptionUserPreferencesMac::captionFontSizeScale): Ditto.
      (WebCore::CaptionUserPreferencesMac::setPreferredLanguage): Ditto.
      (WebCore::CaptionUserPreferencesMac::preferredLanguages): Ditto.
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@142383 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      4ef7e2a7
  11. 05 Feb, 2013 1 commit
    • 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
  12. 04 Feb, 2013 1 commit
    • eric.carlson@apple.com's avatar
      Update CaptionUserPreferences · f02a61ae
      eric.carlson@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=108783
      
      Reviewed by Dean Jackson.
      
      * html/shadow/MediaControlElements.cpp:
      (WebCore::MediaControlTextTrackContainerElement::updateSizes): Mark font size as important
          when necessary.
      * page/CaptionUserPreferences.h:
      (WebCore::CaptionUserPreferences::setUserPrefersCaptions): New, allow a port to remember that
          the user has chosen to see captions.
      (WebCore::CaptionUserPreferences::setPreferredLanguage): New, allow a port to remember the
          user's preferred caption language.
      (WebCore::CaptionUserPreferences::preferredLanguages): New, return a Vector of the user's 
          preferred caption languages.
      * page/CaptionUserPreferencesMac.h:
      * page/CaptionUserPreferencesMac.mm:
      * page/PageGroup.cpp:
      (WebCore::PageGroup::captionPreferences):
      (WebCore::PageGroup::captionFontSizeScale):
      * page/PageGroup.h:
      * platform/Language.cpp:
      (WebCore::userPreferredLanguagesOverride): New, return the user preferred languages override
          used during testing.
      * platform/Language.h:
      * platform/graphics/avfoundation/objc/InbandTextTrackPrivateAVFObjC.mm:
      (WebCore::InbandTextTrackPrivateAVFObjC::kind):
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@141790 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      f02a61ae
  13. 24 Oct, 2012 1 commit
    • eric.carlson@apple.com's avatar
      Allow ports to override text track rendering style · 68e8da75
      eric.carlson@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=97800
      <rdar://problem/12044964>
      
      Reviewed by Maciej Stachowiak.
      
      Source/WebCore:
      
      * WebCore.exp.in: Export new WebkitSystemInterface functions.
      * WebCore.xcodeproj/project.pbxproj: Add CaptionUserPreferences.h, CaptionUserPreferencesMac.mm,
          and CaptionUserPreferencesMac.h.
      
      * css/mediaControls.css: Rearrange the caption CSS so it is possible to style the cue window,
          background, and text independently.
      
      * html/HTMLMediaElement.cpp:
      (WebCore::HTMLMediaElement::HTMLMediaElement): Initialize m_disableCaptions with theme->userPrefersCaptions().
      (WebCore::HTMLMediaElement::attach): Register for caption preferences change callbacks.
      (WebCore::HTMLMediaElement::detach): Unregister for caption preferences change callbacks.
      (WebCore::HTMLMediaElement::userPrefersCaptions): Return theme->userPrefersCaptions().
      (WebCore::HTMLMediaElement::userIsInterestedInThisTrackKind): Consider userPrefersCaptions().
      (WebCore::HTMLMediaElement::setClosedCaptionsVisible): Move the code that marks all tracks as
          un-configured to markCaptionAndSubtitleTracksAsUnconfigured so it can be reused.
      (WebCore::HTMLMediaElement::captionPreferencesChanged): New, force a reevaluation of all text tracks.
      (WebCore::HTMLMediaElement::markCaptionAndSubtitleTracksAsUnconfigured): New, code moved from
          setClosedCaptionsVisible
      * html/HTMLMediaElement.h: Inherit from CaptionPreferencesChangedListener.
      
      * html/shadow/MediaControlElements.cpp:
      (WebCore::MediaControlTextTrackContainerElement::updateSizes): Get rid of unnecessary member
          variable. Get caption font scale from theme instead of hard coding.
      * html/shadow/MediaControlElements.h:
      
      * html/track/TextTrack.cpp:
      (WebCore::TextTrack::TextTrack): Change attributes from String to AtomicString.
      (WebCore::TextTrack::isValidKindKeyword): Ditto.
      (WebCore::TextTrack::setKind): Ditto.
      (WebCore::TextTrack::setMode): Ditto.
      (WebCore::TextTrack::mode): Ditto.
      * html/track/TextTrack.h:
      (WebCore::TextTrack::create): Ditto.
      (WebCore::TextTrack::kind): Ditto.
      (WebCore::TextTrack::label): Ditto.
      (WebCore::TextTrack::setLabel): Ditto.
      (WebCore::TextTrack::language): Ditto.
      (WebCore::TextTrack::setLanguage): Ditto.
      
      * html/track/TextTrackCue.cpp:
      (WebCore::TextTrackCueBox::TextTrackCueBox): Set the shadow pseudo id.
      (WebCore::TextTrackCueBox::textTrackCueBoxShadowPseudoId): New, class method to return the
          shadow pseudo id so it can be used elsewhere.
      (WebCore::TextTrackCueBox::shadowPseudoId): Call textTrackCueBoxShadowPseudoId.
      (WebCore::TextTrackCue::pastNodesShadowPseudoId): New, class method to return the
          shadow pseudo id so it can be used elsewhere.
      (WebCore::TextTrackCue::futureNodesShadowPseudoId): Ditto.
      (WebCore::TextTrackCue::updateDisplayTree):
      * html/track/TextTrackCue.h:
      
      * page/CaptionUserPreferences.h: Added.
      * page/CaptionUserPreferencesMac.h: Added.
      * page/CaptionUserPreferencesMac.mm: Added.
      (WebCore::userCaptionPreferencesChangedNotificationCallback):
      (WebCore::CaptionUserPreferencesMac::CaptionUserPreferencesMac):
      (WebCore::CaptionUserPreferencesMac::~CaptionUserPreferencesMac):
      (WebCore::CaptionUserPreferencesMac::userHasCaptionPreferences): New, passthrough to WKSI function.
      (WebCore::CaptionUserPreferencesMac::userPrefersCaptions): Ditto.
      (WebCore::CaptionUserPreferencesMac::captionsWindowColor): Return Color with user's caption window color preference.
      (WebCore::CaptionUserPreferencesMac::captionsBackgroundColor): Return Color with user's caption
          background color preference.
      (WebCore::CaptionUserPreferencesMac::captionsTextColor): Return Color with user's caption text color preference.
      (WebCore::CaptionUserPreferencesMac::captionsEdgeColorForTextColor): Return Color for text edge effect.
      (WebCore::CaptionUserPreferencesMac::cssPropertyWithTextEdgeColor): Return String with CSS to set a text-shadow
          or webkit-text-stroke property.
      (WebCore::CaptionUserPreferencesMac::cssColorProperty): Return a String with css to set a property
          with a color value.
      (WebCore::CaptionUserPreferencesMac::captionsTextEdgeStyle): Return a String with css to style caption
          text with the user's preferred text edge stye.
      (WebCore::CaptionUserPreferencesMac::captionsDefaultFont): Return a String with css to style caption
          text with the user's preferred font.
      (WebCore::CaptionUserPreferencesMac::captionsStyleSheetOverride): Return a String with css to style captions
          with the user's preferred style.
      (WebCore::CaptionUserPreferencesMac::captionFontSizeScale): Return the user's preferred caption font scale.
      (WebCore::CaptionUserPreferencesMac::captionPreferencesChanged): Notify listeners of caption preference change.
      (WebCore::CaptionUserPreferencesMac::registerForCaptionPreferencesChangedCallbacks): Add a caption preferences
          changes listener.
      (WebCore::CaptionUserPreferencesMac::unregisterForCaptionPreferencesChangedCallbacks): Remove a caption preferences
          changes listener.
      (WebCore::CaptionUserPreferencesMac::updateCaptionStyleSheetOveride): New, if theme has a captions style sheet override,
          inject it into the current page group, otherwise remove injected sheet.
      
      * page/PageGroup.cpp:
      (WebCore::PageGroup::captionPreferences):
      (WebCore::PageGroup::registerForCaptionPreferencesChangedCallbacks): New, passthrough to platform specific function
          of the same name.
      (WebCore::PageGroup::unregisterForCaptionPreferencesChangedCallbacks): Ditto.
      (WebCore::PageGroup::userPrefersCaptions): Ditto.
      (WebCore::PageGroup::userHasCaptionPreferences): Ditto.
      (WebCore::PageGroup::captionFontSizeScale): Ditto.
      * page/PageGroup.h:
      
      * platform/mac/WebCoreSystemInterface.h: Updated.
      * platform/mac/WebCoreSystemInterface.mm: Ditto.
      
      Source/WebKit/mac:
      
      * WebCoreSupport/WebSystemInterface.mm:
      (InitWebCoreSystemInterface): Initialize new WKSI function pointers.
      
      Source/WebKit2:
      
      * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
      (InitWebCoreSystemInterface): Initialize new WKSI function pointers.
      
      WebKitLibraries:
      
      Update WKSI header with SPI for getting the user caption appearance preferences.
      
      * WebKitSystemInterface.h:
      
      LayoutTests:
      
      * media/track/track-cue-rendering-expected.txt: Update results for caption css changes.
      * media/track/track-cue-rendering.html:
      * platform/chromium/TestExpectations: Skip tests that need to be rebaselined.
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@132349 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      68e8da75