Title: [280129] trunk/Source
Revision
280129
Author
[email protected]
Date
2021-07-21 05:57:20 -0700 (Wed, 21 Jul 2021)

Log Message

GetIdentifierStringForPreferredVoiceInListWithLocale() is deprecated in Monterey
<https://webkit.org/b/228066>
<rdar://problem/80577312>

Reviewed by Alexey Proskuryakov.

Source/WebCore:

* platform/mac/PlatformSpeechSynthesizerMac.mm:
(WebCore::speechSynthesisGetDefaultVoiceIdentifierForLocale):
- Switch to use
  CopyIdentifierStringForPreferredVoiceInListWithLocale()
  in Monterey.
- Change to return RetainPtr<> to handle lifetime of
  object returned from new function.
(WebCore::PlatformSpeechSynthesizer::initializeVoiceList):
- Change varible type to 'auto' since return type of
  speechSynthesisGetDefaultVoiceIdentifierForLocale()
  changed.

Source/WebCore/PAL:

* pal/spi/mac/SpeechSynthesisSPI.h:
(CopyIdentifierStringForPreferredVoiceInListWithLocale): Add.
- Define replacement function for
  GetIdentifierStringForPreferredVoiceInListWithLocale()
  in Monterey.

Source/WTF:

* wtf/PlatformHave.h:
- Add HAVE(SPEECHSYNTHESIS_MONTEREY_SPI).

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (280128 => 280129)


--- trunk/Source/WTF/ChangeLog	2021-07-21 11:51:18 UTC (rev 280128)
+++ trunk/Source/WTF/ChangeLog	2021-07-21 12:57:20 UTC (rev 280129)
@@ -1,3 +1,14 @@
+2021-07-21  David Kilzer  <[email protected]>
+
+        GetIdentifierStringForPreferredVoiceInListWithLocale() is deprecated in Monterey
+        <https://webkit.org/b/228066>
+        <rdar://problem/80577312>
+
+        Reviewed by Alexey Proskuryakov.
+
+        * wtf/PlatformHave.h:
+        - Add HAVE(SPEECHSYNTHESIS_MONTEREY_SPI).
+
 2021-07-20  Myles C. Maxfield  <[email protected]>
 
         r280103 is not necessary on all operating systems

Modified: trunk/Source/WTF/wtf/PlatformHave.h (280128 => 280129)


--- trunk/Source/WTF/wtf/PlatformHave.h	2021-07-21 11:51:18 UTC (rev 280128)
+++ trunk/Source/WTF/wtf/PlatformHave.h	2021-07-21 12:57:20 UTC (rev 280129)
@@ -850,6 +850,12 @@
 #endif
 #endif
 
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 120000
+#if !defined(HAVE_SPEECHSYNTHESIS_MONTEREY_SPI)
+#define HAVE_SPEECHSYNTHESIS_MONTEREY_SPI 1
+#endif
+#endif
+
 #if PLATFORM(COCOA)
 #if !defined(HAVE_CG_CONTEXT_DRAW_PATH_DIRECT)
 #define HAVE_CG_CONTEXT_DRAW_PATH_DIRECT 1

Modified: trunk/Source/WebCore/ChangeLog (280128 => 280129)


--- trunk/Source/WebCore/ChangeLog	2021-07-21 11:51:18 UTC (rev 280128)
+++ trunk/Source/WebCore/ChangeLog	2021-07-21 12:57:20 UTC (rev 280129)
@@ -1,3 +1,23 @@
+2021-07-21  David Kilzer  <[email protected]>
+
+        GetIdentifierStringForPreferredVoiceInListWithLocale() is deprecated in Monterey
+        <https://webkit.org/b/228066>
+        <rdar://problem/80577312>
+
+        Reviewed by Alexey Proskuryakov.
+
+        * platform/mac/PlatformSpeechSynthesizerMac.mm:
+        (WebCore::speechSynthesisGetDefaultVoiceIdentifierForLocale):
+        - Switch to use
+          CopyIdentifierStringForPreferredVoiceInListWithLocale()
+          in Monterey.
+        - Change to return RetainPtr<> to handle lifetime of
+          object returned from new function.
+        (WebCore::PlatformSpeechSynthesizer::initializeVoiceList):
+        - Change varible type to 'auto' since return type of
+          speechSynthesisGetDefaultVoiceIdentifierForLocale()
+          changed.
+
 2021-07-20  Myles C. Maxfield  <[email protected]>
 
         r280103 is not necessary on all operating systems

Modified: trunk/Source/WebCore/PAL/ChangeLog (280128 => 280129)


--- trunk/Source/WebCore/PAL/ChangeLog	2021-07-21 11:51:18 UTC (rev 280128)
+++ trunk/Source/WebCore/PAL/ChangeLog	2021-07-21 12:57:20 UTC (rev 280129)
@@ -1,3 +1,17 @@
+2021-07-21  David Kilzer  <[email protected]>
+
+        GetIdentifierStringForPreferredVoiceInListWithLocale() is deprecated in Monterey
+        <https://webkit.org/b/228066>
+        <rdar://problem/80577312>
+
+        Reviewed by Alexey Proskuryakov.
+
+        * pal/spi/mac/SpeechSynthesisSPI.h:
+        (CopyIdentifierStringForPreferredVoiceInListWithLocale): Add.
+        - Define replacement function for
+          GetIdentifierStringForPreferredVoiceInListWithLocale()
+          in Monterey.
+
 2021-07-16  Alex Christensen  <[email protected]>
 
         Prevent HSTS tracking mitigation for top level navigation requests

Modified: trunk/Source/WebCore/PAL/pal/spi/mac/SpeechSynthesisSPI.h (280128 => 280129)


--- trunk/Source/WebCore/PAL/pal/spi/mac/SpeechSynthesisSPI.h	2021-07-21 11:51:18 UTC (rev 280128)
+++ trunk/Source/WebCore/PAL/pal/spi/mac/SpeechSynthesisSPI.h	2021-07-21 12:57:20 UTC (rev 280129)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2017 Apple Inc. All rights reserved.
+ * Copyright (C) 2017-2021 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -34,6 +34,10 @@
 WTF_EXTERN_C_BEGIN
 
 CFArrayRef CopySpeechSynthesisVoicesForMode(CFTypeRef mode);
+#if HAVE(SPEECHSYNTHESIS_MONTEREY_SPI)
+CFStringRef CopyIdentifierStringForPreferredVoiceInListWithLocale(CFArrayRef voices, CFLocaleRef);
+#else
 CFStringRef GetIdentifierStringForPreferredVoiceInListWithLocale(CFArrayRef voices, CFLocaleRef);
+#endif
 
 WTF_EXTERN_C_END

Modified: trunk/Source/WebCore/platform/mac/PlatformSpeechSynthesizerMac.mm (280128 => 280129)


--- trunk/Source/WebCore/platform/mac/PlatformSpeechSynthesizerMac.mm	2021-07-21 11:51:18 UTC (rev 280128)
+++ trunk/Source/WebCore/platform/mac/PlatformSpeechSynthesizerMac.mm	2021-07-21 12:57:20 UTC (rev 280129)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 Apple Inc.  All rights reserved.
+ * Copyright (C) 2013-2021 Apple Inc.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -222,15 +222,16 @@
     return adoptCF(CopySpeechSynthesisVoicesForMode((__bridge CFArrayRef)@[ @"VoiceGroupDefault", @"VoiceGroupCompact" ]));
 }
 
-static NSString *speechSynthesisGetDefaultVoiceIdentifierForLocale(NSLocale *userLocale)
+static RetainPtr<CFStringRef> speechSynthesisGetDefaultVoiceIdentifierForLocale(NSLocale *userLocale)
 {
     if (!userLocale)
         return nil;
 
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wdeprecated-declarations"
-    return (__bridge NSString *)GetIdentifierStringForPreferredVoiceInListWithLocale(speechSynthesisGetVoiceIdentifiers().get(), (__bridge CFLocaleRef)userLocale);
-#pragma clang diagnostic pop
+#if HAVE(SPEECHSYNTHESIS_MONTEREY_SPI)
+    return adoptCF(CopyIdentifierStringForPreferredVoiceInListWithLocale(speechSynthesisGetVoiceIdentifiers().get(), (__bridge CFLocaleRef)userLocale));
+#else
+    return GetIdentifierStringForPreferredVoiceInListWithLocale(speechSynthesisGetVoiceIdentifiers().get(), (__bridge CFLocaleRef)userLocale);
+#endif
 }
 
 void PlatformSpeechSynthesizer::initializeVoiceList()
@@ -244,12 +245,12 @@
         NSString *voiceURI = [attributes objectForKey:NSVoiceIdentifier];
         NSString *name = [attributes objectForKey:NSVoiceName];
         NSString *language = [attributes objectForKey:NSVoiceLocaleIdentifier];
-        NSString *defaultVoiceURI = speechSynthesisGetDefaultVoiceIdentifierForLocale(adoptNS([[NSLocale alloc] initWithLocaleIdentifier:language]).get());
+        auto defaultVoiceURI = speechSynthesisGetDefaultVoiceIdentifierForLocale(adoptNS([[NSLocale alloc] initWithLocaleIdentifier:language]).get());
 
         // Change to BCP-47 format as defined by spec.
         language = [language stringByReplacingOccurrencesOfString:@"_" withString:@"-"];
 
-        bool isDefault = [defaultVoiceURI isEqualToString:voiceURI];
+        bool isDefault = [(__bridge NSString *)defaultVoiceURI.get() isEqualToString:voiceURI];
 
         m_voiceList.append(PlatformSpeechSynthesisVoice::create(voiceURI, name, language, true, isDefault));
     }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to