⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 284742 in webkit


Ignore:
Timestamp:
Oct 23, 2021, 12:46:34 AM (5 years ago)
Author:
Chris Fleizach
Message:

AX: Unify speech synthesizer platform usage for Mac/iOS
https://bugs.webkit.org/show_bug.cgi?id=231895
<rdar://problem/84372479>

Reviewed by Andres Gonzalez.

Source/WebCore:

AVSpeechSynthesizer has been fully supported on macOS for a number of years. This allows us to unify platform usage.

  • SourcesCocoa.txt:
  • WebCore.xcodeproj/project.pbxproj:
  • platform/cocoa/PlatformSpeechSynthesizerCocoa.mm: Renamed from Source/WebCore/platform/ios/PlatformSpeechSynthesizerIOS.mm.

(getAVSpeechUtteranceDefaultSpeechRate):
(getAVSpeechUtteranceMaximumSpeechRate):
(-[WebSpeechSynthesisWrapper initWithSpeechSynthesizer:]):
(-[WebSpeechSynthesisWrapper mapSpeechRateToPlatformRate:]):
(-[WebSpeechSynthesisWrapper speakUtterance:]):
(-[WebSpeechSynthesisWrapper pause]):
(-[WebSpeechSynthesisWrapper resume]):
(-[WebSpeechSynthesisWrapper cancel]):
(-[WebSpeechSynthesisWrapper speechSynthesizer:didStartSpeechUtterance:]):
(-[WebSpeechSynthesisWrapper speechSynthesizer:didFinishSpeechUtterance:]):
(-[WebSpeechSynthesisWrapper speechSynthesizer:didPauseSpeechUtterance:]):
(-[WebSpeechSynthesisWrapper speechSynthesizer:didContinueSpeechUtterance:]):
(-[WebSpeechSynthesisWrapper speechSynthesizer:didCancelSpeechUtterance:]):
(-[WebSpeechSynthesisWrapper speechSynthesizer:willSpeakRangeOfSpeechString:utterance:]):
(WebCore::PlatformSpeechSynthesizer::PlatformSpeechSynthesizer):
(WebCore::PlatformSpeechSynthesizer::~PlatformSpeechSynthesizer):
(WebCore::PlatformSpeechSynthesizer::initializeVoiceList):
(WebCore::PlatformSpeechSynthesizer::pause):
(WebCore::PlatformSpeechSynthesizer::resume):
(WebCore::PlatformSpeechSynthesizer::speak):
(WebCore::PlatformSpeechSynthesizer::cancel):
(WebCore::PlatformSpeechSynthesizer::resetState):

  • platform/mac/PlatformSpeechSynthesizerMac.mm: Removed.

Source/WebCore/PAL:

  • PAL.xcodeproj/project.pbxproj:
  • pal/cocoa/AVFoundationSoftLink.h:
  • pal/cocoa/AVFoundationSoftLink.mm:
  • pal/spi/cocoa/AXSpeechManagerSPI.h:
  • pal/spi/mac/SpeechSynthesisSPI.h: Removed.

Source/WTF:

  • wtf/PlatformHave.h:
Location:
trunk/Source
Files:
2 deleted
10 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r284725 r284742  
     12021-10-23  Chris Fleizach  <cfleizach@apple.com>
     2
     3        AX: Unify speech synthesizer platform usage for Mac/iOS
     4        https://bugs.webkit.org/show_bug.cgi?id=231895
     5        <rdar://problem/84372479>
     6
     7        Reviewed by Andres Gonzalez.
     8
     9        * wtf/PlatformHave.h:
     10
    1112021-10-22  Joonghun Park  <pjh0718@gmail.com>
    212
  • trunk/Source/WTF/wtf/PlatformHave.h

    r284439 r284742  
    761761#endif
    762762
    763 #if (PLATFORM(IOS) || PLATFORM(MACCATALYST)) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 140300
     763#if ((PLATFORM(IOS) || PLATFORM(MACCATALYST)) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 140300) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED > 120000)
    764764#if !defined(HAVE_AVSPEECHSYNTHESIS_SYSTEMVOICE)
    765765#define HAVE_AVSPEECHSYNTHESIS_SYSTEMVOICE 1
     
    770770#if !defined(HAVE_TCC_IOS_14_BIG_SUR_SPI)
    771771#define HAVE_TCC_IOS_14_BIG_SUR_SPI 1
    772 #endif
    773 #endif
    774 
    775 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 120000
    776 #if !defined(HAVE_SPEECHSYNTHESIS_MONTEREY_SPI)
    777 #define HAVE_SPEECHSYNTHESIS_MONTEREY_SPI 1
    778772#endif
    779773#endif
  • trunk/Source/WebCore/ChangeLog

    r284741 r284742  
     12021-10-23  Chris Fleizach  <cfleizach@apple.com>
     2
     3        AX: Unify speech synthesizer platform usage for Mac/iOS
     4        https://bugs.webkit.org/show_bug.cgi?id=231895
     5        <rdar://problem/84372479>
     6
     7        Reviewed by Andres Gonzalez.
     8
     9        AVSpeechSynthesizer has been fully supported on macOS for a number of years. This allows us to unify platform usage.
     10
     11        * SourcesCocoa.txt:
     12        * WebCore.xcodeproj/project.pbxproj:
     13        * platform/cocoa/PlatformSpeechSynthesizerCocoa.mm: Renamed from Source/WebCore/platform/ios/PlatformSpeechSynthesizerIOS.mm.
     14        (getAVSpeechUtteranceDefaultSpeechRate):
     15        (getAVSpeechUtteranceMaximumSpeechRate):
     16        (-[WebSpeechSynthesisWrapper initWithSpeechSynthesizer:]):
     17        (-[WebSpeechSynthesisWrapper mapSpeechRateToPlatformRate:]):
     18        (-[WebSpeechSynthesisWrapper speakUtterance:]):
     19        (-[WebSpeechSynthesisWrapper pause]):
     20        (-[WebSpeechSynthesisWrapper resume]):
     21        (-[WebSpeechSynthesisWrapper cancel]):
     22        (-[WebSpeechSynthesisWrapper speechSynthesizer:didStartSpeechUtterance:]):
     23        (-[WebSpeechSynthesisWrapper speechSynthesizer:didFinishSpeechUtterance:]):
     24        (-[WebSpeechSynthesisWrapper speechSynthesizer:didPauseSpeechUtterance:]):
     25        (-[WebSpeechSynthesisWrapper speechSynthesizer:didContinueSpeechUtterance:]):
     26        (-[WebSpeechSynthesisWrapper speechSynthesizer:didCancelSpeechUtterance:]):
     27        (-[WebSpeechSynthesisWrapper speechSynthesizer:willSpeakRangeOfSpeechString:utterance:]):
     28        (WebCore::PlatformSpeechSynthesizer::PlatformSpeechSynthesizer):
     29        (WebCore::PlatformSpeechSynthesizer::~PlatformSpeechSynthesizer):
     30        (WebCore::PlatformSpeechSynthesizer::initializeVoiceList):
     31        (WebCore::PlatformSpeechSynthesizer::pause):
     32        (WebCore::PlatformSpeechSynthesizer::resume):
     33        (WebCore::PlatformSpeechSynthesizer::speak):
     34        (WebCore::PlatformSpeechSynthesizer::cancel):
     35        (WebCore::PlatformSpeechSynthesizer::resetState):
     36        * platform/mac/PlatformSpeechSynthesizerMac.mm: Removed.
     37
    1382021-10-22  Jean-Yves Avenard  <jya@apple.com>
    239
  • trunk/Source/WebCore/PAL/ChangeLog

    r284626 r284742  
     12021-10-23  Chris Fleizach  <cfleizach@apple.com>
     2
     3        AX: Unify speech synthesizer platform usage for Mac/iOS
     4        https://bugs.webkit.org/show_bug.cgi?id=231895
     5        <rdar://problem/84372479>
     6
     7        Reviewed by Andres Gonzalez.
     8
     9        * PAL.xcodeproj/project.pbxproj:
     10        * pal/cocoa/AVFoundationSoftLink.h:
     11        * pal/cocoa/AVFoundationSoftLink.mm:
     12        * pal/spi/cocoa/AXSpeechManagerSPI.h:
     13        * pal/spi/mac/SpeechSynthesisSPI.h: Removed.
     14
    1152021-10-21  Aditya Keerthi  <akeerthi@apple.com>
    216
  • trunk/Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj

    r284494 r284742  
    170170                A10826FA1F576292004772AC /* WebPanel.mm in Sources */ = {isa = PBXBuildFile; fileRef = A10826F81F576292004772AC /* WebPanel.mm */; };
    171171                A10826FE1F58A433004772AC /* NSGraphicsSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = A10826FD1F58A433004772AC /* NSGraphicsSPI.h */; };
    172                 A1175B491F6AFF8E00C4B9F0 /* SpeechSynthesisSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = A1175B481F6AFF8E00C4B9F0 /* SpeechSynthesisSPI.h */; };
    173172                A1175B4B1F6B2D7E00C4B9F0 /* NSCellSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = A1175B4A1F6B2D7E00C4B9F0 /* NSCellSPI.h */; };
    174173                A1175B4E1F6B337300C4B9F0 /* PopupMenu.h in Headers */ = {isa = PBXBuildFile; fileRef = A1175B4C1F6B337300C4B9F0 /* PopupMenu.h */; };
     
    397396                A10826F81F576292004772AC /* WebPanel.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = WebPanel.mm; sourceTree = "<group>"; };
    398397                A10826FD1F58A433004772AC /* NSGraphicsSPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NSGraphicsSPI.h; sourceTree = "<group>"; };
    399                 A1175B481F6AFF8E00C4B9F0 /* SpeechSynthesisSPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SpeechSynthesisSPI.h; sourceTree = "<group>"; };
    400398                A1175B4A1F6B2D7E00C4B9F0 /* NSCellSPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NSCellSPI.h; sourceTree = "<group>"; };
    401399                A1175B4C1F6B337300C4B9F0 /* PopupMenu.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PopupMenu.h; sourceTree = "<group>"; };
     
    644642                                0C7785851F45130F00F4EBB6 /* PIPSPI.h */,
    645643                                0C7785871F45130F00F4EBB6 /* QuickLookMacSPI.h */,
    646                                 A1175B481F6AFF8E00C4B9F0 /* SpeechSynthesisSPI.h */,
    647644                                71B1141F26823ACD004D6701 /* SystemPreviewSPI.h */,
    648645                                0C7785881F45130F00F4EBB6 /* TelephonyUtilitiesSPI.h */,
     
    10131010                                93B38EBE25821CB600198E63 /* SpeechSoftLink.h in Headers */,
    10141011                                93B38EC225821D2200198E63 /* SpeechSPI.h in Headers */,
    1015                                 A1175B491F6AFF8E00C4B9F0 /* SpeechSynthesisSPI.h in Headers */,
    10161012                                0C5AF9211F43A4C7002EAC02 /* SQLite3SPI.h in Headers */,
    10171013                                71B1142026823ACD004D6701 /* SystemPreviewSPI.h in Headers */,
  • trunk/Source/WebCore/PAL/pal/cocoa/AVFoundationSoftLink.h

    r283592 r284742  
    7777SOFT_LINK_CLASS_FOR_HEADER(PAL, AVAudioSession)
    7878SOFT_LINK_CLASS_FOR_HEADER(PAL, AVPersistableContentKeyRequest)
     79#endif
     80
     81#if PLATFORM(COCOA)
    7982SOFT_LINK_CLASS_FOR_HEADER(PAL, AVSpeechSynthesisVoice)
    8083SOFT_LINK_CLASS_FOR_HEADER(PAL, AVSpeechSynthesizer)
  • trunk/Source/WebCore/PAL/pal/cocoa/AVFoundationSoftLink.mm

    r283592 r284742  
    103103SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT(PAL, AVFoundation, AVAudioSession, PAL_EXPORT)
    104104SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT(PAL, AVFoundation, AVPersistableContentKeyRequest, PAL_EXPORT)
     105#endif
     106
     107#if PLATFORM(COCOA)
    105108SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT(PAL, AVFoundation, AVSpeechSynthesisVoice, PAL_EXPORT)
    106109SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT(PAL, AVFoundation, AVSpeechSynthesizer, PAL_EXPORT)
  • trunk/Source/WebCore/PAL/pal/spi/cocoa/AXSpeechManagerSPI.h

    r269232 r284742  
    2626#pragma once
    2727
    28 #if PLATFORM(IOS_FAMILY)
     28#if PLATFORM(COCOA)
    2929
    3030// FIXME: Undo when isSystemVoice is available in all SDKs.
     
    4343#endif // USE(APPLE_INTERNAL_SDK)
    4444
    45 #endif // PLATFORM(IOS_FAMILY)
     45#endif // PLATFORM(COCOA)
    4646
  • trunk/Source/WebCore/SourcesCocoa.txt

    r284383 r284742  
    257257platform/cocoa/PasteboardCustomDataCocoa.mm
    258258platform/cocoa/PlatformPasteboardCocoa.mm
     259platform/cocoa/PlatformSpeechSynthesizerCocoa.mm @no-unify
    259260platform/cocoa/PlaybackSessionModelMediaElement.mm
    260261platform/cocoa/PowerSourceNotifier.mm
     
    440441platform/ios/PlatformPasteboardIOS.mm
    441442platform/ios/PlatformScreenIOS.mm
    442 platform/ios/PlatformSpeechSynthesizerIOS.mm @no-unify
    443443platform/ios/PlaybackSessionInterfaceAVKit.mm @no-unify
    444444platform/ios/PreviewConverterIOS.mm
     
    487487platform/mac/PlatformPasteboardMac.mm
    488488platform/mac/PlatformScreenMac.mm
    489 platform/mac/PlatformSpeechSynthesizerMac.mm
    490489platform/mac/PlaybackSessionInterfaceMac.mm @no-unify
    491490platform/mac/PluginBlocklist.mm
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r284718 r284742  
    37113711                A9D248070D757E7D00FDF959 /* JSDOMMimeType.h in Headers */ = {isa = PBXBuildFile; fileRef = A9D248030D757E7D00FDF959 /* JSDOMMimeType.h */; };
    37123712                A9D248090D757E7D00FDF959 /* JSDOMMimeTypeArray.h in Headers */ = {isa = PBXBuildFile; fileRef = A9D248050D757E7D00FDF959 /* JSDOMMimeTypeArray.h */; };
    3713                 AA12DF491743DF83004DAFDF /* PlatformSpeechSynthesizerIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = AAE3755D17429BCC006200C2 /* PlatformSpeechSynthesizerIOS.mm */; };
     3713                AA12DF491743DF83004DAFDF /* PlatformSpeechSynthesizerCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = AAE3755D17429BCC006200C2 /* PlatformSpeechSynthesizerCocoa.mm */; };
    37143714                AA21ECCD0ABF0FC6002B834C /* CSSCursorImageValue.h in Headers */ = {isa = PBXBuildFile; fileRef = AA0978EE0ABAA6E100874480 /* CSSCursorImageValue.h */; settings = {ATTRIBUTES = (Private, ); }; };
    37153715                AA2A5ACE16A485FD00975A25 /* SpeechSynthesisVoice.h in Headers */ = {isa = PBXBuildFile; fileRef = AA2A5AC716A485D500975A25 /* SpeechSynthesisVoice.h */; };
     
    73027302                29E04A27BED2F81F98E9022B /* JSBeforeUnloadEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSBeforeUnloadEvent.h; sourceTree = "<group>"; };
    73037303                29E4D8DF16B0940F00C84704 /* PlatformSpeechSynthesizer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PlatformSpeechSynthesizer.h; sourceTree = "<group>"; };
    7304                 29E4D8E016B0959800C84704 /* PlatformSpeechSynthesizerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PlatformSpeechSynthesizerMac.mm; sourceTree = "<group>"; };
    73057304                29FAF4B5195AB08900A522DC /* TextUndoInsertionMarkupMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextUndoInsertionMarkupMac.h; sourceTree = "<group>"; };
    73067305                2A4107A026CB66ED003BF797 /* CSSKeywordValue.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CSSKeywordValue.cpp; sourceTree = "<group>"; };
     
    1363113630                AAE27B7416CBFC0D00623043 /* PlatformSpeechSynthesizerMock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlatformSpeechSynthesizerMock.cpp; sourceTree = "<group>"; };
    1363213631                AAE27B7516CBFC0D00623043 /* PlatformSpeechSynthesizerMock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformSpeechSynthesizerMock.h; sourceTree = "<group>"; };
    13633                 AAE3755D17429BCC006200C2 /* PlatformSpeechSynthesizerIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PlatformSpeechSynthesizerIOS.mm; sourceTree = "<group>"; };
     13632                AAE3755D17429BCC006200C2 /* PlatformSpeechSynthesizerCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PlatformSpeechSynthesizerCocoa.mm; sourceTree = "<group>"; };
    1363413633                AAF5B7B11524B4BD0004CB49 /* WebSocketFrame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebSocketFrame.cpp; sourceTree = "<group>"; };
    1363513634                AB23A32509BBA7D00067CC53 /* BeforeTextInsertedEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = BeforeTextInsertedEvent.cpp; sourceTree = "<group>"; };
     
    2239222391                                C5F765BA14E1ECF4006C899B /* PlatformPasteboardMac.mm */,
    2239322392                                BC94D1070C274F88006BC617 /* PlatformScreenMac.mm */,
    22394                                 29E4D8E016B0959800C84704 /* PlatformSpeechSynthesizerMac.mm */,
    2239522393                                CDA29A151CBDA56C00901CCF /* PlaybackSessionInterfaceMac.h */,
    2239622394                                CDA29A141CBDA56C00901CCF /* PlaybackSessionInterfaceMac.mm */,
     
    2506325061                                C5278B0B17F212EA003A2998 /* PlatformPasteboardIOS.mm */,
    2506425062                                E45390320EAFD637003695C8 /* PlatformScreenIOS.mm */,
    25065                                 AAE3755D17429BCC006200C2 /* PlatformSpeechSynthesizerIOS.mm */,
    2506625063                                CDA29A2E1CBF73FC00901CCF /* PlaybackSessionInterfaceAVKit.h */,
    2506725064                                CDA29A2F1CBF73FC00901CCF /* PlaybackSessionInterfaceAVKit.mm */,
     
    2522225219                                F4FB35002350C96200F0094A /* PasteboardCustomDataCocoa.mm */,
    2522325220                                F4628A9E234D3BBF00BC884C /* PlatformPasteboardCocoa.mm */,
     25221                                AAE3755D17429BCC006200C2 /* PlatformSpeechSynthesizerCocoa.mm */,
    2522425222                                52B0D4BD1C57FD1E0077CE53 /* PlatformView.h */,
    2522525223                                CDA29A0A1CBD9A7400901CCF /* PlaybackSessionModel.h */,
     
    3689436892                                E16982601134636A00894115 /* ObjCRuntimeObject.mm in Sources */,
    3689536893                                CEA284662141E84900E407E8 /* PlatformEventFactoryIOS.mm in Sources */,
    36896                                 AA12DF491743DF83004DAFDF /* PlatformSpeechSynthesizerIOS.mm in Sources */,
     36894                                AA12DF491743DF83004DAFDF /* PlatformSpeechSynthesizerCocoa.mm in Sources */,
    3689736895                                CDA29A301CBF74D400901CCF /* PlaybackSessionInterfaceAVKit.mm in Sources */,
    3689836896                                CDA29A161CBDA56C00901CCF /* PlaybackSessionInterfaceMac.mm in Sources */,
  • trunk/Source/WebCore/platform/cocoa/PlatformSpeechSynthesizerCocoa.mm

    r284741 r284742  
    2626#import "PlatformSpeechSynthesizer.h"
    2727
    28 #if ENABLE(SPEECH_SYNTHESIS) && PLATFORM(IOS_FAMILY)
     28#if ENABLE(SPEECH_SYNTHESIS) && PLATFORM(COCOA)
    2929
    3030#import "PlatformSpeechSynthesisUtterance.h"
    3131#import "PlatformSpeechSynthesisVoice.h"
    32 #import <AVFoundation/AVSpeechSynthesis.h>
     32
     33#if __has_include(<AVFAudio/AVSpeechSynthesis.h>)
     34#import <AVFAudio/AVSpeechSynthesis.h>
     35#else
     36#import <AVFoundation/AVFoundation.h>
     37#endif
     38
    3339#import <pal/spi/cocoa/AXSpeechManagerSPI.h>
    3440#import <wtf/BlockObjCExceptions.h>
     
    6470#define AVSpeechUtteranceMaximumSpeechRate getAVSpeechUtteranceMaximumSpeechRate()
    6571
    66 @interface WebSpeechSynthesisWrapper : NSObject<AVSpeechSynthesizerDelegate>
    67 {
     72@interface WebSpeechSynthesisWrapper : NSObject<AVSpeechSynthesizerDelegate> {
    6873    WebCore::PlatformSpeechSynthesizer* m_synthesizerObject;
    6974    // Hold a Ref to the utterance so that it won't disappear until the synth is done with it.
     
    192197
    193198    // Clear the m_utterance variable in case finish speaking kicks off a new speaking job immediately.
    194     RefPtr<WebCore::PlatformSpeechSynthesisUtterance> platformUtterance = m_utterance;
     199    RefPtr<WebCore::PlatformSpeechSynthesisUtterance> protectedUtterance = m_utterance;
    195200    m_utterance = nullptr;
    196201
    197     m_synthesizerObject->client()->didFinishSpeaking(*platformUtterance);
     202    m_synthesizerObject->client()->didFinishSpeaking(*protectedUtterance);
    198203}
    199204
     
    226231
    227232    // Clear the m_utterance variable in case finish speaking kicks off a new speaking job immediately.
    228     RefPtr<WebCore::PlatformSpeechSynthesisUtterance> platformUtterance = m_utterance;
     233    RefPtr<WebCore::PlatformSpeechSynthesisUtterance> protectedUtterance = m_utterance;
    229234    m_utterance = nullptr;
    230235
    231     m_synthesizerObject->client()->didFinishSpeaking(*platformUtterance);
     236    m_synthesizerObject->client()->didFinishSpeaking(*protectedUtterance);
    232237}
    233238
     
    240245        return;
    241246
    242     // iOS only supports word boundaries.
     247    // AVSpeechSynthesizer only supports word boundaries.
    243248    m_synthesizerObject->client()->boundaryEventOccurred(*m_utterance, WebCore::SpeechBoundary::SpeechWordBoundary, characterRange.location);
    244249}
     
    276281        if (includeVoice)
    277282#else
    278         if (voice.quality == AVSpeechSynthesisVoiceQualityDefault)
     283        // AVSpeechSynthesis on macOS does not support quality property correctly.
     284        if (voice.quality == AVSpeechSynthesisVoiceQualityDefault
     285            || (TARGET_OS_OSX && ![voiceURI hasSuffix:@"premium"]))
    279286#endif
    280287            m_voiceList.append(PlatformSpeechSynthesisVoice::create(voiceURI, name, language, true, isDefault));
     
    313320} // namespace WebCore
    314321
    315 #endif // ENABLE(SPEECH_SYNTHESIS) && PLATFORM(IOS_FAMILY)
     322#endif // ENABLE(SPEECH_SYNTHESIS) && PLATFORM(COCOA)
Note: See TracChangeset for help on using the changeset viewer.