Diff
Modified: trunk/LayoutTests/ChangeLog (291123 => 291124)
--- trunk/LayoutTests/ChangeLog 2022-03-10 19:43:15 UTC (rev 291123)
+++ trunk/LayoutTests/ChangeLog 2022-03-10 20:15:28 UTC (rev 291124)
@@ -1,3 +1,17 @@
+2022-03-10 Chris Fleizach <[email protected]>
+
+ AX: Support updated WebSpeech API
+ https://bugs.webkit.org/show_bug.cgi?id=237614
+ <rdar://problem/89981851>
+
+ Reviewed by Andres Gonzalez.
+
+ Fixed expectations:
+ * imported/w3c/web-platform-tests/speech-api/SpeechSynthesisEvent-constructor-expected.txt: Updated.
+ * imported/w3c/web-platform-tests/speech-api/SpeechSynthesisErrorEvent-constructor-expected.txt: Updated.
+ * fast/speechsynthesis/speech-synthesis-boundary-events.html: Updated.
+ * fast/speechsynthesis/speech-synthesis-boundary-events-expected.txt: Updated.
+
2022-03-10 Antoine Quint <[email protected]>
[web-animations] font-variant-caps should support discrete animation
Modified: trunk/LayoutTests/fast/speechsynthesis/speech-synthesis-boundary-events-expected.txt (291123 => 291124)
--- trunk/LayoutTests/fast/speechsynthesis/speech-synthesis-boundary-events-expected.txt 2022-03-10 19:43:15 UTC (rev 291123)
+++ trunk/LayoutTests/fast/speechsynthesis/speech-synthesis-boundary-events-expected.txt 2022-03-10 20:15:28 UTC (rev 291124)
@@ -4,8 +4,8 @@
Speech started
-Boundary event: word, Character index: 0
-Boundary event: sentence, Character index: 14
+Boundary event: word, Character index: 0, length: 3
+Boundary event: sentence, Character index: 0, length: 14
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/fast/speechsynthesis/speech-synthesis-boundary-events.html (291123 => 291124)
--- trunk/LayoutTests/fast/speechsynthesis/speech-synthesis-boundary-events.html 2022-03-10 19:43:15 UTC (rev 291123)
+++ trunk/LayoutTests/fast/speechsynthesis/speech-synthesis-boundary-events.html 2022-03-10 20:15:28 UTC (rev 291124)
@@ -25,7 +25,7 @@
}
u._onboundary_ = function(event) {
- debug("Boundary event: " + event.name + ", Character index: " + event.charIndex);
+ debug(`Boundary event: ${event.name}, Character index: ${event.charIndex}, length: ${event.charLength}`);
}
u._onend_ = function(event) {
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (291123 => 291124)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2022-03-10 19:43:15 UTC (rev 291123)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2022-03-10 20:15:28 UTC (rev 291124)
@@ -1,3 +1,15 @@
+2022-03-10 Chris Fleizach <[email protected]>
+
+ AX: Support updated WebSpeech API
+ https://bugs.webkit.org/show_bug.cgi?id=237614
+ <rdar://problem/89981851>
+
+ Reviewed by Andres Gonzalez.
+
+ * web-platform-tests/speech-api/SpeechSynthesisErrorEvent-constructor-expected.txt:
+ * web-platform-tests/speech-api/SpeechSynthesisEvent-constructor-expected.txt:
+ * web-platform-tests/speech-api/idlharness.window-expected.txt:
+
2022-03-10 Antoine Quint <[email protected]>
[web-animations] grid-template-areas should support discrete animation
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/speech-api/SpeechSynthesisErrorEvent-constructor-expected.txt (291123 => 291124)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/speech-api/SpeechSynthesisErrorEvent-constructor-expected.txt 2022-03-10 19:43:15 UTC (rev 291123)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/speech-api/SpeechSynthesisErrorEvent-constructor-expected.txt 2022-03-10 20:15:28 UTC (rev 291124)
@@ -1,40 +1,13 @@
-FAIL SpeechSynthesisErrorEvent with no arguments throws TypeError assert_throws_js: function "() => {
- new SpeechSynthesisErrorEvent();
- }" threw object "ReferenceError: Can't find variable: SpeechSynthesisErrorEvent" ("ReferenceError") expected instance of function "function TypeError() {
- [native code]
-}" ("TypeError")
-FAIL SpeechSynthesisErrorEvent with no eventInitDict throws TypeError assert_throws_js: function "() => {
- new SpeechSynthesisErrorEvent("type");
- }" threw object "ReferenceError: Can't find variable: SpeechSynthesisErrorEvent" ("ReferenceError") expected instance of function "function TypeError() {
- [native code]
-}" ("TypeError")
-FAIL SpeechSynthesisErrorEvent with empty eventInitDict throws TypeError (requires
- utterance and error) assert_throws_js: function "() => {
- new SpeechSynthesisErrorEvent("type", {});
- }" threw object "ReferenceError: Can't find variable: SpeechSynthesisErrorEvent" ("ReferenceError") expected instance of function "function TypeError() {
- [native code]
-}" ("TypeError")
-FAIL SpeechSynthesisErrorEvent with eventInitDict without utterance throws
- TypeError assert_throws_js: function "() => {
- new SpeechSynthesisErrorEvent("type", {error:"not-allowed"});
- }" threw object "ReferenceError: Can't find variable: SpeechSynthesisErrorEvent" ("ReferenceError") expected instance of function "function TypeError() {
- [native code]
-}" ("TypeError")
-FAIL SpeechSynthesisErrorEvent with eventInitDict without error throws
- TypeError assert_throws_js: function "() => {
- new SpeechSynthesisErrorEvent("type", {utterance: new SpeechSynthesisUtterance()});
- }" threw object "ReferenceError: Can't find variable: SpeechSynthesisErrorEvent" ("ReferenceError") expected instance of function "function TypeError() {
- [native code]
-}" ("TypeError")
-FAIL SpeechSynthesisErrorEvent with eventInitDict having utterance and error Can't find variable: SpeechSynthesisErrorEvent
-FAIL SpeechSynthesisErrorEvent with custom eventInitDict Can't find variable: SpeechSynthesisErrorEvent
-FAIL SpeechSynthesisErrorEvent with wrong error enum assert_throws_js: function "() => {
- new SpeechSynthesisErrorEvent("type", {
- utterance: new SpeechSynthesisUtterance(),
- error: error
- });
- }" threw object "ReferenceError: Can't find variable: SpeechSynthesisErrorEvent" ("ReferenceError") expected instance of function "function TypeError() {
- [native code]
-}" ("TypeError")
+PASS SpeechSynthesisErrorEvent with no arguments throws TypeError
+PASS SpeechSynthesisErrorEvent with no eventInitDict throws TypeError
+PASS SpeechSynthesisErrorEvent with empty eventInitDict throws TypeError (requires
+ utterance and error)
+PASS SpeechSynthesisErrorEvent with eventInitDict without utterance throws
+ TypeError
+PASS SpeechSynthesisErrorEvent with eventInitDict without error throws
+ TypeError
+PASS SpeechSynthesisErrorEvent with eventInitDict having utterance and error
+PASS SpeechSynthesisErrorEvent with custom eventInitDict
+PASS SpeechSynthesisErrorEvent with wrong error enum
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/speech-api/SpeechSynthesisEvent-constructor-expected.txt (291123 => 291124)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/speech-api/SpeechSynthesisEvent-constructor-expected.txt 2022-03-10 19:43:15 UTC (rev 291123)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/speech-api/SpeechSynthesisEvent-constructor-expected.txt 2022-03-10 20:15:28 UTC (rev 291124)
@@ -5,6 +5,6 @@
utterance)
PASS SpeechSynthesisEvent with eventInitDict not having utterance throws
TypeError
-FAIL SpeechSynthesisEvent with eventInitDict having an utterance Illegal constructor
-FAIL SpeechSynthesisEvent with custom eventInitDict Illegal constructor
+PASS SpeechSynthesisEvent with eventInitDict having an utterance
+PASS SpeechSynthesisEvent with custom eventInitDict
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/speech-api/idlharness.window-expected.txt (291123 => 291124)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/speech-api/idlharness.window-expected.txt 2022-03-10 19:43:15 UTC (rev 291123)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/speech-api/idlharness.window-expected.txt 2022-03-10 20:15:28 UTC (rev 291124)
@@ -129,27 +129,27 @@
FAIL SpeechGrammarList interface: calling addFromURI(DOMString, optional float) on new SpeechGrammarList() with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: SpeechGrammarList"
FAIL SpeechGrammarList interface: new SpeechGrammarList() must inherit property "addFromString(DOMString, optional float)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: SpeechGrammarList"
FAIL SpeechGrammarList interface: calling addFromString(DOMString, optional float) on new SpeechGrammarList() with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: SpeechGrammarList"
-FAIL SpeechSynthesis interface: existence and properties of interface object assert_own_property: self does not have own property "SpeechSynthesis" expected property "SpeechSynthesis" missing
-FAIL SpeechSynthesis interface object length assert_own_property: self does not have own property "SpeechSynthesis" expected property "SpeechSynthesis" missing
-FAIL SpeechSynthesis interface object name assert_own_property: self does not have own property "SpeechSynthesis" expected property "SpeechSynthesis" missing
-FAIL SpeechSynthesis interface: existence and properties of interface prototype object assert_own_property: self does not have own property "SpeechSynthesis" expected property "SpeechSynthesis" missing
-FAIL SpeechSynthesis interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "SpeechSynthesis" expected property "SpeechSynthesis" missing
-FAIL SpeechSynthesis interface: existence and properties of interface prototype object's @@unscopables property assert_own_property: self does not have own property "SpeechSynthesis" expected property "SpeechSynthesis" missing
-FAIL SpeechSynthesis interface: attribute pending assert_own_property: self does not have own property "SpeechSynthesis" expected property "SpeechSynthesis" missing
-FAIL SpeechSynthesis interface: attribute speaking assert_own_property: self does not have own property "SpeechSynthesis" expected property "SpeechSynthesis" missing
-FAIL SpeechSynthesis interface: attribute paused assert_own_property: self does not have own property "SpeechSynthesis" expected property "SpeechSynthesis" missing
-FAIL SpeechSynthesis interface: attribute onvoiceschanged assert_own_property: self does not have own property "SpeechSynthesis" expected property "SpeechSynthesis" missing
-FAIL SpeechSynthesis interface: operation speak(SpeechSynthesisUtterance) assert_own_property: self does not have own property "SpeechSynthesis" expected property "SpeechSynthesis" missing
-FAIL SpeechSynthesis interface: operation cancel() assert_own_property: self does not have own property "SpeechSynthesis" expected property "SpeechSynthesis" missing
-FAIL SpeechSynthesis interface: operation pause() assert_own_property: self does not have own property "SpeechSynthesis" expected property "SpeechSynthesis" missing
-FAIL SpeechSynthesis interface: operation resume() assert_own_property: self does not have own property "SpeechSynthesis" expected property "SpeechSynthesis" missing
-FAIL SpeechSynthesis interface: operation getVoices() assert_own_property: self does not have own property "SpeechSynthesis" expected property "SpeechSynthesis" missing
-FAIL SpeechSynthesis must be primary interface of speechSynthesis assert_own_property: self does not have own property "SpeechSynthesis" expected property "SpeechSynthesis" missing
+PASS SpeechSynthesis interface: existence and properties of interface object
+PASS SpeechSynthesis interface object length
+PASS SpeechSynthesis interface object name
+PASS SpeechSynthesis interface: existence and properties of interface prototype object
+PASS SpeechSynthesis interface: existence and properties of interface prototype object's "constructor" property
+PASS SpeechSynthesis interface: existence and properties of interface prototype object's @@unscopables property
+PASS SpeechSynthesis interface: attribute pending
+PASS SpeechSynthesis interface: attribute speaking
+PASS SpeechSynthesis interface: attribute paused
+PASS SpeechSynthesis interface: attribute onvoiceschanged
+PASS SpeechSynthesis interface: operation speak(SpeechSynthesisUtterance)
+PASS SpeechSynthesis interface: operation cancel()
+PASS SpeechSynthesis interface: operation pause()
+PASS SpeechSynthesis interface: operation resume()
+PASS SpeechSynthesis interface: operation getVoices()
+PASS SpeechSynthesis must be primary interface of speechSynthesis
PASS Stringification of speechSynthesis
PASS SpeechSynthesis interface: speechSynthesis must inherit property "pending" with the proper type
PASS SpeechSynthesis interface: speechSynthesis must inherit property "speaking" with the proper type
PASS SpeechSynthesis interface: speechSynthesis must inherit property "paused" with the proper type
-FAIL SpeechSynthesis interface: speechSynthesis must inherit property "onvoiceschanged" with the proper type assert_inherits: property "onvoiceschanged" not found in prototype chain
+PASS SpeechSynthesis interface: speechSynthesis must inherit property "onvoiceschanged" with the proper type
PASS SpeechSynthesis interface: speechSynthesis must inherit property "speak(SpeechSynthesisUtterance)" with the proper type
PASS SpeechSynthesis interface: calling speak(SpeechSynthesisUtterance) on speechSynthesis with too few arguments must throw TypeError
PASS SpeechSynthesis interface: speechSynthesis must inherit property "cancel()" with the proper type
@@ -191,35 +191,35 @@
PASS SpeechSynthesisUtterance interface: new SpeechSynthesisUtterance() must inherit property "onmark" with the proper type
PASS SpeechSynthesisUtterance interface: new SpeechSynthesisUtterance() must inherit property "onboundary" with the proper type
PASS SpeechSynthesisEvent interface: existence and properties of interface object
-FAIL SpeechSynthesisEvent interface object length assert_equals: wrong value for SpeechSynthesisEvent.length expected 2 but got 0
+PASS SpeechSynthesisEvent interface object length
PASS SpeechSynthesisEvent interface object name
PASS SpeechSynthesisEvent interface: existence and properties of interface prototype object
PASS SpeechSynthesisEvent interface: existence and properties of interface prototype object's "constructor" property
PASS SpeechSynthesisEvent interface: existence and properties of interface prototype object's @@unscopables property
-FAIL SpeechSynthesisEvent interface: attribute utterance assert_true: The prototype object must have a property "utterance" expected true got false
+PASS SpeechSynthesisEvent interface: attribute utterance
PASS SpeechSynthesisEvent interface: attribute charIndex
-FAIL SpeechSynthesisEvent interface: attribute charLength assert_true: The prototype object must have a property "charLength" expected true got false
+PASS SpeechSynthesisEvent interface: attribute charLength
PASS SpeechSynthesisEvent interface: attribute elapsedTime
PASS SpeechSynthesisEvent interface: attribute name
-FAIL SpeechSynthesisErrorEvent interface: existence and properties of interface object assert_own_property: self does not have own property "SpeechSynthesisErrorEvent" expected property "SpeechSynthesisErrorEvent" missing
-FAIL SpeechSynthesisErrorEvent interface object length assert_own_property: self does not have own property "SpeechSynthesisErrorEvent" expected property "SpeechSynthesisErrorEvent" missing
-FAIL SpeechSynthesisErrorEvent interface object name assert_own_property: self does not have own property "SpeechSynthesisErrorEvent" expected property "SpeechSynthesisErrorEvent" missing
-FAIL SpeechSynthesisErrorEvent interface: existence and properties of interface prototype object assert_own_property: self does not have own property "SpeechSynthesisErrorEvent" expected property "SpeechSynthesisErrorEvent" missing
-FAIL SpeechSynthesisErrorEvent interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "SpeechSynthesisErrorEvent" expected property "SpeechSynthesisErrorEvent" missing
-FAIL SpeechSynthesisErrorEvent interface: existence and properties of interface prototype object's @@unscopables property assert_own_property: self does not have own property "SpeechSynthesisErrorEvent" expected property "SpeechSynthesisErrorEvent" missing
-FAIL SpeechSynthesisErrorEvent interface: attribute error assert_own_property: self does not have own property "SpeechSynthesisErrorEvent" expected property "SpeechSynthesisErrorEvent" missing
-FAIL SpeechSynthesisVoice interface: existence and properties of interface object assert_own_property: self does not have own property "SpeechSynthesisVoice" expected property "SpeechSynthesisVoice" missing
-FAIL SpeechSynthesisVoice interface object length assert_own_property: self does not have own property "SpeechSynthesisVoice" expected property "SpeechSynthesisVoice" missing
-FAIL SpeechSynthesisVoice interface object name assert_own_property: self does not have own property "SpeechSynthesisVoice" expected property "SpeechSynthesisVoice" missing
-FAIL SpeechSynthesisVoice interface: existence and properties of interface prototype object assert_own_property: self does not have own property "SpeechSynthesisVoice" expected property "SpeechSynthesisVoice" missing
-FAIL SpeechSynthesisVoice interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "SpeechSynthesisVoice" expected property "SpeechSynthesisVoice" missing
-FAIL SpeechSynthesisVoice interface: existence and properties of interface prototype object's @@unscopables property assert_own_property: self does not have own property "SpeechSynthesisVoice" expected property "SpeechSynthesisVoice" missing
-FAIL SpeechSynthesisVoice interface: attribute voiceURI assert_own_property: self does not have own property "SpeechSynthesisVoice" expected property "SpeechSynthesisVoice" missing
-FAIL SpeechSynthesisVoice interface: attribute name assert_own_property: self does not have own property "SpeechSynthesisVoice" expected property "SpeechSynthesisVoice" missing
-FAIL SpeechSynthesisVoice interface: attribute lang assert_own_property: self does not have own property "SpeechSynthesisVoice" expected property "SpeechSynthesisVoice" missing
-FAIL SpeechSynthesisVoice interface: attribute localService assert_own_property: self does not have own property "SpeechSynthesisVoice" expected property "SpeechSynthesisVoice" missing
-FAIL SpeechSynthesisVoice interface: attribute default assert_own_property: self does not have own property "SpeechSynthesisVoice" expected property "SpeechSynthesisVoice" missing
-FAIL SpeechSynthesisVoice must be primary interface of voice assert_own_property: self does not have own property "SpeechSynthesisVoice" expected property "SpeechSynthesisVoice" missing
+PASS SpeechSynthesisErrorEvent interface: existence and properties of interface object
+PASS SpeechSynthesisErrorEvent interface object length
+PASS SpeechSynthesisErrorEvent interface object name
+PASS SpeechSynthesisErrorEvent interface: existence and properties of interface prototype object
+PASS SpeechSynthesisErrorEvent interface: existence and properties of interface prototype object's "constructor" property
+PASS SpeechSynthesisErrorEvent interface: existence and properties of interface prototype object's @@unscopables property
+PASS SpeechSynthesisErrorEvent interface: attribute error
+PASS SpeechSynthesisVoice interface: existence and properties of interface object
+PASS SpeechSynthesisVoice interface object length
+PASS SpeechSynthesisVoice interface object name
+PASS SpeechSynthesisVoice interface: existence and properties of interface prototype object
+PASS SpeechSynthesisVoice interface: existence and properties of interface prototype object's "constructor" property
+PASS SpeechSynthesisVoice interface: existence and properties of interface prototype object's @@unscopables property
+PASS SpeechSynthesisVoice interface: attribute voiceURI
+PASS SpeechSynthesisVoice interface: attribute name
+PASS SpeechSynthesisVoice interface: attribute lang
+PASS SpeechSynthesisVoice interface: attribute localService
+PASS SpeechSynthesisVoice interface: attribute default
+PASS SpeechSynthesisVoice must be primary interface of voice
PASS Stringification of voice
PASS SpeechSynthesisVoice interface: voice must inherit property "voiceURI" with the proper type
PASS SpeechSynthesisVoice interface: voice must inherit property "name" with the proper type
Modified: trunk/Source/WebCore/ChangeLog (291123 => 291124)
--- trunk/Source/WebCore/ChangeLog 2022-03-10 19:43:15 UTC (rev 291123)
+++ trunk/Source/WebCore/ChangeLog 2022-03-10 20:15:28 UTC (rev 291124)
@@ -1,3 +1,75 @@
+2022-03-10 Chris Fleizach <[email protected]>
+
+ AX: Support updated WebSpeech API
+ https://bugs.webkit.org/show_bug.cgi?id=237614
+ <rdar://problem/89981851>
+
+ Reviewed by Andres Gonzalez.
+
+ Adopt WebSpeech (18 August 2020) changes from
+ https://wicg.github.io/speech-api/
+
+ Tests Fixed:
+ imported/w3c/web-platform-tests/speech-api/
+
+ * DerivedSources-input.xcfilelist:
+ * DerivedSources-output.xcfilelist:
+ * DerivedSources.make:
+ * Modules/speech/DOMWindow+SpeechSynthesis.idl:
+ * Modules/speech/DOMWindowSpeechSynthesis.cpp:
+ (WebCore::DOMWindowSpeechSynthesis::speechSynthesis):
+ * Modules/speech/SpeechSynthesis.cpp:
+ (WebCore::Ref<SpeechSynthesis>SpeechSynthesis::create):
+ (WebCore::SpeechSynthesis::SpeechSynthesis):
+ (WebCore::SpeechSynthesis::voicesDidChange):
+ (WebCore::SpeechSynthesis::fireEvent const):
+ (WebCore::SpeechSynthesis::fireErrorEvent const):
+ (WebCore::SpeechSynthesis::handleSpeakingCompleted):
+ (WebCore::SpeechSynthesis::boundaryEventOccurred):
+ (WebCore::SpeechSynthesis::didStartSpeaking):
+ (WebCore::SpeechSynthesis::didPauseSpeaking):
+ (WebCore::SpeechSynthesis::didResumeSpeaking):
+ (WebCore::SpeechSynthesis::create): Deleted.
+ (WebCore::SpeechSynthesis::fireEvent): Deleted.
+ * Modules/speech/SpeechSynthesis.h:
+ * Modules/speech/SpeechSynthesis.idl:
+ * Modules/speech/SpeechSynthesisErrorCode.h: Added.
+ * Modules/speech/SpeechSynthesisErrorCode.idl: Copied from Source/WebCore/Modules/speech/DOMWindow+SpeechSynthesis.idl.
+ * Modules/speech/SpeechSynthesisErrorEvent.cpp: Copied from Source/WebCore/Modules/speech/SpeechSynthesisEvent.cpp.
+ (WebCore::SpeechSynthesisErrorEvent::create):
+ (WebCore::SpeechSynthesisErrorEvent::SpeechSynthesisErrorEvent):
+ * Modules/speech/SpeechSynthesisErrorEvent.h: Copied from Source/WebCore/Modules/speech/SpeechSynthesisEvent.h.
+ * Modules/speech/SpeechSynthesisErrorEvent.idl: Copied from Source/WebCore/Modules/speech/SpeechSynthesisEvent.idl.
+ * Modules/speech/SpeechSynthesisErrorEventInit.h: Copied from Source/WebCore/Modules/speech/DOMWindow+SpeechSynthesis.idl.
+ * Modules/speech/SpeechSynthesisErrorEventInit.idl: Copied from Source/WebCore/Modules/speech/DOMWindow+SpeechSynthesis.idl.
+ * Modules/speech/SpeechSynthesisEvent.cpp:
+ (WebCore::SpeechSynthesisEvent::create):
+ (WebCore::SpeechSynthesisEvent::SpeechSynthesisEvent):
+ * Modules/speech/SpeechSynthesisEvent.h:
+ (WebCore::SpeechSynthesisEvent::utterance const):
+ (WebCore::SpeechSynthesisEvent::charLength const):
+ (): Deleted.
+ * Modules/speech/SpeechSynthesisEvent.idl:
+ * Modules/speech/SpeechSynthesisEventInit.h: Copied from Source/WebCore/Modules/speech/SpeechSynthesisEvent.h.
+ (WebCore::SpeechSynthesisEventInit::SpeechSynthesisEventInit):
+ * Modules/speech/SpeechSynthesisEventInit.idl: Copied from Source/WebCore/Modules/speech/DOMWindow+SpeechSynthesis.idl.
+ * Modules/speech/SpeechSynthesisUtterance.cpp:
+ (WebCore::SpeechSynthesisUtterance::SpeechSynthesisUtterance):
+ * Modules/speech/SpeechSynthesisUtterance.h:
+ * Modules/speech/SpeechSynthesisVoice.idl:
+ * Sources.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ * dom/EventNames.h:
+ * dom/EventNames.in:
+ * dom/EventTargetFactory.in:
+ * page/SpeechSynthesisClient.h:
+ * platform/PlatformSpeechSynthesizer.h:
+ * platform/cocoa/PlatformSpeechSynthesizerCocoa.mm:
+ (-[WebSpeechSynthesisWrapper speechSynthesizer:willSpeakRangeOfSpeechString:utterance:]):
+ (WebCore::PlatformSpeechSynthesizer::initializeVoiceList):
+ * platform/mock/PlatformSpeechSynthesizerMock.cpp:
+ (WebCore::PlatformSpeechSynthesizerMock::speak):
+
2022-03-10 Chris Dumez <[email protected]>
Optimize further the passing of data across threads
Modified: trunk/Source/WebCore/DerivedSources-input.xcfilelist (291123 => 291124)
--- trunk/Source/WebCore/DerivedSources-input.xcfilelist 2022-03-10 19:43:15 UTC (rev 291123)
+++ trunk/Source/WebCore/DerivedSources-input.xcfilelist 2022-03-10 20:15:28 UTC (rev 291124)
@@ -608,7 +608,11 @@
$(PROJECT_DIR)/Modules/speech/SpeechRecognitionResult.idl
$(PROJECT_DIR)/Modules/speech/SpeechRecognitionResultList.idl
$(PROJECT_DIR)/Modules/speech/SpeechSynthesis.idl
+$(PROJECT_DIR)/Modules/speech/SpeechSynthesisErrorCode.idl
+$(PROJECT_DIR)/Modules/speech/SpeechSynthesisErrorEvent.idl
+$(PROJECT_DIR)/Modules/speech/SpeechSynthesisErrorEventInit.idl
$(PROJECT_DIR)/Modules/speech/SpeechSynthesisEvent.idl
+$(PROJECT_DIR)/Modules/speech/SpeechSynthesisEventInit.idl
$(PROJECT_DIR)/Modules/speech/SpeechSynthesisUtterance.idl
$(PROJECT_DIR)/Modules/speech/SpeechSynthesisVoice.idl
$(PROJECT_DIR)/Modules/storage/StorageManager.idl
Modified: trunk/Source/WebCore/DerivedSources-output.xcfilelist (291123 => 291124)
--- trunk/Source/WebCore/DerivedSources-output.xcfilelist 2022-03-10 19:43:15 UTC (rev 291123)
+++ trunk/Source/WebCore/DerivedSources-output.xcfilelist 2022-03-10 20:15:28 UTC (rev 291124)
@@ -2516,8 +2516,16 @@
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSSpeechRecognitionResultList.h
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSSpeechSynthesis.cpp
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSSpeechSynthesis.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSSpeechSynthesisErrorCode.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSSpeechSynthesisErrorCode.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSSpeechSynthesisErrorEvent.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSSpeechSynthesisErrorEvent.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSSpeechSynthesisErrorEventInit.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSSpeechSynthesisErrorEventInit.h
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSSpeechSynthesisEvent.cpp
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSSpeechSynthesisEvent.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSSpeechSynthesisEventInit.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSSpeechSynthesisEventInit.h
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSSpeechSynthesisUtterance.cpp
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSSpeechSynthesisUtterance.h
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSSpeechSynthesisVoice.cpp
Modified: trunk/Source/WebCore/DerivedSources.make (291123 => 291124)
--- trunk/Source/WebCore/DerivedSources.make 2022-03-10 19:43:15 UTC (rev 291123)
+++ trunk/Source/WebCore/DerivedSources.make 2022-03-10 20:15:28 UTC (rev 291124)
@@ -521,7 +521,11 @@
$(WebCore)/Modules/remoteplayback/RemotePlaybackAvailabilityCallback.idl \
$(WebCore)/Modules/speech/DOMWindow+SpeechSynthesis.idl \
$(WebCore)/Modules/speech/SpeechSynthesis.idl \
+ $(WebCore)/Modules/speech/SpeechSynthesisErrorCode.idl \
+ $(WebCore)/Modules/speech/SpeechSynthesisErrorEvent.idl \
+ $(WebCore)/Modules/speech/SpeechSynthesisErrorEventInit.idl \
$(WebCore)/Modules/speech/SpeechSynthesisEvent.idl \
+ $(WebCore)/Modules/speech/SpeechSynthesisEventInit.idl \
$(WebCore)/Modules/speech/SpeechSynthesisUtterance.idl \
$(WebCore)/Modules/speech/SpeechSynthesisVoice.idl \
$(WebCore)/Modules/speech/SpeechRecognition.idl \
Modified: trunk/Source/WebCore/Modules/credentialmanagement/BasicCredential.h (291123 => 291124)
--- trunk/Source/WebCore/Modules/credentialmanagement/BasicCredential.h 2022-03-10 19:43:15 UTC (rev 291123)
+++ trunk/Source/WebCore/Modules/credentialmanagement/BasicCredential.h 2022-03-10 20:15:28 UTC (rev 291124)
@@ -27,6 +27,9 @@
#if ENABLE(WEB_AUTHN)
+#include "Document.h"
+#include "IDLTypes.h"
+#include "JSDOMPromiseDeferred.h"
#include <wtf/RefCounted.h>
#include <wtf/TypeCasts.h>
#include <wtf/text/WTFString.h>
Modified: trunk/Source/WebCore/Modules/speech/DOMWindow+SpeechSynthesis.idl (291123 => 291124)
--- trunk/Source/WebCore/Modules/speech/DOMWindow+SpeechSynthesis.idl 2022-03-10 19:43:15 UTC (rev 291123)
+++ trunk/Source/WebCore/Modules/speech/DOMWindow+SpeechSynthesis.idl 2022-03-10 20:15:28 UTC (rev 291124)
@@ -27,5 +27,5 @@
Conditional=SPEECH_SYNTHESIS,
ImplementedBy=DOMWindowSpeechSynthesis
] partial interface DOMWindow {
- readonly attribute SpeechSynthesis speechSynthesis;
+ [SameObject] readonly attribute SpeechSynthesis speechSynthesis;
};
Modified: trunk/Source/WebCore/Modules/speech/DOMWindowSpeechSynthesis.cpp (291123 => 291124)
--- trunk/Source/WebCore/Modules/speech/DOMWindowSpeechSynthesis.cpp 2022-03-10 19:43:15 UTC (rev 291123)
+++ trunk/Source/WebCore/Modules/speech/DOMWindowSpeechSynthesis.cpp 2022-03-10 20:15:28 UTC (rev 291124)
@@ -71,7 +71,7 @@
SpeechSynthesis* DOMWindowSpeechSynthesis::speechSynthesis()
{
if (!m_speechSynthesis && frame() && frame()->document())
- m_speechSynthesis = SpeechSynthesis::create(frame()->page()->speechSynthesisClient(), *frame()->document());
+ m_speechSynthesis = SpeechSynthesis::create(*frame()->document());
return m_speechSynthesis.get();
}
Modified: trunk/Source/WebCore/Modules/speech/SpeechSynthesis.cpp (291123 => 291124)
--- trunk/Source/WebCore/Modules/speech/SpeechSynthesis.cpp 2022-03-10 19:43:15 UTC (rev 291123)
+++ trunk/Source/WebCore/Modules/speech/SpeechSynthesis.cpp 2022-03-10 20:15:28 UTC (rev 291124)
@@ -28,36 +28,42 @@
#if ENABLE(SPEECH_SYNTHESIS)
+#include "Document.h"
#include "EventNames.h"
+#include "Frame.h"
+#include "Page.h"
#include "PlatformSpeechSynthesisVoice.h"
#include "PlatformSpeechSynthesizer.h"
+#include "SpeechSynthesisErrorEvent.h"
#include "SpeechSynthesisEvent.h"
#include "SpeechSynthesisUtterance.h"
#include "UserGestureIndicator.h"
+#include <wtf/IsoMallocInlines.h>
#include <wtf/NeverDestroyed.h>
-#if PLATFORM(IOS_FAMILY)
-#include "Document.h"
-#endif
-
namespace WebCore {
-Ref<SpeechSynthesis> SpeechSynthesis::create(WeakPtr<SpeechSynthesisClient> client, Document& document)
+WTF_MAKE_ISO_ALLOCATED_IMPL(SpeechSynthesis);
+
+Ref<SpeechSynthesis>SpeechSynthesis::create(ScriptExecutionContext& context)
{
- return adoptRef(*new SpeechSynthesis(client, document));
+ return adoptRef(*new SpeechSynthesis(context));
}
-SpeechSynthesis::SpeechSynthesis(WeakPtr<SpeechSynthesisClient> client, Document& document)
- : m_currentSpeechUtterance(nullptr)
+SpeechSynthesis::SpeechSynthesis(ScriptExecutionContext& context)
+ : ContextDestructionObserver(&context)
+ , m_currentSpeechUtterance(nullptr)
, m_isPaused(false)
+ , m_restrictions(NoRestrictions)
+ , m_speechSynthesisClient(nullptr)
+{
+ if (context.isDocument()) {
#if PLATFORM(IOS_FAMILY)
- , m_restrictions(document.audioPlaybackRequiresUserGesture() ? RequireUserGestureForSpeechStartRestriction : NoRestrictions)
+ if (downcast<Document>(context).audioPlaybackRequiresUserGesture())
+ m_restrictions = RequireUserGestureForSpeechStartRestriction;
#endif
- , m_speechSynthesisClient(client)
-{
-#if !PLATFORM(IOS_FAMILY)
- UNUSED_PARAM(document);
-#endif
+ m_speechSynthesisClient = downcast<Document>(context).frame()->page()->speechSynthesisClient();
+ }
if (m_speechSynthesisClient) {
m_speechSynthesisClient->setObserver(*this);
@@ -65,6 +71,8 @@
}
}
+SpeechSynthesis::~SpeechSynthesis() = default;
+
void SpeechSynthesis::setPlatformSynthesizer(std::unique_ptr<PlatformSpeechSynthesizer> synthesizer)
{
m_platformSpeechSynthesizer = WTFMove(synthesizer);
@@ -78,6 +86,7 @@
void SpeechSynthesis::voicesDidChange()
{
m_voiceList.clear();
+ dispatchEvent(Event::create(eventNames().voiceschangedEvent, Event::CanBubble::No, Event::IsCancelable::No));
}
PlatformSpeechSynthesizer& SpeechSynthesis::ensurePlatformSpeechSynthesizer()
@@ -187,11 +196,16 @@
}
}
-void SpeechSynthesis::fireEvent(const AtomString& type, SpeechSynthesisUtterance& utterance, unsigned long charIndex, const String& name)
+void SpeechSynthesis::fireEvent(const AtomString& type, SpeechSynthesisUtterance& utterance, unsigned long charIndex, unsigned long charLength, const String& name) const
{
- utterance.dispatchEvent(SpeechSynthesisEvent::create(type, charIndex, (MonotonicTime::now() - utterance.startTime()).seconds(), name));
+ utterance.dispatchEvent(SpeechSynthesisEvent::create(type, { &utterance, charIndex, charLength, static_cast<float>((MonotonicTime::now() - utterance.startTime()).seconds()), name }));
}
+void SpeechSynthesis::fireErrorEvent(const AtomString& type, SpeechSynthesisUtterance& utterance, SpeechSynthesisErrorCode errorCode) const
+{
+ utterance.dispatchEvent(SpeechSynthesisErrorEvent::create(type, { { &utterance, 0, 0, static_cast<float>((MonotonicTime::now() - utterance.startTime()).seconds()), { } }, errorCode }));
+}
+
void SpeechSynthesis::handleSpeakingCompleted(SpeechSynthesisUtterance& utterance, bool errorOccurred)
{
ASSERT(m_currentSpeechUtterance);
@@ -199,8 +213,11 @@
m_currentSpeechUtterance = nullptr;
- fireEvent(errorOccurred ? eventNames().errorEvent : eventNames().endEvent, utterance, 0, String());
-
+ if (errorOccurred)
+ fireErrorEvent(eventNames().errorEvent, utterance, SpeechSynthesisErrorCode::Canceled);
+ else
+ fireEvent(eventNames().endEvent, utterance, 0, 0, String());
+
if (m_utteranceQueue.size()) {
Ref<SpeechSynthesisUtterance> firstUtterance = m_utteranceQueue.takeFirst();
ASSERT(&utterance == firstUtterance.ptr());
@@ -211,7 +228,7 @@
}
}
-void SpeechSynthesis::boundaryEventOccurred(PlatformSpeechSynthesisUtterance& utterance, SpeechBoundary boundary, unsigned charIndex)
+void SpeechSynthesis::boundaryEventOccurred(PlatformSpeechSynthesisUtterance& utterance, SpeechBoundary boundary, unsigned charIndex, unsigned charLength)
{
static NeverDestroyed<const String> wordBoundaryString(MAKE_STATIC_STRING_IMPL("word"));
static NeverDestroyed<const String> sentenceBoundaryString(MAKE_STATIC_STRING_IMPL("sentence"));
@@ -220,10 +237,10 @@
switch (boundary) {
case SpeechBoundary::SpeechWordBoundary:
- fireEvent(eventNames().boundaryEvent, static_cast<SpeechSynthesisUtterance&>(*utterance.client()), charIndex, wordBoundaryString);
+ fireEvent(eventNames().boundaryEvent, static_cast<SpeechSynthesisUtterance&>(*utterance.client()), charIndex, charLength, wordBoundaryString);
break;
case SpeechBoundary::SpeechSentenceBoundary:
- fireEvent(eventNames().boundaryEvent, static_cast<SpeechSynthesisUtterance&>(*utterance.client()), charIndex, sentenceBoundaryString);
+ fireEvent(eventNames().boundaryEvent, static_cast<SpeechSynthesisUtterance&>(*utterance.client()), charIndex, charLength, sentenceBoundaryString);
break;
default:
ASSERT_NOT_REACHED();
@@ -265,11 +282,11 @@
speakingErrorOccurred(*m_currentSpeechUtterance->platformUtterance());
}
-void SpeechSynthesis::boundaryEventOccurred(bool wordBoundary, unsigned charIndex)
+void SpeechSynthesis::boundaryEventOccurred(bool wordBoundary, unsigned charIndex, unsigned charLength)
{
if (!m_currentSpeechUtterance)
return;
- boundaryEventOccurred(*m_currentSpeechUtterance->platformUtterance(), wordBoundary ? SpeechBoundary::SpeechWordBoundary : SpeechBoundary::SpeechSentenceBoundary, charIndex);
+ boundaryEventOccurred(*m_currentSpeechUtterance->platformUtterance(), wordBoundary ? SpeechBoundary::SpeechWordBoundary : SpeechBoundary::SpeechSentenceBoundary, charIndex, charLength);
}
void SpeechSynthesis::voicesChanged()
@@ -280,7 +297,7 @@
void SpeechSynthesis::didStartSpeaking(PlatformSpeechSynthesisUtterance& utterance)
{
if (utterance.client())
- fireEvent(eventNames().startEvent, static_cast<SpeechSynthesisUtterance&>(*utterance.client()), 0, String());
+ fireEvent(eventNames().startEvent, static_cast<SpeechSynthesisUtterance&>(*utterance.client()), 0, 0, String());
}
void SpeechSynthesis::didPauseSpeaking(PlatformSpeechSynthesisUtterance& utterance)
@@ -287,7 +304,7 @@
{
m_isPaused = true;
if (utterance.client())
- fireEvent(eventNames().pauseEvent, static_cast<SpeechSynthesisUtterance&>(*utterance.client()), 0, String());
+ fireEvent(eventNames().pauseEvent, static_cast<SpeechSynthesisUtterance&>(*utterance.client()), 0, 0, String());
}
void SpeechSynthesis::didResumeSpeaking(PlatformSpeechSynthesisUtterance& utterance)
@@ -294,7 +311,7 @@
{
m_isPaused = false;
if (utterance.client())
- fireEvent(eventNames().resumeEvent, static_cast<SpeechSynthesisUtterance&>(*utterance.client()), 0, String());
+ fireEvent(eventNames().resumeEvent, static_cast<SpeechSynthesisUtterance&>(*utterance.client()), 0, 0, String());
}
void SpeechSynthesis::didFinishSpeaking(PlatformSpeechSynthesisUtterance& utterance)
Modified: trunk/Source/WebCore/Modules/speech/SpeechSynthesis.h (291123 => 291124)
--- trunk/Source/WebCore/Modules/speech/SpeechSynthesis.h 2022-03-10 19:43:15 UTC (rev 291123)
+++ trunk/Source/WebCore/Modules/speech/SpeechSynthesis.h 2022-03-10 20:15:28 UTC (rev 291124)
@@ -30,6 +30,7 @@
#include "PlatformSpeechSynthesisUtterance.h"
#include "PlatformSpeechSynthesizer.h"
#include "SpeechSynthesisClient.h"
+#include "SpeechSynthesisErrorCode.h"
#include "SpeechSynthesisUtterance.h"
#include "SpeechSynthesisVoice.h"
#include <wtf/Deque.h>
@@ -41,10 +42,15 @@
class PlatformSpeechSynthesizerClient;
class SpeechSynthesisVoice;
-class SpeechSynthesis : public PlatformSpeechSynthesizerClient, public SpeechSynthesisClientObserver, public RefCounted<SpeechSynthesis> {
+class SpeechSynthesis : public PlatformSpeechSynthesizerClient, public SpeechSynthesisClientObserver, public RefCounted<SpeechSynthesis>, public ContextDestructionObserver, public EventTargetWithInlineData {
+ WTF_MAKE_ISO_ALLOCATED(SpeechSynthesis);
public:
- static Ref<SpeechSynthesis> create(WeakPtr<SpeechSynthesisClient>, Document&);
+ static Ref<SpeechSynthesis> create(ScriptExecutionContext&);
+ virtual ~SpeechSynthesis();
+ using RefCounted::ref;
+ using RefCounted::deref;
+
bool pending() const;
bool speaking() const;
bool paused() const;
@@ -60,7 +66,7 @@
WEBCORE_EXPORT void setPlatformSynthesizer(std::unique_ptr<PlatformSpeechSynthesizer>);
private:
- SpeechSynthesis(WeakPtr<SpeechSynthesisClient>, Document&);
+ SpeechSynthesis(ScriptExecutionContext&);
// PlatformSpeechSynthesizerClient override methods.
void voicesDidChange() override;
@@ -69,7 +75,7 @@
void didResumeSpeaking(PlatformSpeechSynthesisUtterance&) override;
void didFinishSpeaking(PlatformSpeechSynthesisUtterance&) override;
void speakingErrorOccurred(PlatformSpeechSynthesisUtterance&) override;
- void boundaryEventOccurred(PlatformSpeechSynthesisUtterance&, SpeechBoundary, unsigned charIndex) override;
+ void boundaryEventOccurred(PlatformSpeechSynthesisUtterance&, SpeechBoundary, unsigned charIndex, unsigned charLength) override;
// SpeechSynthesisClient override methods
void didStartSpeaking() override;
@@ -77,14 +83,14 @@
void didPauseSpeaking() override;
void didResumeSpeaking() override;
void speakingErrorOccurred() override;
- void boundaryEventOccurred(bool wordBoundary, unsigned charIndex) override;
+ void boundaryEventOccurred(bool wordBoundary, unsigned charIndex, unsigned charLength) override;
void voicesChanged() override;
void startSpeakingImmediately(SpeechSynthesisUtterance&);
void handleSpeakingCompleted(SpeechSynthesisUtterance&, bool errorOccurred);
- void fireEvent(const AtomString& type, SpeechSynthesisUtterance&, unsigned long charIndex, const String& name);
+ void fireEvent(const AtomString& type, SpeechSynthesisUtterance&, unsigned long charIndex, unsigned long charLength, const String& name) const;
+ void fireErrorEvent(const AtomString& type, SpeechSynthesisUtterance&, SpeechSynthesisErrorCode) const;
-#if PLATFORM(IOS_FAMILY)
// Restrictions to change default behaviors.
enum BehaviorRestrictionFlags {
NoRestrictions = 0,
@@ -94,7 +100,12 @@
bool userGestureRequiredForSpeechStart() const { return m_restrictions & RequireUserGestureForSpeechStartRestriction; }
void removeBehaviorRestriction(BehaviorRestrictions restriction) { m_restrictions &= ~restriction; }
-#endif
+
+ ScriptExecutionContext* scriptExecutionContext() const final { return ContextDestructionObserver::scriptExecutionContext(); }
+ EventTargetInterface eventTargetInterface() const final { return SpeechSynthesisEventTargetInterfaceType; }
+ void refEventTarget() final { ref(); }
+ void derefEventTarget() final { deref(); }
+
PlatformSpeechSynthesizer& ensurePlatformSpeechSynthesizer();
std::unique_ptr<PlatformSpeechSynthesizer> m_platformSpeechSynthesizer;
@@ -102,9 +113,7 @@
RefPtr<SpeechSynthesisUtterance> m_currentSpeechUtterance;
Deque<Ref<SpeechSynthesisUtterance>> m_utteranceQueue;
bool m_isPaused;
-#if PLATFORM(IOS_FAMILY)
BehaviorRestrictions m_restrictions;
-#endif
WeakPtr<SpeechSynthesisClient> m_speechSynthesisClient;
};
Modified: trunk/Source/WebCore/Modules/speech/SpeechSynthesis.idl (291123 => 291124)
--- trunk/Source/WebCore/Modules/speech/SpeechSynthesis.idl 2022-03-10 19:43:15 UTC (rev 291123)
+++ trunk/Source/WebCore/Modules/speech/SpeechSynthesis.idl 2022-03-10 20:15:28 UTC (rev 291124)
@@ -24,15 +24,17 @@
*/
// https://wicg.github.io/speech-api/#speechsynthesis
-// FIXME: This is not specified as "LegacyNoInterfaceObject". It should have an interface object and be Exposed=Window.
[
Conditional=SPEECH_SYNTHESIS,
- LegacyNoInterfaceObject,
-] interface SpeechSynthesis {
+ Exposed=Window,
+] interface SpeechSynthesis : EventTarget {
+
readonly attribute boolean pending;
readonly attribute boolean speaking;
readonly attribute boolean paused;
+ attribute EventHandler onvoiceschanged;
+
undefined speak(SpeechSynthesisUtterance utterance);
undefined cancel();
undefined pause();
Added: trunk/Source/WebCore/Modules/speech/SpeechSynthesisErrorCode.h (0 => 291124)
--- trunk/Source/WebCore/Modules/speech/SpeechSynthesisErrorCode.h (rev 0)
+++ trunk/Source/WebCore/Modules/speech/SpeechSynthesisErrorCode.h 2022-03-10 20:15:28 UTC (rev 291124)
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2022 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(SPEECH_SYNTHESIS)
+
+namespace WebCore {
+
+enum class SpeechSynthesisErrorCode {
+ Canceled,
+ Interrupted,
+ AudioBusy,
+ AudioHardware,
+ Network,
+ SynthesisUnavailable,
+ SynthesisFailed,
+ LanguageUnavailable,
+ VoiceUnavailable,
+ TextTooLong,
+ InvalidArgument,
+ NotAllowed
+};
+
+}; // namespace WebCore
+
+#endif
Copied: trunk/Source/WebCore/Modules/speech/SpeechSynthesisErrorCode.idl (from rev 291123, trunk/Source/WebCore/Modules/speech/DOMWindow+SpeechSynthesis.idl) (0 => 291124)
--- trunk/Source/WebCore/Modules/speech/SpeechSynthesisErrorCode.idl (rev 0)
+++ trunk/Source/WebCore/Modules/speech/SpeechSynthesisErrorCode.idl 2022-03-10 20:15:28 UTC (rev 291124)
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2022 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+[
+ Conditional=SPEECH_SYNTHESIS
+] enum SpeechSynthesisErrorCode {
+ "canceled",
+ "interrupted",
+ "audio-busy",
+ "audio-hardware",
+ "network",
+ "synthesis-unavailable",
+ "synthesis-failed",
+ "language-unavailable",
+ "voice-unavailable",
+ "text-too-long",
+ "invalid-argument",
+ "not-allowed"
+};
Copied: trunk/Source/WebCore/Modules/speech/SpeechSynthesisErrorEvent.cpp (from rev 291123, trunk/Source/WebCore/Modules/speech/SpeechSynthesisEvent.cpp) (0 => 291124)
--- trunk/Source/WebCore/Modules/speech/SpeechSynthesisErrorEvent.cpp (rev 0)
+++ trunk/Source/WebCore/Modules/speech/SpeechSynthesisErrorEvent.cpp 2022-03-10 20:15:28 UTC (rev 291124)
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2022 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "SpeechSynthesisErrorEvent.h"
+
+#if ENABLE(SPEECH_SYNTHESIS)
+
+#include <wtf/IsoMallocInlines.h>
+
+namespace WebCore {
+
+WTF_MAKE_ISO_ALLOCATED_IMPL(SpeechSynthesisErrorEvent);
+
+Ref<SpeechSynthesisErrorEvent> SpeechSynthesisErrorEvent::create(const AtomString& type, const SpeechSynthesisErrorEventInit& initializer)
+{
+ return adoptRef(*new SpeechSynthesisErrorEvent(type, initializer));
+}
+
+SpeechSynthesisErrorEvent::SpeechSynthesisErrorEvent(const AtomString& type, const SpeechSynthesisErrorEventInit& initializer)
+ : SpeechSynthesisEvent(type, initializer)
+ , m_error(initializer.error)
+{
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(SPEECH_SYNTHESIS)
Copied: trunk/Source/WebCore/Modules/speech/SpeechSynthesisErrorEvent.h (from rev 291123, trunk/Source/WebCore/Modules/speech/SpeechSynthesisEvent.h) (0 => 291124)
--- trunk/Source/WebCore/Modules/speech/SpeechSynthesisErrorEvent.h (rev 0)
+++ trunk/Source/WebCore/Modules/speech/SpeechSynthesisErrorEvent.h 2022-03-10 20:15:28 UTC (rev 291124)
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2022 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(SPEECH_SYNTHESIS)
+
+#include "SpeechSynthesisErrorCode.h"
+#include "SpeechSynthesisErrorEventInit.h"
+#include "SpeechSynthesisEvent.h"
+
+namespace WebCore {
+
+class SpeechSynthesisErrorEvent final : public SpeechSynthesisEvent {
+ WTF_MAKE_ISO_ALLOCATED(SpeechSynthesisErrorEvent);
+public:
+
+ static Ref<SpeechSynthesisErrorEvent> create(const AtomString& type, const SpeechSynthesisErrorEventInit&);
+
+ SpeechSynthesisErrorCode error() const { return m_error; }
+
+ virtual EventInterface eventInterface() const { return SpeechSynthesisErrorEventInterfaceType; }
+
+private:
+ SpeechSynthesisErrorEvent(const AtomString& type, const SpeechSynthesisErrorEventInit&);
+
+ SpeechSynthesisErrorCode m_error;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(SPEECH_SYNTHESIS)
Copied: trunk/Source/WebCore/Modules/speech/SpeechSynthesisErrorEvent.idl (from rev 291123, trunk/Source/WebCore/Modules/speech/SpeechSynthesisEvent.idl) (0 => 291124)
--- trunk/Source/WebCore/Modules/speech/SpeechSynthesisErrorEvent.idl (rev 0)
+++ trunk/Source/WebCore/Modules/speech/SpeechSynthesisErrorEvent.idl 2022-03-10 20:15:28 UTC (rev 291124)
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2022 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// https://wicg.github.io/speech-api/#speechsynthesiserrorevent
+[
+ Conditional=SPEECH_SYNTHESIS,
+ Exposed=Window
+] interface SpeechSynthesisErrorEvent : SpeechSynthesisEvent {
+ constructor(DOMString type, SpeechSynthesisErrorEventInit eventInitDict);
+
+ readonly attribute SpeechSynthesisErrorCode error;
+};
Copied: trunk/Source/WebCore/Modules/speech/SpeechSynthesisErrorEventInit.h (from rev 291123, trunk/Source/WebCore/Modules/speech/DOMWindow+SpeechSynthesis.idl) (0 => 291124)
--- trunk/Source/WebCore/Modules/speech/SpeechSynthesisErrorEventInit.h (rev 0)
+++ trunk/Source/WebCore/Modules/speech/SpeechSynthesisErrorEventInit.h 2022-03-10 20:15:28 UTC (rev 291124)
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2022 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(SPEECH_SYNTHESIS)
+
+#include "SpeechSynthesisEventInit.h"
+
+namespace WebCore {
+
+struct SpeechSynthesisErrorEventInit : SpeechSynthesisEventInit {
+ SpeechSynthesisErrorCode error;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(SPEECH_SYNTHESIS)
Copied: trunk/Source/WebCore/Modules/speech/SpeechSynthesisErrorEventInit.idl (from rev 291123, trunk/Source/WebCore/Modules/speech/DOMWindow+SpeechSynthesis.idl) (0 => 291124)
--- trunk/Source/WebCore/Modules/speech/SpeechSynthesisErrorEventInit.idl (rev 0)
+++ trunk/Source/WebCore/Modules/speech/SpeechSynthesisErrorEventInit.idl 2022-03-10 20:15:28 UTC (rev 291124)
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2022 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+[
+ Conditional=SPEECH_SYNTHESIS
+] dictionary SpeechSynthesisErrorEventInit : SpeechSynthesisEventInit {
+ required SpeechSynthesisErrorCode error;
+};
Modified: trunk/Source/WebCore/Modules/speech/SpeechSynthesisEvent.cpp (291123 => 291124)
--- trunk/Source/WebCore/Modules/speech/SpeechSynthesisEvent.cpp 2022-03-10 19:43:15 UTC (rev 291123)
+++ trunk/Source/WebCore/Modules/speech/SpeechSynthesisEvent.cpp 2022-03-10 20:15:28 UTC (rev 291124)
@@ -34,16 +34,18 @@
WTF_MAKE_ISO_ALLOCATED_IMPL(SpeechSynthesisEvent);
-Ref<SpeechSynthesisEvent> SpeechSynthesisEvent::create(const AtomString& type, unsigned charIndex, float elapsedTime, const String& name)
+Ref<SpeechSynthesisEvent> SpeechSynthesisEvent::create(const AtomString& type, const SpeechSynthesisEventInit& initializer)
{
- return adoptRef(*new SpeechSynthesisEvent(type, charIndex, elapsedTime, name));
+ return adoptRef(*new SpeechSynthesisEvent(type, initializer));
}
-SpeechSynthesisEvent::SpeechSynthesisEvent(const AtomString& type, unsigned charIndex, float elapsedTime, const String& name)
+SpeechSynthesisEvent::SpeechSynthesisEvent(const AtomString& type, const SpeechSynthesisEventInit& initializer)
: Event(type, CanBubble::No, IsCancelable::No)
- , m_charIndex(charIndex)
- , m_elapsedTime(elapsedTime)
- , m_name(name)
+ , m_utterance(initializer.utterance)
+ , m_charIndex(initializer.charIndex)
+ , m_charLength(initializer.charLength)
+ , m_elapsedTime(initializer.elapsedTime)
+ , m_name(initializer.name)
{
}
Modified: trunk/Source/WebCore/Modules/speech/SpeechSynthesisEvent.h (291123 => 291124)
--- trunk/Source/WebCore/Modules/speech/SpeechSynthesisEvent.h 2022-03-10 19:43:15 UTC (rev 291123)
+++ trunk/Source/WebCore/Modules/speech/SpeechSynthesisEvent.h 2022-03-10 20:15:28 UTC (rev 291124)
@@ -28,24 +28,32 @@
#if ENABLE(SPEECH_SYNTHESIS)
#include "Event.h"
+#include "SpeechSynthesisEventInit.h"
+#include "SpeechSynthesisUtterance.h"
namespace WebCore {
-class SpeechSynthesisEvent final : public Event {
+class SpeechSynthesisEvent : public Event {
WTF_MAKE_ISO_ALLOCATED(SpeechSynthesisEvent);
public:
- static Ref<SpeechSynthesisEvent> create(const AtomString& type, unsigned charIndex, float elapsedTime, const String& name);
+
+ static Ref<SpeechSynthesisEvent> create(const AtomString& type, const SpeechSynthesisEventInit&);
+ const SpeechSynthesisUtterance* utterance() const { return m_utterance.get(); }
unsigned long charIndex() const { return m_charIndex; }
+ unsigned long charLength() const { return m_charLength; }
float elapsedTime() const { return m_elapsedTime; }
const String& name() const { return m_name; }
virtual EventInterface eventInterface() const { return SpeechSynthesisEventInterfaceType; }
+protected:
+ SpeechSynthesisEvent(const AtomString& type, const SpeechSynthesisEventInit&);
+
private:
- SpeechSynthesisEvent(const AtomString& type, unsigned charIndex, float elapsedTime, const String& name);
-
+ RefPtr<SpeechSynthesisUtterance> m_utterance;
unsigned long m_charIndex;
+ unsigned long m_charLength;
float m_elapsedTime;
String m_name;
};
Modified: trunk/Source/WebCore/Modules/speech/SpeechSynthesisEvent.idl (291123 => 291124)
--- trunk/Source/WebCore/Modules/speech/SpeechSynthesisEvent.idl 2022-03-10 19:43:15 UTC (rev 291123)
+++ trunk/Source/WebCore/Modules/speech/SpeechSynthesisEvent.idl 2022-03-10 20:15:28 UTC (rev 291124)
@@ -20,7 +20,7 @@
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
// https://wicg.github.io/speech-api/#speechsynthesisevent
@@ -28,7 +28,11 @@
Conditional=SPEECH_SYNTHESIS,
Exposed=Window
] interface SpeechSynthesisEvent : Event {
+ constructor(DOMString type, SpeechSynthesisEventInit eventInitDict);
+
+ readonly attribute SpeechSynthesisUtterance utterance;
readonly attribute unsigned long charIndex;
+ readonly attribute unsigned long charLength;
readonly attribute unrestricted float elapsedTime;
readonly attribute DOMString name;
};
Copied: trunk/Source/WebCore/Modules/speech/SpeechSynthesisEventInit.h (from rev 291123, trunk/Source/WebCore/Modules/speech/SpeechSynthesisEvent.h) (0 => 291124)
--- trunk/Source/WebCore/Modules/speech/SpeechSynthesisEventInit.h (rev 0)
+++ trunk/Source/WebCore/Modules/speech/SpeechSynthesisEventInit.h 2022-03-10 20:15:28 UTC (rev 291124)
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(SPEECH_SYNTHESIS)
+
+#include "EventInit.h"
+#include "SpeechSynthesisUtterance.h"
+
+namespace WebCore {
+
+struct SpeechSynthesisEventInit : EventInit {
+
+ // Generated code expects a default constructor
+ SpeechSynthesisEventInit()
+ : EventInit()
+ , utterance(nullptr)
+ { }
+
+ SpeechSynthesisEventInit(SpeechSynthesisUtterance* utterance, unsigned long charIndex, unsigned long charLength, float elapsedTime, const String& name)
+ : EventInit()
+ , utterance(utterance)
+ , charIndex(charIndex)
+ , charLength(charLength)
+ , elapsedTime(elapsedTime)
+ , name(name)
+ { }
+
+ RefPtr<SpeechSynthesisUtterance> utterance;
+ unsigned long charIndex;
+ unsigned long charLength;
+ float elapsedTime;
+ String name;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(SPEECH_SYNTHESIS)
Copied: trunk/Source/WebCore/Modules/speech/SpeechSynthesisEventInit.idl (from rev 291123, trunk/Source/WebCore/Modules/speech/DOMWindow+SpeechSynthesis.idl) (0 => 291124)
--- trunk/Source/WebCore/Modules/speech/SpeechSynthesisEventInit.idl (rev 0)
+++ trunk/Source/WebCore/Modules/speech/SpeechSynthesisEventInit.idl 2022-03-10 20:15:28 UTC (rev 291124)
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2022 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// https://wicg.github.io/speech-api/#speechsynthesiseventinit
+[
+ Conditional=SPEECH_SYNTHESIS
+] dictionary SpeechSynthesisEventInit : EventInit {
+ required SpeechSynthesisUtterance utterance;
+ unsigned long charIndex = 0;
+ unsigned long charLength = 0;
+ float elapsedTime = 0;
+ DOMString name = "";
+};
Modified: trunk/Source/WebCore/Modules/speech/SpeechSynthesisUtterance.cpp (291123 => 291124)
--- trunk/Source/WebCore/Modules/speech/SpeechSynthesisUtterance.cpp 2022-03-10 19:43:15 UTC (rev 291123)
+++ trunk/Source/WebCore/Modules/speech/SpeechSynthesisUtterance.cpp 2022-03-10 20:15:28 UTC (rev 291124)
@@ -40,8 +40,8 @@
}
SpeechSynthesisUtterance::SpeechSynthesisUtterance(ScriptExecutionContext& context, const String& text)
- : ContextDestructionObserver(&context)
- , m_platformUtterance(PlatformSpeechSynthesisUtterance::create(*this))
+ : m_platformUtterance(PlatformSpeechSynthesisUtterance::create(*this))
+ , m_scriptExecutionContext(context)
{
m_platformUtterance->setText(text);
}
Modified: trunk/Source/WebCore/Modules/speech/SpeechSynthesisUtterance.h (291123 => 291124)
--- trunk/Source/WebCore/Modules/speech/SpeechSynthesisUtterance.h 2022-03-10 19:43:15 UTC (rev 291123)
+++ trunk/Source/WebCore/Modules/speech/SpeechSynthesisUtterance.h 2022-03-10 20:15:28 UTC (rev 291124)
@@ -35,10 +35,13 @@
namespace WebCore {
-class SpeechSynthesisUtterance final : public PlatformSpeechSynthesisUtteranceClient, public RefCounted<SpeechSynthesisUtterance>, public ContextDestructionObserver, public EventTargetWithInlineData {
+class SpeechSynthesisUtterance final : public PlatformSpeechSynthesisUtteranceClient, public RefCounted<SpeechSynthesisUtterance>, public EventTargetWithInlineData {
WTF_MAKE_ISO_ALLOCATED(SpeechSynthesisUtterance);
public:
static Ref<SpeechSynthesisUtterance> create(ScriptExecutionContext&, const String&);
+
+ // Create an empty default constructor so SpeechSynthesisEventInit compiles.
+ SpeechSynthesisUtterance();
virtual ~SpeechSynthesisUtterance();
@@ -68,10 +71,12 @@
PlatformSpeechSynthesisUtterance* platformUtterance() const { return m_platformUtterance.get(); }
+ SpeechSynthesisUtterance(const SpeechSynthesisUtterance&);
+
private:
SpeechSynthesisUtterance(ScriptExecutionContext&, const String&);
- ScriptExecutionContext* scriptExecutionContext() const final { return ContextDestructionObserver::scriptExecutionContext(); }
+ ScriptExecutionContext* scriptExecutionContext() const final { return &m_scriptExecutionContext; }
EventTargetInterface eventTargetInterface() const final { return SpeechSynthesisUtteranceEventTargetInterfaceType; }
void refEventTarget() final { ref(); }
void derefEventTarget() final { deref(); }
@@ -78,6 +83,7 @@
RefPtr<PlatformSpeechSynthesisUtterance> m_platformUtterance;
RefPtr<SpeechSynthesisVoice> m_voice;
+ ScriptExecutionContext& m_scriptExecutionContext;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/Modules/speech/SpeechSynthesisVoice.idl (291123 => 291124)
--- trunk/Source/WebCore/Modules/speech/SpeechSynthesisVoice.idl 2022-03-10 19:43:15 UTC (rev 291123)
+++ trunk/Source/WebCore/Modules/speech/SpeechSynthesisVoice.idl 2022-03-10 20:15:28 UTC (rev 291124)
@@ -24,10 +24,9 @@
*/
// https://wicg.github.io/speech-api/#speechsynthesisvoice
-// FIXME: This is not specified as "LegacyNoInterfaceObject". It should have an interface object and be Exposed=Window.
[
- LegacyNoInterfaceObject,
- Conditional=SPEECH_SYNTHESIS
+ Conditional=SPEECH_SYNTHESIS,
+ Exposed=Window
] interface SpeechSynthesisVoice {
readonly attribute DOMString voiceURI;
readonly attribute DOMString name;
Modified: trunk/Source/WebCore/Sources.txt (291123 => 291124)
--- trunk/Source/WebCore/Sources.txt 2022-03-10 19:43:15 UTC (rev 291123)
+++ trunk/Source/WebCore/Sources.txt 2022-03-10 20:15:28 UTC (rev 291124)
@@ -285,6 +285,7 @@
Modules/speech/SpeechRecognizer.cpp
Modules/speech/DOMWindowSpeechSynthesis.cpp
Modules/speech/SpeechSynthesis.cpp
+Modules/speech/SpeechSynthesisErrorEvent.cpp
Modules/speech/SpeechSynthesisEvent.cpp
Modules/speech/SpeechSynthesisUtterance.cpp
Modules/speech/SpeechSynthesisVoice.cpp
Modified: trunk/Source/WebCore/SourcesCocoa.txt (291123 => 291124)
--- trunk/Source/WebCore/SourcesCocoa.txt 2022-03-10 19:43:15 UTC (rev 291123)
+++ trunk/Source/WebCore/SourcesCocoa.txt 2022-03-10 20:15:28 UTC (rev 291124)
@@ -70,6 +70,10 @@
JSApplePayShippingMethodSelectedEvent.cpp
JSApplePayShippingMethodUpdate.cpp
JSApplePayValidateMerchantEvent.cpp
+JSSpeechSynthesisErrorCode.cpp
+JSSpeechSynthesisErrorEvent.cpp
+JSSpeechSynthesisErrorEventInit.cpp
+JSSpeechSynthesisEventInit.cpp
Modules/airplay/WebMediaSessionManager.cpp
Modules/applepay/ApplePayButtonSystemImage.mm
Modules/applepay/ApplePayCouponCodeChangedEvent.cpp
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (291123 => 291124)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2022-03-10 19:43:15 UTC (rev 291123)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2022-03-10 20:15:28 UTC (rev 291124)
@@ -7977,6 +7977,15 @@
29D7BCF91444AF7D0070619C /* AccessibilitySpinButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccessibilitySpinButton.h; sourceTree = "<group>"; };
29E04A27BED2F81F98E9022B /* JSBeforeUnloadEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSBeforeUnloadEvent.h; sourceTree = "<group>"; };
29E4D8DF16B0940F00C84704 /* PlatformSpeechSynthesizer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PlatformSpeechSynthesizer.h; sourceTree = "<group>"; };
+ 29F83EC327D315A200E1F0FD /* SpeechSynthesisErrorEvent.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SpeechSynthesisErrorEvent.h; sourceTree = "<group>"; };
+ 29F83EC427D315A200E1F0FD /* SpeechSynthesisErrorEvent.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = SpeechSynthesisErrorEvent.cpp; sourceTree = "<group>"; };
+ 29F83EC527D315B800E1F0FD /* SpeechSynthesisErrorEvent.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = SpeechSynthesisErrorEvent.idl; sourceTree = "<group>"; };
+ 29F83EC627D3192600E1F0FD /* SpeechSynthesisErrorCode.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SpeechSynthesisErrorCode.h; sourceTree = "<group>"; };
+ 29F83EC927D594E500E1F0FD /* SpeechSynthesisEventInit.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SpeechSynthesisEventInit.h; sourceTree = "<group>"; };
+ 29F83ECB27D5952600E1F0FD /* SpeechSynthesisEventInit.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = SpeechSynthesisEventInit.idl; sourceTree = "<group>"; };
+ 29F83ECE27D5FA6300E1F0FD /* SpeechSynthesisErrorCode.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = SpeechSynthesisErrorCode.idl; sourceTree = "<group>"; };
+ 29F83ECF27D6C72A00E1F0FD /* SpeechSynthesisErrorEventInit.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = SpeechSynthesisErrorEventInit.idl; sourceTree = "<group>"; };
+ 29F83ED027D6C88500E1F0FD /* SpeechSynthesisErrorEventInit.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SpeechSynthesisErrorEventInit.h; sourceTree = "<group>"; };
29FAF4B5195AB08900A522DC /* TextUndoInsertionMarkupMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextUndoInsertionMarkupMac.h; sourceTree = "<group>"; };
2A4107A026CB66ED003BF797 /* CSSKeywordValue.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CSSKeywordValue.cpp; sourceTree = "<group>"; };
2A4107A226CB66ED003BF797 /* CSSKeywordValue.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = CSSKeywordValue.idl; sourceTree = "<group>"; };
@@ -28180,6 +28189,15 @@
AA2A5AC016A485D500975A25 /* SpeechSynthesisEvent.cpp */,
AA2A5AC116A485D500975A25 /* SpeechSynthesisEvent.h */,
AA2A5AC216A485D500975A25 /* SpeechSynthesisEvent.idl */,
+ 29F83EC927D594E500E1F0FD /* SpeechSynthesisEventInit.h */,
+ 29F83ECB27D5952600E1F0FD /* SpeechSynthesisEventInit.idl */,
+ 29F83EC627D3192600E1F0FD /* SpeechSynthesisErrorCode.h */,
+ 29F83ECE27D5FA6300E1F0FD /* SpeechSynthesisErrorCode.idl */,
+ 29F83EC427D315A200E1F0FD /* SpeechSynthesisErrorEvent.cpp */,
+ 29F83EC327D315A200E1F0FD /* SpeechSynthesisErrorEvent.h */,
+ 29F83EC527D315B800E1F0FD /* SpeechSynthesisErrorEvent.idl */,
+ 29F83ECF27D6C72A00E1F0FD /* SpeechSynthesisErrorEventInit.idl */,
+ 29F83ED027D6C88500E1F0FD /* SpeechSynthesisErrorEventInit.h */,
AA2A5AC416A485D500975A25 /* SpeechSynthesisUtterance.cpp */,
AA2A5AC516A485D500975A25 /* SpeechSynthesisUtterance.h */,
AA2A5AC316A485D500975A25 /* SpeechSynthesisUtterance.idl */,
Modified: trunk/Source/WebCore/dom/EventNames.h (291123 => 291124)
--- trunk/Source/WebCore/dom/EventNames.h 2022-03-10 19:43:15 UTC (rev 291123)
+++ trunk/Source/WebCore/dom/EventNames.h 2022-03-10 20:15:28 UTC (rev 291124)
@@ -299,6 +299,7 @@
macro(validatemerchant) \
macro(versionchange) \
macro(visibilitychange) \
+ macro(voiceschanged) \
macro(volumechange) \
macro(waiting) \
macro(waitingforkey) \
Modified: trunk/Source/WebCore/dom/EventNames.in (291123 => 291124)
--- trunk/Source/WebCore/dom/EventNames.in 2022-03-10 19:43:15 UTC (rev 291123)
+++ trunk/Source/WebCore/dom/EventNames.in 2022-03-10 20:15:28 UTC (rev 291124)
@@ -70,6 +70,7 @@
RTCTransformEvent conditional=WEB_RTC
SpeechRecognitionErrorEvent
SpeechRecognitionEvent
+SpeechSynthesisErrorEvent conditional=SPEECH_SYNTHESIS
SpeechSynthesisEvent conditional=SPEECH_SYNTHESIS
WebGLContextEvent conditional=WEBGL
StorageEvent
Modified: trunk/Source/WebCore/dom/EventTargetFactory.in (291123 => 291124)
--- trunk/Source/WebCore/dom/EventTargetFactory.in 2022-03-10 19:43:15 UTC (rev 291123)
+++ trunk/Source/WebCore/dom/EventTargetFactory.in 2022-03-10 20:15:28 UTC (rev 291124)
@@ -56,6 +56,7 @@
SourceBuffer conditional=MEDIA_SOURCE
SourceBufferList conditional=MEDIA_SOURCE
SpeechRecognition
+SpeechSynthesis conditional=SPEECH_SYNTHESIS
SpeechSynthesisUtterance conditional=SPEECH_SYNTHESIS
TextTrack conditional=VIDEO
TextTrackCue conditional=VIDEO
Modified: trunk/Source/WebCore/page/SpeechSynthesisClient.h (291123 => 291124)
--- trunk/Source/WebCore/page/SpeechSynthesisClient.h 2022-03-10 19:43:15 UTC (rev 291123)
+++ trunk/Source/WebCore/page/SpeechSynthesisClient.h 2022-03-10 20:15:28 UTC (rev 291124)
@@ -60,7 +60,7 @@
virtual void didPauseSpeaking() = 0;
virtual void didResumeSpeaking() = 0;
virtual void speakingErrorOccurred() = 0;
- virtual void boundaryEventOccurred(bool wordBoundary, unsigned charIndex) = 0;
+ virtual void boundaryEventOccurred(bool wordBoundary, unsigned charIndex, unsigned charLength) = 0;
virtual void voicesChanged() = 0;
};
Modified: trunk/Source/WebCore/platform/PlatformSpeechSynthesizer.h (291123 => 291124)
--- trunk/Source/WebCore/platform/PlatformSpeechSynthesizer.h 2022-03-10 19:43:15 UTC (rev 291123)
+++ trunk/Source/WebCore/platform/PlatformSpeechSynthesizer.h 2022-03-10 20:15:28 UTC (rev 291124)
@@ -52,7 +52,7 @@
virtual void didPauseSpeaking(PlatformSpeechSynthesisUtterance&) = 0;
virtual void didResumeSpeaking(PlatformSpeechSynthesisUtterance&) = 0;
virtual void speakingErrorOccurred(PlatformSpeechSynthesisUtterance&) = 0;
- virtual void boundaryEventOccurred(PlatformSpeechSynthesisUtterance&, SpeechBoundary, unsigned charIndex) = 0;
+ virtual void boundaryEventOccurred(PlatformSpeechSynthesisUtterance&, SpeechBoundary, unsigned charIndex, unsigned charLength) = 0;
virtual void voicesDidChange() = 0;
protected:
virtual ~PlatformSpeechSynthesizerClient() = default;
Modified: trunk/Source/WebCore/platform/cocoa/PlatformSpeechSynthesizerCocoa.mm (291123 => 291124)
--- trunk/Source/WebCore/platform/cocoa/PlatformSpeechSynthesizerCocoa.mm 2022-03-10 19:43:15 UTC (rev 291123)
+++ trunk/Source/WebCore/platform/cocoa/PlatformSpeechSynthesizerCocoa.mm 2022-03-10 20:15:28 UTC (rev 291124)
@@ -257,7 +257,7 @@
return;
// AVSpeechSynthesizer only supports word boundaries.
- m_synthesizerObject->client()->boundaryEventOccurred(*m_utterance, WebCore::SpeechBoundary::SpeechWordBoundary, characterRange.location);
+ m_synthesizerObject->client()->boundaryEventOccurred(*m_utterance, WebCore::SpeechBoundary::SpeechWordBoundary, characterRange.location, characterRange.length);
}
@end
@@ -281,7 +281,6 @@
bool isDefault = true;
NSString *voiceURI = [voice identifier];
NSString *name = [voice name];
-
// Only show built-in voices when requesting through WebKit to reduce fingerprinting surface area.
#if HAVE(AVSPEECHSYNTHESIS_SYSTEMVOICE)
// FIXME: Remove respondsToSelector check when is available on all SDKs.
Modified: trunk/Source/WebCore/platform/mock/PlatformSpeechSynthesizerMock.cpp (291123 => 291124)
--- trunk/Source/WebCore/platform/mock/PlatformSpeechSynthesizerMock.cpp 2022-03-10 19:43:15 UTC (rev 291123)
+++ trunk/Source/WebCore/platform/mock/PlatformSpeechSynthesizerMock.cpp 2022-03-10 20:15:28 UTC (rev 291124)
@@ -61,9 +61,9 @@
m_utterance = WTFMove(utterance);
client()->didStartSpeaking(*m_utterance);
- // Fire a fake word and then sentence boundary event.
- client()->boundaryEventOccurred(*m_utterance, SpeechBoundary::SpeechWordBoundary, 0);
- client()->boundaryEventOccurred(*m_utterance, SpeechBoundary::SpeechSentenceBoundary, m_utterance->text().length());
+ // Fire a fake word and then sentence boundary event. Since the entire sentence is the full length, pick arbitrary (3) length for the word.
+ client()->boundaryEventOccurred(*m_utterance, SpeechBoundary::SpeechWordBoundary, 0, 3);
+ client()->boundaryEventOccurred(*m_utterance, SpeechBoundary::SpeechSentenceBoundary, 0, m_utterance->text().length());
// Give the fake speech job some time so that pause and other functions have time to be called.
m_speakingFinishedTimer.startOneShot(100_ms);
Modified: trunk/Source/WebKit/ChangeLog (291123 => 291124)
--- trunk/Source/WebKit/ChangeLog 2022-03-10 19:43:15 UTC (rev 291123)
+++ trunk/Source/WebKit/ChangeLog 2022-03-10 20:15:28 UTC (rev 291124)
@@ -1,3 +1,19 @@
+2022-03-10 Chris Fleizach <[email protected]>
+
+ AX: Support updated WebSpeech API
+ https://bugs.webkit.org/show_bug.cgi?id=237614
+ <rdar://problem/89981851>
+
+ Reviewed by Andres Gonzalez.
+
+ * UIProcess/Cocoa/WebPageProxyCocoa.mm:
+ (WebKit::WebPageProxy::boundaryEventOccurred):
+ * UIProcess/WebPageProxy.h:
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::boundaryEventOccurred):
+ * WebProcess/WebPage/WebPage.h:
+ * WebProcess/WebPage/WebPage.messages.in:
+
2022-03-10 Chris Dumez <[email protected]>
Optimize further the passing of data across threads
Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm (291123 => 291124)
--- trunk/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm 2022-03-10 19:43:15 UTC (rev 291123)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm 2022-03-10 20:15:28 UTC (rev 291124)
@@ -451,9 +451,9 @@
send(Messages::WebPage::SpeakingErrorOccurred());
}
-void WebPageProxy::boundaryEventOccurred(WebCore::PlatformSpeechSynthesisUtterance&, WebCore::SpeechBoundary speechBoundary, unsigned charIndex)
+void WebPageProxy::boundaryEventOccurred(WebCore::PlatformSpeechSynthesisUtterance&, WebCore::SpeechBoundary speechBoundary, unsigned charIndex, unsigned charLength)
{
- send(Messages::WebPage::BoundaryEventOccurred(speechBoundary == WebCore::SpeechBoundary::SpeechWordBoundary, charIndex));
+ send(Messages::WebPage::BoundaryEventOccurred(speechBoundary == WebCore::SpeechBoundary::SpeechWordBoundary, charIndex, charLength));
}
void WebPageProxy::voicesDidChange()
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (291123 => 291124)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.h 2022-03-10 19:43:15 UTC (rev 291123)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h 2022-03-10 20:15:28 UTC (rev 291124)
@@ -2585,7 +2585,7 @@
void didPauseSpeaking(WebCore::PlatformSpeechSynthesisUtterance&) final;
void didResumeSpeaking(WebCore::PlatformSpeechSynthesisUtterance&) final;
void speakingErrorOccurred(WebCore::PlatformSpeechSynthesisUtterance&) final;
- void boundaryEventOccurred(WebCore::PlatformSpeechSynthesisUtterance&, WebCore::SpeechBoundary, unsigned charIndex) final;
+ void boundaryEventOccurred(WebCore::PlatformSpeechSynthesisUtterance&, WebCore::SpeechBoundary, unsigned charIndex, unsigned charLength) final;
void voicesDidChange() final;
struct SpeechSynthesisData;
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (291123 => 291124)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2022-03-10 19:43:15 UTC (rev 291123)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2022-03-10 20:15:28 UTC (rev 291124)
@@ -7349,10 +7349,10 @@
observer->speakingErrorOccurred();
}
-void WebPage::boundaryEventOccurred(bool wordBoundary, unsigned charIndex)
+void WebPage::boundaryEventOccurred(bool wordBoundary, unsigned charIndex, unsigned charLength)
{
if (auto observer = corePage()->speechSynthesisClient()->observer())
- observer->boundaryEventOccurred(wordBoundary, charIndex);
+ observer->boundaryEventOccurred(wordBoundary, charIndex, charLength);
}
void WebPage::voicesDidChange()
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (291123 => 291124)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2022-03-10 19:43:15 UTC (rev 291123)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2022-03-10 20:15:28 UTC (rev 291124)
@@ -1928,7 +1928,7 @@
#if ENABLE(SPEECH_SYNTHESIS)
void speakingErrorOccurred();
- void boundaryEventOccurred(bool wordBoundary, unsigned charIndex);
+ void boundaryEventOccurred(bool wordBoundary, unsigned charIndex, unsigned charLength);
void voicesDidChange();
#endif
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in (291123 => 291124)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in 2022-03-10 19:43:15 UTC (rev 291123)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in 2022-03-10 20:15:28 UTC (rev 291124)
@@ -615,7 +615,7 @@
#if ENABLE(SPEECH_SYNTHESIS)
SpeakingErrorOccurred()
- BoundaryEventOccurred(bool wordBoundary, unsigned charIndex)
+ BoundaryEventOccurred(bool wordBoundary, unsigned charIndex, unsigned charLength)
VoicesDidChange()
#endif