[Mac] Text track menu items sometimes labeled incorrectly

https://bugs.webkit.org/show_bug.cgi?id=113406

Reviewed by Jer Noble.

Source/WebCore: 

media/video-controls-captions-trackmenu-localized.html was updated to test this.

* page/CaptionUserPreferencesMac.mm:
(WebCore::trackDisplayName): Use the 'label' attribute for the menu text when necessary.

LayoutTests: 

* 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@147000 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 147de161
2013-03-27 Sergio Villar Senin <svillar@igalia.com>
2013-03-27 Eric Carlson <eric.carlson@apple.com>
Inserting a blank (" ") at the end of a line does not insert anything in Overtype mode
https://bugs.webkit.org/show_bug.cgi?id=113413
[Mac] Text track menu items sometimes labeled incorrectly
https://bugs.webkit.org/show_bug.cgi?id=113406
Reviewed by Ryosuke Niwa.
Updated the test to include the case of inserting a whitespace
both in the middle or at the end of a line.
Reviewed by Jer Noble.
* editing/execCommand/overtype-expected.txt:
* editing/execCommand/overtype.html:
* media/video-controls-captions-trackmenu-localized.html:
* platform/mac/media/video-controls-captions-trackmenu-localized-expected.txt:
2013-03-27 Zan Dobersek <zdobersek@igalia.com>
......@@ -44,12 +44,12 @@
testExpected("item.textContent", "English CC");
item = captionsEntries[2];
consoleWrite("<br>Third item in captions menu should be labelled 'Unknown SDH'");
testExpected("item.textContent", "Unknown SDH");
consoleWrite("<br>Third item in captions menu should be labelled 'Laugh Track (English-United States)'");
testExpected("item.textContent", "Laugh Track (English-United States)");
item = captionsEntries[3];
consoleWrite("<br>Fourth item in captions menu should be labelled 'Unknown'");
testExpected("item.textContent", "Unknown");
consoleWrite("<br>Fourth item in captions menu should be labelled 'Unknown SDH'");
testExpected("item.textContent", "Unknown SDH");
endTest();
}
......@@ -67,7 +67,7 @@
<p>Test that captions and subtitles menu items are localized.</p>
<video width="500" height="300" controls>
<track kind="captions" src="track/captions-webvtt/captions-fast.vtt">
<track kind="subtitles" src="track/captions-webvtt/captions-fast.vtt">
<track kind="subtitles" src="track/captions-webvtt/captions-fast.vtt" label="Laugh Track" srclang="en-US">
</video>
</body>
</html>
......
......@@ -11,12 +11,12 @@ First item in captions menu should be labelled 'Off'
EXPECTED (item.textContent == 'Off') OK
Second item in captions menu should be labelled 'English CC'
EXPECTED (item.textContent == 'English CC'), OBSERVED 'Unknown SDH' FAIL
EXPECTED (item.textContent == 'English CC'), OBSERVED 'Laugh Track (English-United States)' FAIL
Third item in captions menu should be labelled 'Unknown SDH'
EXPECTED (item.textContent == 'Unknown SDH'), OBSERVED 'Unknown' FAIL
Third item in captions menu should be labelled 'Laugh Track (English-United States)'
EXPECTED (item.textContent == 'Laugh Track (English-United States)'), OBSERVED 'Unknown SDH' FAIL
Fourth item in captions menu should be labelled 'Unknown'
Fourth item in captions menu should be labelled 'Unknown SDH'
TypeError: 'undefined' is not an object (evaluating 'item.textContent')
END OF TEST
2013-03-27 Eric Carlson <eric.carlson@apple.com>
[Mac] Text track menu items sometimes labeled incorrectly
https://bugs.webkit.org/show_bug.cgi?id=113406
Reviewed by Jer Noble.
media/video-controls-captions-trackmenu-localized.html was updated to test this.
* page/CaptionUserPreferencesMac.mm:
(WebCore::trackDisplayName): Use the 'label' attribute for the menu text when necessary.
2013-03-27 Sergio Villar Senin <svillar@igalia.com>
Inserting a blank (" ") at the end of a line does not insert anything in Overtype mode
......@@ -536,7 +536,9 @@ static String trackDisplayName(TextTrack* track)
RetainPtr<CFStringRef> 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 {
RetainPtr<CFDictionaryRef> localeDict(AdoptCF, CFLocaleCreateComponentsFromLocaleIdentifier(kCFAllocatorDefault, localeIdentifier.get()));
if (localeDict) {
CFStringRef countryCode = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment