[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 [Mac] Text track menu items sometimes labeled incorrectly
https://bugs.webkit.org/show_bug.cgi?id=113413 https://bugs.webkit.org/show_bug.cgi?id=113406
Reviewed by Ryosuke Niwa. Reviewed by Jer Noble.
Updated the test to include the case of inserting a whitespace
both in the middle or at the end of a line.
* editing/execCommand/overtype-expected.txt: * media/video-controls-captions-trackmenu-localized.html:
* editing/execCommand/overtype.html: * platform/mac/media/video-controls-captions-trackmenu-localized-expected.txt:
2013-03-27 Zan Dobersek <zdobersek@igalia.com> 2013-03-27 Zan Dobersek <zdobersek@igalia.com>
...@@ -44,12 +44,12 @@ ...@@ -44,12 +44,12 @@
testExpected("item.textContent", "English CC"); testExpected("item.textContent", "English CC");
item = captionsEntries[2]; item = captionsEntries[2];
consoleWrite("<br>Third item in captions menu should be labelled 'Unknown SDH'"); consoleWrite("<br>Third item in captions menu should be labelled 'Laugh Track (English-United States)'");
testExpected("item.textContent", "Unknown SDH"); testExpected("item.textContent", "Laugh Track (English-United States)");
item = captionsEntries[3]; item = captionsEntries[3];
consoleWrite("<br>Fourth item in captions menu should be labelled 'Unknown'"); consoleWrite("<br>Fourth item in captions menu should be labelled 'Unknown SDH'");
testExpected("item.textContent", "Unknown"); testExpected("item.textContent", "Unknown SDH");
endTest(); endTest();
} }
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
<p>Test that captions and subtitles menu items are localized.</p> <p>Test that captions and subtitles menu items are localized.</p>
<video width="500" height="300" controls> <video width="500" height="300" controls>
<track kind="captions" src="track/captions-webvtt/captions-fast.vtt"> <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> </video>
</body> </body>
</html> </html>
......
...@@ -11,12 +11,12 @@ First item in captions menu should be labelled 'Off' ...@@ -11,12 +11,12 @@ First item in captions menu should be labelled 'Off'
EXPECTED (item.textContent == 'Off') OK EXPECTED (item.textContent == 'Off') OK
Second item in captions menu should be labelled 'English CC' 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' Third item in captions menu should be labelled 'Laugh Track (English-United States)'
EXPECTED (item.textContent == 'Unknown SDH'), OBSERVED 'Unknown' FAIL 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') TypeError: 'undefined' is not an object (evaluating 'item.textContent')
END OF TEST 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> 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 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) ...@@ -536,7 +536,9 @@ static String trackDisplayName(TextTrack* track)
RetainPtr<CFStringRef> languageCF(AdoptCF, CFLocaleCopyDisplayNameForPropertyValue(currentLocale.get(), kCFLocaleLanguageCode, localeIdentifier.get())); RetainPtr<CFStringRef> languageCF(AdoptCF, CFLocaleCopyDisplayNameForPropertyValue(currentLocale.get(), kCFLocaleLanguageCode, localeIdentifier.get()));
String language = languageCF.get(); String language = languageCF.get();
if (!label.isEmpty()) { 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())); RetainPtr<CFDictionaryRef> localeDict(AdoptCF, CFLocaleCreateComponentsFromLocaleIdentifier(kCFAllocatorDefault, localeIdentifier.get()));
if (localeDict) { if (localeDict) {
CFStringRef countryCode = 0; 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