Title: [149342] trunk/Source
Revision
149342
Author
[email protected]
Date
2013-04-29 17:46:42 -0700 (Mon, 29 Apr 2013)

Log Message

WEB SPEECH: need to identify the default voice per language
https://bugs.webkit.org/show_bug.cgi?id=115366

Reviewed by Tim Horton.

Source/WebCore: 

Use a WKSystemInterface method to determine which voice per language is the default voice.

When looking for a voice, there may not be a default at all, so we need to search until we
find a default.

* WebCore.exp.in:
* platform/mac/PlatformSpeechSynthesizerMac.mm:
(-[WebSpeechSynthesisWrapper speakUtterance:WebCore::]):
(WebCore::PlatformSpeechSynthesizer::initializeVoiceList):
* platform/mac/WebCoreSystemInterface.h:
* platform/mac/WebCoreSystemInterface.mm:

Source/WebKit/mac: 

* WebCoreSupport/WebSystemInterface.mm:
(InitWebCoreSystemInterface):

Source/WebKit2: 

* WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
(InitWebCoreSystemInterface):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (149341 => 149342)


--- trunk/Source/WebCore/ChangeLog	2013-04-30 00:46:14 UTC (rev 149341)
+++ trunk/Source/WebCore/ChangeLog	2013-04-30 00:46:42 UTC (rev 149342)
@@ -1,3 +1,22 @@
+2013-04-29  Chris Fleizach  <[email protected]>
+
+        WEB SPEECH: need to identify the default voice per language
+        https://bugs.webkit.org/show_bug.cgi?id=115366
+
+        Reviewed by Tim Horton.
+
+        Use a WKSystemInterface method to determine which voice per language is the default voice.
+
+        When looking for a voice, there may not be a default at all, so we need to search until we
+        find a default.
+
+        * WebCore.exp.in:
+        * platform/mac/PlatformSpeechSynthesizerMac.mm:
+        (-[WebSpeechSynthesisWrapper speakUtterance:WebCore::]):
+        (WebCore::PlatformSpeechSynthesizer::initializeVoiceList):
+        * platform/mac/WebCoreSystemInterface.h:
+        * platform/mac/WebCoreSystemInterface.mm:
+
 2013-04-29  James Craig  <[email protected]>
 
         Settings.in selectionIncludesAltImageText should default to true, due to update in HTML spec.

Modified: trunk/Source/WebCore/WebCore.exp.in (149341 => 149342)


--- trunk/Source/WebCore/WebCore.exp.in	2013-04-30 00:46:14 UTC (rev 149341)
+++ trunk/Source/WebCore/WebCore.exp.in	2013-04-30 00:46:42 UTC (rev 149342)
@@ -1946,6 +1946,7 @@
 _wkSetDragImage
 _wkSetMetadataURL
 _wkSignedPublicKeyAndChallengeString
+_wkSpeechSynthesisGetDefaultVoiceIdentifierForLocale
 _wkSpeechSynthesisGetVoiceIdentifiers
 _wkUnregisterUniqueIdForElement
 _wkWindowSetAlpha

Modified: trunk/Source/WebCore/platform/mac/PlatformSpeechSynthesizerMac.mm (149341 => 149342)


--- trunk/Source/WebCore/platform/mac/PlatformSpeechSynthesizerMac.mm	2013-04-30 00:46:14 UTC (rev 149341)
+++ trunk/Source/WebCore/platform/mac/PlatformSpeechSynthesizerMac.mm	2013-04-30 00:46:42 UTC (rev 149342)
@@ -106,7 +106,8 @@
         for (size_t k = 0; k < voiceListSize; k++) {
             if (equalIgnoringCase(utterance->lang(), voiceList[k]->lang())) {
                 utteranceVoice = voiceList[k].get();
-                break;
+                if (voiceList[k]->isDefault())
+                    break;
             }
         }
     }
@@ -210,7 +211,6 @@
 
 void PlatformSpeechSynthesizer::initializeVoiceList()
 {
-    NSString *defaultVoiceURI = [NSSpeechSynthesizer defaultVoice];
     NSArray *availableVoices = wkSpeechSynthesisGetVoiceIdentifiers();
     NSUInteger count = [availableVoices count];
     for (NSUInteger k = 0; k < count; k++) {
@@ -220,6 +220,9 @@
         NSString *voiceURI = [attributes objectForKey:NSVoiceIdentifier];
         NSString *name = [attributes objectForKey:NSVoiceName];
         NSString *language = [attributes objectForKey:NSVoiceLocaleIdentifier];
+        NSLocale *locale = [[NSLocale alloc] initWithLocaleIdentifier:language];
+        NSString *defaultVoiceURI = wkSpeechSynthesisGetDefaultVoiceIdentifierForLocale(locale);
+        [locale release];
         
         // Change to BCP-47 format as defined by spec.
         language = [language stringByReplacingOccurrencesOfString:@"_" withString:@"-"];

Modified: trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.h (149341 => 149342)


--- trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.h	2013-04-30 00:46:14 UTC (rev 149341)
+++ trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.h	2013-04-30 00:46:42 UTC (rev 149342)
@@ -91,6 +91,7 @@
 OBJC_CLASS NSFont;
 OBJC_CLASS NSHTTPCookie;
 OBJC_CLASS NSImage;
+OBJC_CLASS NSLocale;
 OBJC_CLASS NSMenu;
 OBJC_CLASS NSMutableURLRequest;
 OBJC_CLASS NSString;
@@ -276,6 +277,7 @@
     
 #if PLATFORM(MAC)
 extern NSArray *(*wkSpeechSynthesisGetVoiceIdentifiers)(void);
+extern NSString *(*wkSpeechSynthesisGetDefaultVoiceIdentifierForLocale)(NSLocale *);
 #endif
 
 extern void (*wkUnregisterUniqueIdForElement)(id element);

Modified: trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.mm (149341 => 149342)


--- trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.mm	2013-04-30 00:46:14 UTC (rev 149341)
+++ trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.mm	2013-04-30 00:46:42 UTC (rev 149342)
@@ -166,6 +166,7 @@
 
 #if PLATFORM(MAC)
 NSArray *(*wkSpeechSynthesisGetVoiceIdentifiers)(void);
+NSString *(*wkSpeechSynthesisGetDefaultVoiceIdentifierForLocale)(NSLocale *);
 #endif
 
 void (*wkUnregisterUniqueIdForElement)(id element);

Modified: trunk/Source/WebKit/mac/ChangeLog (149341 => 149342)


--- trunk/Source/WebKit/mac/ChangeLog	2013-04-30 00:46:14 UTC (rev 149341)
+++ trunk/Source/WebKit/mac/ChangeLog	2013-04-30 00:46:42 UTC (rev 149342)
@@ -1,3 +1,13 @@
+2013-04-29  Chris Fleizach  <[email protected]>
+
+        WEB SPEECH: need to identify the default voice per language
+        https://bugs.webkit.org/show_bug.cgi?id=115366
+
+        Reviewed by Tim Horton.
+
+        * WebCoreSupport/WebSystemInterface.mm:
+        (InitWebCoreSystemInterface):
+
 2013-04-28  Dean Jackson  <[email protected]>
 
         [Mac] Disable canvas backing store scaling (HIGH_DPI_CANVAS)

Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm (149341 => 149342)


--- trunk/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm	2013-04-30 00:46:14 UTC (rev 149341)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm	2013-04-30 00:46:42 UTC (rev 149342)
@@ -156,6 +156,7 @@
 
 #if PLATFORM(MAC)
     INIT(SpeechSynthesisGetVoiceIdentifiers);
+    INIT(SpeechSynthesisGetDefaultVoiceIdentifierForLocale);
 #endif
     INIT(GetAXTextMarkerTypeID);
     INIT(GetAXTextMarkerRangeTypeID);

Modified: trunk/Source/WebKit2/ChangeLog (149341 => 149342)


--- trunk/Source/WebKit2/ChangeLog	2013-04-30 00:46:14 UTC (rev 149341)
+++ trunk/Source/WebKit2/ChangeLog	2013-04-30 00:46:42 UTC (rev 149342)
@@ -1,3 +1,13 @@
+2013-04-29  Chris Fleizach  <[email protected]>
+
+        WEB SPEECH: need to identify the default voice per language
+        https://bugs.webkit.org/show_bug.cgi?id=115366
+
+        Reviewed by Tim Horton.
+
+        * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
+        (InitWebCoreSystemInterface):
+
 2013-04-29  Benjamin Poulain  <[email protected]>
 
         [WK2] Streamline the use of strings in WebProcess::getWebCoreStatistics

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm (149341 => 149342)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm	2013-04-30 00:46:14 UTC (rev 149341)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm	2013-04-30 00:46:42 UTC (rev 149342)
@@ -144,6 +144,7 @@
 
 #if PLATFORM(MAC)
         INIT(SpeechSynthesisGetVoiceIdentifiers);
+        INIT(SpeechSynthesisGetDefaultVoiceIdentifierForLocale);
 #endif
         INIT(GetAXTextMarkerTypeID);
         INIT(GetAXTextMarkerRangeTypeID);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to