Changeset 286259 in webkit
- Timestamp:
- Nov 29, 2021, 12:48:59 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 2 deleted
- 26 edited
- 1 moved
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/fast/speechsynthesis/speech-synthesis-speak-empty-string-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/ChangeLog (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/speech-api/SpeechSynthesis-speak-events-expected.txt (modified) (1 diff)
-
LayoutTests/platform/mac-catalina-wk1/TestExpectations (added)
-
LayoutTests/platform/mac-wk1/TestExpectations (modified) (1 diff)
-
LayoutTests/platform/mac-wk2/TestExpectations (modified) (1 diff)
-
LayoutTests/platform/mac/TestExpectations (modified) (2 diffs)
-
Source/WTF/ChangeLog (modified) (1 diff)
-
Source/WTF/wtf/PlatformHave.h (modified) (3 diffs)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/Modules/speech/SpeechSynthesis.cpp (modified) (3 diffs)
-
Source/WebCore/PAL/ChangeLog (modified) (1 diff)
-
Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj (modified) (4 diffs)
-
Source/WebCore/PAL/pal/cocoa/AVFoundationSoftLink.h (modified) (1 diff)
-
Source/WebCore/PAL/pal/cocoa/AVFoundationSoftLink.mm (modified) (1 diff)
-
Source/WebCore/PAL/pal/spi/cocoa/AXSpeechManagerSPI.h (modified) (2 diffs)
-
Source/WebCore/PAL/pal/spi/mac/SpeechSynthesisSPI.h (deleted)
-
Source/WebCore/SourcesCocoa.txt (modified) (3 diffs)
-
Source/WebCore/WebCore.xcodeproj/project.pbxproj (modified) (7 diffs)
-
Source/WebCore/page/SpeechSynthesisClient.h (modified) (1 diff)
-
Source/WebCore/platform/PlatformSpeechSynthesizer.h (modified) (1 diff)
-
Source/WebCore/platform/cocoa/PlatformSpeechSynthesizerCocoa.mm (moved) (moved from trunk/Source/WebCore/platform/ios/PlatformSpeechSynthesizerIOS.mm ) (11 diffs)
-
Source/WebCore/platform/mac/PlatformSpeechSynthesizerMac.mm (deleted)
-
Source/WebKit/ChangeLog (modified) (1 diff)
-
Source/WebKit/UIProcess/WebPageProxy.cpp (modified) (1 diff)
-
Source/WebKit/UIProcess/WebPageProxy.h (modified) (1 diff)
-
Source/WebKit/UIProcess/WebPageProxy.messages.in (modified) (1 diff)
-
Source/WebKit/WebProcess/WebCoreSupport/WebSpeechSynthesisClient.cpp (modified) (1 diff)
-
Source/WebKit/WebProcess/WebCoreSupport/WebSpeechSynthesisClient.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r286254 r286259 1 2021-11-29 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 * fast/speechsynthesis/speech-synthesis-speak-empty-string-expected.txt: 10 * platform/mac-catalina-wk1/TestExpectations: Added. 11 * platform/mac-wk1/TestExpectations: 12 * platform/mac-wk2/TestExpectations: 13 * platform/mac/TestExpectations: 14 1 15 2021-11-29 Myles C. Maxfield <mmaxfield@apple.com> 2 16 -
trunk/LayoutTests/fast/speechsynthesis/speech-synthesis-speak-empty-string-expected.txt
r173000 r286259 6 6 PASS speechSynthesis.speaking is false 7 7 PASS event.elapsedTime > 0 is true 8 PASS speechSynthesis.speaking is true 9 PASS event.elapsedTime > 0 is true 8 10 PASS speechSynthesis.speaking is false 9 11 PASS successfullyParsed is true -
trunk/LayoutTests/imported/w3c/ChangeLog
r286226 r286259 1 2021-11-29 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 Update expectations now that the test passes. 10 11 * web-platform-tests/speech-api/SpeechSynthesis-speak-events-expected.txt: 12 1 13 2021-11-29 Antti Koivisto <antti@apple.com> 2 14 -
trunk/LayoutTests/imported/w3c/web-platform-tests/speech-api/SpeechSynthesis-speak-events-expected.txt
r279400 r286259 1 1 2 FAIL speechSynthesis.speak() fires start and end events with empty utterance assert_true: Not expecting event, but got end event expected true got false2 PASS speechSynthesis.speak() fires start and end events with empty utterance 3 3 PASS speechSynthesis.speak() fires start and end events 4 4 -
trunk/LayoutTests/platform/mac-wk1/TestExpectations
r286116 r286259 73 73 fast/speechrecognition/start-recognition-after-gum.html [ Skip ] 74 74 fast/speechrecognition/start-recognition-after-denied-gum.html [ Skip ] 75 imported/w3c/web-platform-tests/speech-api/SpeechSynthesis-pause-resume.tentative.html [ Skip ]76 75 77 76 # Datalist is unsupported in WK1 -
trunk/LayoutTests/platform/mac-wk2/TestExpectations
r285993 r286259 1209 1209 [ BigSur+ ] imported/w3c/web-platform-tests/css/css-font-loading/idlharness.https.html [ Pass Failure Timeout ] 1210 1210 1211 # rdar://66701815 (REGRESSION (20A2321a-20A2348b): fast/speechsynthesis/speech-synthesis-speak-empty-string.html is a flaky failure)1212 [ BigSur+ ] fast/speechsynthesis/speech-synthesis-speak-empty-string.html [ Pass Failure ]1213 1214 1211 # rdar://66703773 (REGRESSION (20A2316-20A2348b): http/tests/security/contentSecurityPolicy/plugin-blocked-in-about-blank-window.html is a constant failure) 1215 1212 [ arm64 ] http/tests/security/contentSecurityPolicy/plugin-blocked-in-about-blank-window.html [ Skip ] -
trunk/LayoutTests/platform/mac/TestExpectations
r286165 r286259 2032 2032 webkit.org/b/217620 inspector/audit/basic-async.html [ Pass Timeout ] 2033 2033 2034 imported/w3c/web-platform-tests/speech-api/SpeechSynthesis-speak-twice.html [ Skip ]2035 imported/w3c/web-platform-tests/speech-api/SpeechSynthesis-speak-without-activation-fails.tentative.html [ Skip ]2036 webkit.org/b/227501 [ Debug ] imported/w3c/web-platform-tests/speech-api/SpeechSynthesis-speak-events.html [ Skip ]2037 2038 2034 webkit.org/b/217669 http/wpt/service-workers/service-worker-spinning-message.https.html [ Pass Failure ] 2039 2035 … … 2301 2297 2302 2298 #rdar://82146367 ([Mac, iOS Release] imported/w3c/web-platform-tests/worklets/layout-worklet-csp.https.html is a flaky failure) imported/w3c/web-platform-tests/worklets/layout-worklet-csp.https.html [ Pass Failure ] 2303 2304 webkit.org/b/228396 fast/speechsynthesis/speech-synthesis-speak-empty-string.html [ Pass Failure ]2305 2299 2306 2300 webkit.org/b/228176 [ Mojave Catalina BigSur ] fast/text/variable-system-font.html [ ImageOnlyFailure ] -
trunk/Source/WTF/ChangeLog
r286251 r286259 1 2021-11-29 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 1 11 2021-11-29 Yusuke Suzuki <ysuzuki@apple.com> 2 12 -
trunk/Source/WTF/wtf/PlatformHave.h
r286227 r286259 758 758 #endif 759 759 760 #if ( PLATFORM(IOS) || PLATFORM(MACCATALYST)) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 140300760 #if ((PLATFORM(IOS) || PLATFORM(MACCATALYST)) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 140300) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED > 120000) 761 761 #if !defined(HAVE_AVSPEECHSYNTHESIS_SYSTEMVOICE) 762 762 #define HAVE_AVSPEECHSYNTHESIS_SYSTEMVOICE 1 … … 767 767 #if !defined(HAVE_TCC_IOS_14_BIG_SUR_SPI) 768 768 #define HAVE_TCC_IOS_14_BIG_SUR_SPI 1 769 #endif770 #endif771 772 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 120000773 #if !defined(HAVE_SPEECHSYNTHESIS_MONTEREY_SPI)774 #define HAVE_SPEECHSYNTHESIS_MONTEREY_SPI 1775 769 #endif 776 770 #endif … … 1111 1105 #define HAVE_SCENEKIT 1 1112 1106 #endif 1107 1108 #if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 130000) 1109 #define HAVE_UNIFIED_SPEECHSYNTHESIS_FIX_FOR_81465164 1 1110 #endif -
trunk/Source/WebCore/ChangeLog
r286254 r286259 1 2021-11-29 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 Fix a number of tests that had been marked failing/flaky related to speech synthesis. 11 12 * Modules/speech/SpeechSynthesis.cpp: 13 (WebCore::SpeechSynthesis::SpeechSynthesis): 14 (WebCore::SpeechSynthesis::startSpeakingImmediately): 15 (WebCore::SpeechSynthesis::speak): 16 * SourcesCocoa.txt: 17 * WebCore.xcodeproj/project.pbxproj: 18 * page/SpeechSynthesisClient.h: 19 * platform/PlatformSpeechSynthesizer.h: 20 * platform/graphics/cocoa/FontCacheCoreText.cpp: 21 (WebCore::variationAxes): 22 * platform/ios/PlatformSpeechSynthesizerIOS.mm: Removed. 23 * platform/mac/PlatformSpeechSynthesizerMac.mm: Removed. 24 * Source/WebCore/platform/cocoa/PlatformSpeechSynthesizerCocoa.mm: Added. 25 1 26 2021-11-29 Myles C. Maxfield <mmaxfield@apple.com> 2 27 -
trunk/Source/WebCore/Modules/speech/SpeechSynthesis.cpp
r284057 r286259 60 60 #endif 61 61 62 if (m_speechSynthesisClient) 62 if (m_speechSynthesisClient) { 63 63 m_speechSynthesisClient->setObserver(*this); 64 m_speechSynthesisClient->resetState(); 65 } 64 66 } 65 67 … … 123 125 m_isPaused = false; 124 126 125 // Zero lengthed strings should immediately notify that the event is complete.126 if (utterance.text().isEmpty()) {127 handleSpeakingCompleted(utterance, false);128 return;129 }130 131 127 if (m_speechSynthesisClient) 132 128 m_speechSynthesisClient->speak(utterance.platformUtterance()); … … 146 142 147 143 m_utteranceQueue.append(utterance); 148 149 144 // If the queue was empty, speak this immediately and add it to the queue. 150 145 if (m_utteranceQueue.size() == 1) -
trunk/Source/WebCore/PAL/ChangeLog
r286252 r286259 1 2021-11-29 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 1 15 2021-11-29 Myles C. Maxfield <mmaxfield@apple.com> 2 16 -
trunk/Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj
r285846 r286259 324 324 A10826FA1F576292004772AC /* WebPanel.mm in Sources */ = {isa = PBXBuildFile; fileRef = A10826F81F576292004772AC /* WebPanel.mm */; }; 325 325 A10826FE1F58A433004772AC /* NSGraphicsSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = A10826FD1F58A433004772AC /* NSGraphicsSPI.h */; }; 326 A1175B491F6AFF8E00C4B9F0 /* SpeechSynthesisSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = A1175B481F6AFF8E00C4B9F0 /* SpeechSynthesisSPI.h */; };327 326 A1175B4B1F6B2D7E00C4B9F0 /* NSCellSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = A1175B4A1F6B2D7E00C4B9F0 /* NSCellSPI.h */; }; 328 327 A1175B4E1F6B337300C4B9F0 /* PopupMenu.h in Headers */ = {isa = PBXBuildFile; fileRef = A1175B4C1F6B337300C4B9F0 /* PopupMenu.h */; }; … … 729 728 A10826F81F576292004772AC /* WebPanel.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = WebPanel.mm; sourceTree = "<group>"; }; 730 729 A10826FD1F58A433004772AC /* NSGraphicsSPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NSGraphicsSPI.h; sourceTree = "<group>"; }; 731 A1175B481F6AFF8E00C4B9F0 /* SpeechSynthesisSPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SpeechSynthesisSPI.h; sourceTree = "<group>"; };732 730 A1175B4A1F6B2D7E00C4B9F0 /* NSCellSPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NSCellSPI.h; sourceTree = "<group>"; }; 733 731 A1175B4C1F6B337300C4B9F0 /* PopupMenu.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PopupMenu.h; sourceTree = "<group>"; }; … … 979 977 0C7785851F45130F00F4EBB6 /* PIPSPI.h */, 980 978 0C7785871F45130F00F4EBB6 /* QuickLookMacSPI.h */, 981 A1175B481F6AFF8E00C4B9F0 /* SpeechSynthesisSPI.h */,982 979 71B1141F26823ACD004D6701 /* SystemPreviewSPI.h */, 983 980 0C7785881F45130F00F4EBB6 /* TelephonyUtilitiesSPI.h */, … … 1550 1547 93B38EBE25821CB600198E63 /* SpeechSoftLink.h in Headers */, 1551 1548 93B38EC225821D2200198E63 /* SpeechSPI.h in Headers */, 1552 A1175B491F6AFF8E00C4B9F0 /* SpeechSynthesisSPI.h in Headers */,1553 1549 0C5AF9211F43A4C7002EAC02 /* SQLite3SPI.h in Headers */, 1554 1550 71B1142026823ACD004D6701 /* SystemPreviewSPI.h in Headers */, -
trunk/Source/WebCore/PAL/pal/cocoa/AVFoundationSoftLink.h
r284822 r286259 77 77 SOFT_LINK_CLASS_FOR_HEADER(PAL, AVAudioSession) 78 78 SOFT_LINK_CLASS_FOR_HEADER(PAL, AVPersistableContentKeyRequest) 79 #endif 80 81 #if PLATFORM(COCOA) 79 82 SOFT_LINK_CLASS_FOR_HEADER(PAL, AVSpeechSynthesisVoice) 80 83 SOFT_LINK_CLASS_FOR_HEADER(PAL, AVSpeechSynthesizer) -
trunk/Source/WebCore/PAL/pal/cocoa/AVFoundationSoftLink.mm
r284822 r286259 103 103 SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT(PAL, AVFoundation, AVAudioSession, PAL_EXPORT) 104 104 SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT(PAL, AVFoundation, AVPersistableContentKeyRequest, PAL_EXPORT) 105 #endif 106 107 #if PLATFORM(COCOA) 105 108 SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT(PAL, AVFoundation, AVSpeechSynthesisVoice, PAL_EXPORT) 106 109 SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT(PAL, AVFoundation, AVSpeechSynthesizer, PAL_EXPORT) -
trunk/Source/WebCore/PAL/pal/spi/cocoa/AXSpeechManagerSPI.h
r284822 r286259 26 26 #pragma once 27 27 28 #if PLATFORM( IOS_FAMILY)28 #if PLATFORM(COCOA) 29 29 30 30 // FIXME: Undo when isSystemVoice is available in all SDKs. … … 43 43 #endif // USE(APPLE_INTERNAL_SDK) 44 44 45 #endif // PLATFORM( IOS_FAMILY)45 #endif // PLATFORM(COCOA) 46 46 -
trunk/Source/WebCore/SourcesCocoa.txt
r286193 r286259 260 260 platform/cocoa/PasteboardCustomDataCocoa.mm 261 261 platform/cocoa/PlatformPasteboardCocoa.mm 262 platform/cocoa/PlatformSpeechSynthesizerCocoa.mm @no-unify 262 263 platform/cocoa/PlaybackSessionModelMediaElement.mm 263 264 platform/cocoa/PowerSourceNotifier.mm … … 445 446 platform/ios/PlatformPasteboardIOS.mm 446 447 platform/ios/PlatformScreenIOS.mm 447 platform/ios/PlatformSpeechSynthesizerIOS.mm @no-unify448 448 platform/ios/PlaybackSessionInterfaceAVKit.mm @no-unify 449 449 platform/ios/PreviewConverterIOS.mm … … 492 492 platform/mac/PlatformPasteboardMac.mm 493 493 platform/mac/PlatformScreenMac.mm 494 platform/mac/PlatformSpeechSynthesizerMac.mm495 494 platform/mac/PlaybackSessionInterfaceMac.mm @no-unify 496 495 platform/mac/PluginBlocklist.mm -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r286209 r286259 3706 3706 A9D248070D757E7D00FDF959 /* JSDOMMimeType.h in Headers */ = {isa = PBXBuildFile; fileRef = A9D248030D757E7D00FDF959 /* JSDOMMimeType.h */; }; 3707 3707 A9D248090D757E7D00FDF959 /* JSDOMMimeTypeArray.h in Headers */ = {isa = PBXBuildFile; fileRef = A9D248050D757E7D00FDF959 /* JSDOMMimeTypeArray.h */; }; 3708 AA12DF491743DF83004DAFDF /* PlatformSpeechSynthesizer IOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = AAE3755D17429BCC006200C2 /* PlatformSpeechSynthesizerIOS.mm */; };3708 AA12DF491743DF83004DAFDF /* PlatformSpeechSynthesizerCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = AAE3755D17429BCC006200C2 /* PlatformSpeechSynthesizerCocoa.mm */; }; 3709 3709 AA21ECCD0ABF0FC6002B834C /* CSSCursorImageValue.h in Headers */ = {isa = PBXBuildFile; fileRef = AA0978EE0ABAA6E100874480 /* CSSCursorImageValue.h */; settings = {ATTRIBUTES = (Private, ); }; }; 3710 3710 AA2A5ACE16A485FD00975A25 /* SpeechSynthesisVoice.h in Headers */ = {isa = PBXBuildFile; fileRef = AA2A5AC716A485D500975A25 /* SpeechSynthesisVoice.h */; }; … … 7847 7847 29E04A27BED2F81F98E9022B /* JSBeforeUnloadEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSBeforeUnloadEvent.h; sourceTree = "<group>"; }; 7848 7848 29E4D8DF16B0940F00C84704 /* PlatformSpeechSynthesizer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PlatformSpeechSynthesizer.h; sourceTree = "<group>"; }; 7849 29E4D8E016B0959800C84704 /* PlatformSpeechSynthesizerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PlatformSpeechSynthesizerMac.mm; sourceTree = "<group>"; };7850 7849 29FAF4B5195AB08900A522DC /* TextUndoInsertionMarkupMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextUndoInsertionMarkupMac.h; sourceTree = "<group>"; }; 7851 7850 2A4107A026CB66ED003BF797 /* CSSKeywordValue.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CSSKeywordValue.cpp; sourceTree = "<group>"; }; … … 14250 14249 AAE27B7416CBFC0D00623043 /* PlatformSpeechSynthesizerMock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlatformSpeechSynthesizerMock.cpp; sourceTree = "<group>"; }; 14251 14250 AAE27B7516CBFC0D00623043 /* PlatformSpeechSynthesizerMock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformSpeechSynthesizerMock.h; sourceTree = "<group>"; }; 14252 AAE3755D17429BCC006200C2 /* PlatformSpeechSynthesizer IOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PlatformSpeechSynthesizerIOS.mm; sourceTree = "<group>"; };14251 AAE3755D17429BCC006200C2 /* PlatformSpeechSynthesizerCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PlatformSpeechSynthesizerCocoa.mm; sourceTree = "<group>"; }; 14253 14252 AAF5B7B11524B4BD0004CB49 /* WebSocketFrame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebSocketFrame.cpp; sourceTree = "<group>"; }; 14254 14253 AB23A32509BBA7D00067CC53 /* BeforeTextInsertedEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = BeforeTextInsertedEvent.cpp; sourceTree = "<group>"; }; … … 23596 23595 C5F765BA14E1ECF4006C899B /* PlatformPasteboardMac.mm */, 23597 23596 BC94D1070C274F88006BC617 /* PlatformScreenMac.mm */, 23598 29E4D8E016B0959800C84704 /* PlatformSpeechSynthesizerMac.mm */,23599 23597 CDA29A151CBDA56C00901CCF /* PlaybackSessionInterfaceMac.h */, 23600 23598 CDA29A141CBDA56C00901CCF /* PlaybackSessionInterfaceMac.mm */, … … 26334 26332 C5278B0B17F212EA003A2998 /* PlatformPasteboardIOS.mm */, 26335 26333 E45390320EAFD637003695C8 /* PlatformScreenIOS.mm */, 26336 AAE3755D17429BCC006200C2 /* PlatformSpeechSynthesizerIOS.mm */,26337 26334 CDA29A2E1CBF73FC00901CCF /* PlaybackSessionInterfaceAVKit.h */, 26338 26335 CDA29A2F1CBF73FC00901CCF /* PlaybackSessionInterfaceAVKit.mm */, … … 26493 26490 F4FB35002350C96200F0094A /* PasteboardCustomDataCocoa.mm */, 26494 26491 F4628A9E234D3BBF00BC884C /* PlatformPasteboardCocoa.mm */, 26492 AAE3755D17429BCC006200C2 /* PlatformSpeechSynthesizerCocoa.mm */, 26495 26493 52B0D4BD1C57FD1E0077CE53 /* PlatformView.h */, 26496 26494 95BA4FAB26D981AA002A0E62 /* PlatformViewController.h */, … … 38224 38222 E16982601134636A00894115 /* ObjCRuntimeObject.mm in Sources */, 38225 38223 CEA284662141E84900E407E8 /* PlatformEventFactoryIOS.mm in Sources */, 38226 AA12DF491743DF83004DAFDF /* PlatformSpeechSynthesizer IOS.mm in Sources */,38224 AA12DF491743DF83004DAFDF /* PlatformSpeechSynthesizerCocoa.mm in Sources */, 38227 38225 CDA29A301CBF74D400901CCF /* PlaybackSessionInterfaceAVKit.mm in Sources */, 38228 38226 CDA29A161CBDA56C00901CCF /* PlaybackSessionInterfaceMac.mm in Sources */, -
trunk/Source/WebCore/page/SpeechSynthesisClient.h
r243002 r286259 48 48 virtual void pause() = 0; 49 49 virtual void resume() = 0; 50 virtual void resetState() = 0; 50 51 51 52 }; -
trunk/Source/WebCore/platform/PlatformSpeechSynthesizer.h
r247755 r286259 73 73 virtual void resume(); 74 74 virtual void cancel(); 75 virtual void resetState(); 75 76 76 void resetState();77 77 PlatformSpeechSynthesizerClient* client() const { return m_speechSynthesizerClient; } 78 78 -
trunk/Source/WebCore/platform/cocoa/PlatformSpeechSynthesizerCocoa.mm
r286258 r286259 26 26 #import "PlatformSpeechSynthesizer.h" 27 27 28 #if ENABLE(SPEECH_SYNTHESIS) && PLATFORM( IOS_FAMILY)28 #if ENABLE(SPEECH_SYNTHESIS) && PLATFORM(COCOA) 29 29 30 30 #import "PlatformSpeechSynthesisUtterance.h" 31 31 #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 33 39 #import <pal/spi/cocoa/AXSpeechManagerSPI.h> 34 40 #import <wtf/BlockObjCExceptions.h> … … 64 70 #define AVSpeechUtteranceMaximumSpeechRate getAVSpeechUtteranceMaximumSpeechRate() 65 71 66 @interface WebSpeechSynthesisWrapper : NSObject<AVSpeechSynthesizerDelegate> 67 { 72 @interface WebSpeechSynthesisWrapper : NSObject<AVSpeechSynthesizerDelegate> { 68 73 WebCore::PlatformSpeechSynthesizer* m_synthesizerObject; 69 74 // Hold a Ref to the utterance so that it won't disappear until the synth is done with it. … … 106 111 ASSERT(!m_utterance); 107 112 ASSERT(utterance); 108 109 113 if (!utterance) 110 114 return; 111 115 112 116 BEGIN_BLOCK_OBJC_EXCEPTIONS 113 117 if (!m_synthesizer) { … … 115 119 [m_synthesizer setDelegate:self]; 116 120 } 117 121 118 122 // Choose the best voice, by first looking at the utterance voice, then the utterance language, 119 123 // then choose the default language. … … 140 144 m_utterance = WTFMove(utterance); 141 145 146 // macOS won't send a did start speaking callback for empty strings. 147 #if !HAVE(UNIFIED_SPEECHSYNTHESIS_FIX_FOR_81465164) 148 if (!m_utterance->text().length()) 149 m_synthesizerObject->client()->didStartSpeaking(*m_utterance); 150 #endif 151 142 152 [m_synthesizer speakUtterance:avUtterance]; 143 153 END_BLOCK_OBJC_EXCEPTIONS … … 164 174 } 165 175 176 - (void)resetState 177 { 178 // On a reset, cancel utterance and set to nil immediately so the next speech job continues without waiting for a callback 179 [self cancel]; 180 m_utterance = nil; 181 } 182 166 183 - (void)cancel 167 184 { … … 192 209 193 210 // Clear the m_utterance variable in case finish speaking kicks off a new speaking job immediately. 194 RefPtr<WebCore::PlatformSpeechSynthesisUtterance> p latformUtterance = m_utterance;211 RefPtr<WebCore::PlatformSpeechSynthesisUtterance> protectedUtterance = m_utterance; 195 212 m_utterance = nullptr; 196 213 197 m_synthesizerObject->client()->didFinishSpeaking(*p latformUtterance);214 m_synthesizerObject->client()->didFinishSpeaking(*protectedUtterance); 198 215 } 199 216 … … 226 243 227 244 // Clear the m_utterance variable in case finish speaking kicks off a new speaking job immediately. 228 RefPtr<WebCore::PlatformSpeechSynthesisUtterance> p latformUtterance = m_utterance;245 RefPtr<WebCore::PlatformSpeechSynthesisUtterance> protectedUtterance = m_utterance; 229 246 m_utterance = nullptr; 230 247 231 m_synthesizerObject->client()->didFinishSpeaking(*p latformUtterance);248 m_synthesizerObject->client()->didFinishSpeaking(*protectedUtterance); 232 249 } 233 250 … … 240 257 return; 241 258 242 // iOSonly supports word boundaries.259 // AVSpeechSynthesizer only supports word boundaries. 243 260 m_synthesizerObject->client()->boundaryEventOccurred(*m_utterance, WebCore::SpeechBoundary::SpeechWordBoundary, characterRange.location); 244 261 } … … 276 293 if (includeVoice) 277 294 #else 278 if (voice.quality == AVSpeechSynthesisVoiceQualityDefault) 295 // AVSpeechSynthesis on macOS does not support quality property correctly. 296 if (voice.quality == AVSpeechSynthesisVoiceQualityDefault 297 || (TARGET_OS_OSX && ![voiceURI hasSuffix:@"premium"])) 279 298 #endif 280 299 m_voiceList.append(PlatformSpeechSynthesisVoice::create(voiceURI, name, language, true, isDefault)); … … 308 327 void PlatformSpeechSynthesizer::resetState() 309 328 { 310 [m_platformSpeechWrapper cancel];329 [m_platformSpeechWrapper resetState]; 311 330 } 312 331 313 332 } // namespace WebCore 314 333 315 #endif // ENABLE(SPEECH_SYNTHESIS) && PLATFORM( IOS_FAMILY)334 #endif // ENABLE(SPEECH_SYNTHESIS) && PLATFORM(COCOA) -
trunk/Source/WebKit/ChangeLog
r286258 r286259 1 2021-11-29 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 Create a new message for resetting speech synthesis state when the DOMWindow changes 10 but the Page (and its referenced speech synthesis) stays the same. 11 12 * UIProcess/WebPageProxy.cpp: 13 (WebKit::WebPageProxy::speechSynthesisResetState): 14 * UIProcess/WebPageProxy.h: 15 * UIProcess/WebPageProxy.messages.in: 16 * WebProcess/WebCoreSupport/WebSpeechSynthesisClient.cpp: 17 (WebKit::WebSpeechSynthesisClient::resetState): 18 * WebProcess/WebCoreSupport/WebSpeechSynthesisClient.h: 19 1 20 2021-11-29 Brent Fulgham <bfulgham@apple.com> 2 21 -
trunk/Source/WebKit/UIProcess/WebPageProxy.cpp
r286227 r286259 10516 10516 } 10517 10517 10518 void WebPageProxy::speechSynthesisResetState() 10519 { 10520 speechSynthesisData().synthesizer->resetState(); 10521 } 10522 10518 10523 void WebPageProxy::speechSynthesisPause(CompletionHandler<void()>&& completionHandler) 10519 10524 { -
trunk/Source/WebKit/UIProcess/WebPageProxy.h
r286227 r286259 1819 1819 void speechSynthesisPause(CompletionHandler<void()>&&); 1820 1820 void speechSynthesisResume(CompletionHandler<void()>&&); 1821 void speechSynthesisResetState(); 1821 1822 #endif 1822 1823 -
trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in
r286227 r286259 545 545 SpeechSynthesisPause() -> () Async 546 546 SpeechSynthesisResume() -> () Async 547 SpeechSynthesisResetState() 547 548 #endif 548 549 -
trunk/Source/WebKit/WebProcess/WebCoreSupport/WebSpeechSynthesisClient.cpp
r284009 r286259 54 54 return m_page.corePage()->speechSynthesisClient()->observer().get(); 55 55 return nullptr; 56 } 57 58 void WebSpeechSynthesisClient::resetState() 59 { 60 m_page.send(Messages::WebPageProxy::SpeechSynthesisResetState()); 56 61 } 57 62 -
trunk/Source/WebKit/WebProcess/WebCoreSupport/WebSpeechSynthesisClient.h
r248762 r286259 54 54 void setObserver(WeakPtr<WebCore::SpeechSynthesisClientObserver> observer) override { m_observer = observer; } 55 55 WeakPtr<WebCore::SpeechSynthesisClientObserver> observer() const override { return m_observer; } 56 void resetState() override; 56 57 57 58 WebCore::SpeechSynthesisClientObserver* corePageObserver() const;
Note:
See TracChangeset
for help on using the changeset viewer.