Changeset 148907 in webkit


Ignore:
Timestamp:
Apr 22, 2013 1:29:58 PM (11 years ago)
Author:
eric.carlson@apple.com
Message:

[Mac] "automatic" track selection should only select a track that matches user language
https://bugs.webkit.org/show_bug.cgi?id=114976

Reviewed by Jer Noble.

Source/WebCore:

Test: media/track/track-automatic-subtitles.html

  • page/CaptionUserPreferencesMac.mm:

(WebCore::CaptionUserPreferencesMac::textTrackSelectionScore): When in "automatic" mode, only

consider text tracks that match the user's preferred language when the primary audio track
does not.

LayoutTests:

  • media/track/track-automatic-subtitles-expected.txt: Added.
  • media/track/track-automatic-subtitles.html: Added.
  • platform/mac/TestExpectations: Skip track-user-preferences.html, the logic is no longer

correct for the Mac port.

Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r148898 r148907  
     12013-04-22  Eric Carlson  <eric.carlson@apple.com>
     2
     3        [Mac] "automatic" track selection should only select a track that matches user language
     4        https://bugs.webkit.org/show_bug.cgi?id=114976
     5
     6        Reviewed by Jer Noble.
     7
     8        * media/track/track-automatic-subtitles-expected.txt: Added.
     9        * media/track/track-automatic-subtitles.html: Added.
     10        * platform/mac/TestExpectations: Skip track-user-preferences.html, the logic is no longer
     11             correct for the Mac port.
     12
    1132013-04-22  Andy Estes  <aestes@apple.com>
    214
  • trunk/LayoutTests/platform/mac/TestExpectations

    r148722 r148907  
    13681368webkit.org/b/112492 media/track/track-prefer-captions.html [ Failure Pass ]
    13691369
     1370# The logic in this test is no longer correct for Apple ports
     1371webkit.org/b/112492 media/track/track-user-preferences.html [ Skip ]
     1372
    13701373webkit.org/b/104104 fast/overflow/scrollbar-click-retains-focus.html [ Failure ]
    13711374
  • trunk/Source/WebCore/ChangeLog

    r148906 r148907  
     12013-04-22  Eric Carlson  <eric.carlson@apple.com>
     2
     3        [Mac] "automatic" track selection should only select a track that matches user language
     4        https://bugs.webkit.org/show_bug.cgi?id=114976
     5
     6        Reviewed by Jer Noble.
     7
     8        Test: media/track/track-automatic-subtitles.html
     9
     10        * page/CaptionUserPreferencesMac.mm:
     11        (WebCore::CaptionUserPreferencesMac::textTrackSelectionScore): When in "automatic" mode, only
     12            consider text tracks that match the user's preferred language when the primary audio track
     13            does not.
     14
    1152013-04-22  Jer Noble  <jer.noble@apple.com>
    216
  • trunk/Source/WebCore/page/CaptionUserPreferencesMac.mm

    r148285 r148907  
    636636            return 0;
    637637
    638         String audioTrackLanguage;
     638        String textTrackLanguage = track->language();
     639        if (textTrackLanguage.isEmpty())
     640            return 0;
    639641
    640642        Vector<String> languageList;
    641643        languageList.reserveCapacity(1);
    642644
     645        String audioTrackLanguage;
    643646        if (testingMode())
    644647            audioTrackLanguage = primaryAudioTrackLanguageOverride();
     
    650653
    651654        if (displayMode == Automatic) {
    652             // Only enable a text track if the current audio track is not in the user's preferred language.
    653655            languageList.append(defaultLanguage());
     656
     657            // Only enable a text track if the current audio track is NOT in the user's preferred language ...
    654658            size_t offset = indexOfBestMatchingLanguageInList(audioTrackLanguage, languageList);
     659            if (!offset)
     660                return 0;
     661
     662            // and the text track matches the user's preferred language.
     663            offset = indexOfBestMatchingLanguageInList(textTrackLanguage, languageList);
    655664            if (offset)
    656665                return 0;
    657666        } else {
    658             // Only consider a forced-only track if it is in the same language as the primary audio track.
    659             String trackLanguage = track->language();
    660             if (trackLanguage.isEmpty())
    661                 return 0;
    662 
    663667            languageList.append(audioTrackLanguage);
    664             size_t offset = indexOfBestMatchingLanguageInList(trackLanguage, languageList);
     668            size_t offset = indexOfBestMatchingLanguageInList(textTrackLanguage, languageList);
     669
     670            // Only consider a forced-only track if it IS in the same language as the primary audio track.
    665671            if (offset)
    666672                return 0;
Note: See TracChangeset for help on using the changeset viewer.