RESOLVED FIXED 237614
AX: Support updated WebSpeech API
https://bugs.webkit.org/show_bug.cgi?id=237614
Summary AX: Support updated WebSpeech API
chris fleizach
Reported 2022-03-08 12:07:15 PST
There are new WebSpeech changes from https://wicg.github.io/speech-api/ and the lack of these are causing a number of imported W3C test failures web-platform-tests/speech-api/SpeechSynthesis*
Attachments
patch (80.15 KB, patch)
2022-03-08 16:32 PST, chris fleizach
ews-feeder: commit-queue-
patch (80.58 KB, patch)
2022-03-08 16:59 PST, chris fleizach
ews-feeder: commit-queue-
patch (81.55 KB, patch)
2022-03-09 00:12 PST, chris fleizach
no flags
patch (81.70 KB, patch)
2022-03-09 00:26 PST, chris fleizach
no flags
patch (81.49 KB, patch)
2022-03-09 00:27 PST, chris fleizach
no flags
patch (81.49 KB, patch)
2022-03-09 00:29 PST, chris fleizach
no flags
patch (81.36 KB, patch)
2022-03-09 00:30 PST, chris fleizach
no flags
patch (80.83 KB, patch)
2022-03-09 00:31 PST, chris fleizach
ews-feeder: commit-queue-
patch (81.33 KB, patch)
2022-03-09 00:49 PST, chris fleizach
andresg_22: review+
ews-feeder: commit-queue-
patch (81.93 KB, patch)
2022-03-09 08:34 PST, chris fleizach
ews-feeder: commit-queue-
patch (81.97 KB, patch)
2022-03-09 09:17 PST, chris fleizach
ews-feeder: commit-queue-
patch (86.65 KB, patch)
2022-03-09 09:33 PST, chris fleizach
ews-feeder: commit-queue-
patch (86.65 KB, patch)
2022-03-09 14:02 PST, chris fleizach
no flags
patch (86.62 KB, patch)
2022-03-09 14:11 PST, chris fleizach
ews-feeder: commit-queue-
patch (86.62 KB, patch)
2022-03-09 14:19 PST, chris fleizach
ews-feeder: commit-queue-
patch (86.39 KB, patch)
2022-03-09 15:33 PST, chris fleizach
no flags
Radar WebKit Bug Importer
Comment 1 2022-03-08 12:07:39 PST
chris fleizach
Comment 2 2022-03-08 12:08:13 PST
chris fleizach
Comment 3 2022-03-08 16:32:53 PST
chris fleizach
Comment 4 2022-03-08 16:59:16 PST
chris fleizach
Comment 5 2022-03-09 00:12:25 PST
chris fleizach
Comment 6 2022-03-09 00:26:11 PST
chris fleizach
Comment 7 2022-03-09 00:27:03 PST
chris fleizach
Comment 8 2022-03-09 00:29:16 PST
chris fleizach
Comment 9 2022-03-09 00:30:40 PST
chris fleizach
Comment 10 2022-03-09 00:31:59 PST
chris fleizach
Comment 11 2022-03-09 00:49:42 PST
Andres Gonzalez
Comment 12 2022-03-09 06:42:56 PST
(In reply to chris fleizach from comment #11) > Created attachment 454205 [details] > patch --- a/LayoutTests/fast/speechsynthesis/speech-synthesis-boundary-events.html +++ a/LayoutTests/fast/speechsynthesis/speech-synthesis-boundary-events.html - debug("Boundary event: " + event.name + ", Character index: " + event.charIndex); + debug("Boundary event: " + event.name + ", Character index: " + event.charIndex + ", length: " + event.charLength); This can be written, arguably more compactly as: + debug(`Boundary event: ${event.name}, Character index: ${event.charIndex}, length: ${event.charLength}`); --- a/Source/WebCore/Modules/speech/SpeechSynthesis.cpp +++ a/Source/WebCore/Modules/speech/SpeechSynthesis.cpp -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)); + SpeechSynthesisEventInit eventInit = { &utterance, charIndex, charLength, static_cast<float>((MonotonicTime::now() - utterance.startTime()).seconds()), name }; + utterance.dispatchEvent(SpeechSynthesisEvent::create(type, eventInit)); +} I'd suggest avoiding the local eventInit and just pass the initializer list as second parameter to SpeechSynthesisEvent::create. +void SpeechSynthesis::fireErrorEvent(const AtomString& type, SpeechSynthesisUtterance& utterance, SpeechSynthesisErrorCode errorCode) const +{ + SpeechSynthesisErrorEventInit eventInit = { { &utterance, 0, 0, static_cast<float>((MonotonicTime::now() - utterance.startTime()).seconds()), { } }, errorCode }; + utterance.dispatchEvent(SpeechSynthesisErrorEvent::create(type, eventInit)); } Same here. --- a/Source/WebCore/Modules/speech/SpeechSynthesis.h +++ a/Source/WebCore/Modules/speech/SpeechSynthesis.h + virtual ~SpeechSynthesis(); Do we need this declaration and the "~SpeechSynthesis() = default;" in the cpp? + using RefCounted::ref; + using RefCounted::deref; Do we need this? I would think this is implicit by deriving from RefCounted. --- a/Source/WebCore/platform/mock/PlatformSpeechSynthesizerMock.cpp +++ a/Source/WebCore/platform/mock/PlatformSpeechSynthesizerMock.cpp - client()->boundaryEventOccurred(*m_utterance, SpeechBoundary::SpeechWordBoundary, 0); - client()->boundaryEventOccurred(*m_utterance, SpeechBoundary::SpeechSentenceBoundary, m_utterance->text().length()); + client()->boundaryEventOccurred(*m_utterance, SpeechBoundary::SpeechWordBoundary, 0, 3); Why 3? Perhaps a clarifying comment.
chris fleizach
Comment 13 2022-03-09 08:34:17 PST
> + using RefCounted::ref; > + using RefCounted::deref; > > Do we need this? I would think this is implicit by deriving from RefCounted. > This inherits from multiple classes that define ref, so we need to specify which one to use. I see this pattern elsewhere too > --- a/Source/WebCore/platform/mock/PlatformSpeechSynthesizerMock.cpp > +++ a/Source/WebCore/platform/mock/PlatformSpeechSynthesizerMock.cpp > > - client()->boundaryEventOccurred(*m_utterance, > SpeechBoundary::SpeechWordBoundary, 0); > - client()->boundaryEventOccurred(*m_utterance, > SpeechBoundary::SpeechSentenceBoundary, m_utterance->text().length()); > + client()->boundaryEventOccurred(*m_utterance, > SpeechBoundary::SpeechWordBoundary, 0, 3); > > Why 3? Perhaps a clarifying comment. will add comment. its just test data so it doesn't have a real impact
chris fleizach
Comment 14 2022-03-09 08:34:28 PST
chris fleizach
Comment 15 2022-03-09 09:17:21 PST
chris fleizach
Comment 16 2022-03-09 09:33:04 PST
chris fleizach
Comment 17 2022-03-09 14:02:17 PST
chris fleizach
Comment 18 2022-03-09 14:11:54 PST
chris fleizach
Comment 19 2022-03-09 14:19:21 PST
chris fleizach
Comment 20 2022-03-09 15:33:38 PST
EWS
Comment 21 2022-03-10 12:16:51 PST
Committed r291124 (248284@main): <https://commits.webkit.org/248284@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 454293 [details].
chris fleizach
Comment 22 2022-03-18 11:57:48 PDT
*** Bug 216683 has been marked as a duplicate of this bug. ***
Note You need to log in before you can comment on or make changes to this bug.