Title: [291344] trunk/Source/WebCore
Revision
291344
Author
cfleiz...@apple.com
Date
2022-03-16 06:14:18 -0700 (Wed, 16 Mar 2022)

Log Message

AX: imported/w3c/web-platform-tests/speech-api/SpeechSynthesis (layout-tests) are constant text failures
https://bugs.webkit.org/show_bug.cgi?id=237881
<rdar://problem/90293806>

Reviewed by Andres Gonzalez.

Keep track of the platform utterances so that we can verify the callbacks are for the ones we are interested in.
This test failure was due to a previous speech job that was canceled (before a new one started). When the callback for
the last one came back, it wiped out the stored new one.

Fixed test: imported/w3c/web-platform-tests/speech-api/SpeechSynthesis-speak-events.html.

* platform/PlatformSpeechSynthesisUtterance.h:
(WebCore::PlatformSpeechSynthesisUtterance::platformSpeechUtteranceWrapper const):
(WebCore::PlatformSpeechSynthesisUtterance::setPlatformSpeechUtteranceWrapper):
* platform/cocoa/PlatformSpeechSynthesizerCocoa.mm:
(-[WebSpeechSynthesisWrapper speakUtterance:]):
(-[WebSpeechSynthesisWrapper speechSynthesizer:didStartSpeechUtterance:]):
(-[WebSpeechSynthesisWrapper speechSynthesizer:didFinishSpeechUtterance:]):
(-[WebSpeechSynthesisWrapper speechSynthesizer:didPauseSpeechUtterance:]):
(-[WebSpeechSynthesisWrapper speechSynthesizer:didContinueSpeechUtterance:]):
(-[WebSpeechSynthesisWrapper speechSynthesizer:didCancelSpeechUtterance:]):
(-[WebSpeechSynthesisWrapper speechSynthesizer:willSpeakRangeOfSpeechString:utterance:]):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (291343 => 291344)


--- trunk/Source/WebCore/ChangeLog	2022-03-16 13:12:30 UTC (rev 291343)
+++ trunk/Source/WebCore/ChangeLog	2022-03-16 13:14:18 UTC (rev 291344)
@@ -1,3 +1,29 @@
+2022-03-16  Chris Fleizach  <cfleiz...@apple.com>
+
+        AX: imported/w3c/web-platform-tests/speech-api/SpeechSynthesis (layout-tests) are constant text failures
+        https://bugs.webkit.org/show_bug.cgi?id=237881
+        <rdar://problem/90293806>
+
+        Reviewed by Andres Gonzalez.
+
+        Keep track of the platform utterances so that we can verify the callbacks are for the ones we are interested in.
+        This test failure was due to a previous speech job that was canceled (before a new one started). When the callback for
+        the last one came back, it wiped out the stored new one.
+
+        Fixed test: imported/w3c/web-platform-tests/speech-api/SpeechSynthesis-speak-events.html.
+
+        * platform/PlatformSpeechSynthesisUtterance.h:
+        (WebCore::PlatformSpeechSynthesisUtterance::platformSpeechUtteranceWrapper const):
+        (WebCore::PlatformSpeechSynthesisUtterance::setPlatformSpeechUtteranceWrapper):
+        * platform/cocoa/PlatformSpeechSynthesizerCocoa.mm:
+        (-[WebSpeechSynthesisWrapper speakUtterance:]):
+        (-[WebSpeechSynthesisWrapper speechSynthesizer:didStartSpeechUtterance:]):
+        (-[WebSpeechSynthesisWrapper speechSynthesizer:didFinishSpeechUtterance:]):
+        (-[WebSpeechSynthesisWrapper speechSynthesizer:didPauseSpeechUtterance:]):
+        (-[WebSpeechSynthesisWrapper speechSynthesizer:didContinueSpeechUtterance:]):
+        (-[WebSpeechSynthesisWrapper speechSynthesizer:didCancelSpeechUtterance:]):
+        (-[WebSpeechSynthesisWrapper speechSynthesizer:willSpeakRangeOfSpeechString:utterance:]):
+
 2022-03-16  Zan Dobersek  <zdober...@igalia.com>
 
         [GTK][WPE] Provide DMABuf-based composition layers, DMABufVideoSink integration

Modified: trunk/Source/WebCore/platform/PlatformSpeechSynthesisUtterance.h (291343 => 291344)


--- trunk/Source/WebCore/platform/PlatformSpeechSynthesisUtterance.h	2022-03-16 13:12:30 UTC (rev 291343)
+++ trunk/Source/WebCore/platform/PlatformSpeechSynthesisUtterance.h	2022-03-16 13:14:18 UTC (rev 291344)
@@ -65,7 +65,12 @@
     
     PlatformSpeechSynthesisUtteranceClient* client() const { return m_client; }
     void setClient(PlatformSpeechSynthesisUtteranceClient* client) { m_client = client; }
-    
+
+#if PLATFORM(COCOA)
+    id wrapper() const { return m_wrapper.get(); }
+    void setWrapper(id utterance) { m_wrapper = utterance; }
+#endif
+
 private:
     explicit PlatformSpeechSynthesisUtterance(PlatformSpeechSynthesisUtteranceClient&);
 
@@ -77,6 +82,10 @@
     float m_rate { 1 };
     float m_pitch { 1 };
     MonotonicTime m_startTime;
+
+#if PLATFORM(COCOA)
+    RetainPtr<id> m_wrapper;
+#endif
 };
     
 } // namespace WebCore

Modified: trunk/Source/WebCore/platform/cocoa/PlatformSpeechSynthesizerCocoa.mm (291343 => 291344)


--- trunk/Source/WebCore/platform/cocoa/PlatformSpeechSynthesizerCocoa.mm	2022-03-16 13:12:30 UTC (rev 291343)
+++ trunk/Source/WebCore/platform/cocoa/PlatformSpeechSynthesizerCocoa.mm	2022-03-16 13:14:18 UTC (rev 291344)
@@ -141,6 +141,7 @@
     [avUtterance setVolume:utterance->volume()];
     [avUtterance setPitchMultiplier:utterance->pitch()];
     [avUtterance setVoice:avVoice];
+    utterance->setWrapper(avUtterance);
     m_utterance = WTFMove(utterance);
 
     // macOS won't send a did start speaking callback for empty strings.
@@ -193,8 +194,7 @@
 - (void)speechSynthesizer:(AVSpeechSynthesizer *)synthesizer didStartSpeechUtterance:(AVSpeechUtterance *)utterance
 {
     UNUSED_PARAM(synthesizer);
-    UNUSED_PARAM(utterance);
-    if (!m_utterance)
+    if (!m_utterance || m_utterance->wrapper() != utterance)
         return;
 
     m_synthesizerObject->client()->didStartSpeaking(*m_utterance);
@@ -203,8 +203,7 @@
 - (void)speechSynthesizer:(AVSpeechSynthesizer *)synthesizer didFinishSpeechUtterance:(AVSpeechUtterance *)utterance
 {
     UNUSED_PARAM(synthesizer);
-    UNUSED_PARAM(utterance);
-    if (!m_utterance)
+    if (!m_utterance || m_utterance->wrapper() != utterance)
         return;
 
     // Clear the m_utterance variable in case finish speaking kicks off a new speaking job immediately.
@@ -217,8 +216,7 @@
 - (void)speechSynthesizer:(AVSpeechSynthesizer *)synthesizer didPauseSpeechUtterance:(AVSpeechUtterance *)utterance
 {
     UNUSED_PARAM(synthesizer);
-    UNUSED_PARAM(utterance);
-    if (!m_utterance)
+    if (!m_utterance || m_utterance->wrapper() != utterance)
         return;
 
     m_synthesizerObject->client()->didPauseSpeaking(*m_utterance);
@@ -227,8 +225,7 @@
 - (void)speechSynthesizer:(AVSpeechSynthesizer *)synthesizer didContinueSpeechUtterance:(AVSpeechUtterance *)utterance
 {
     UNUSED_PARAM(synthesizer);
-    UNUSED_PARAM(utterance);
-    if (!m_utterance)
+    if (!m_utterance || m_utterance->wrapper() != utterance)
         return;
 
     m_synthesizerObject->client()->didResumeSpeaking(*m_utterance);
@@ -237,8 +234,7 @@
 - (void)speechSynthesizer:(AVSpeechSynthesizer *)synthesizer didCancelSpeechUtterance:(AVSpeechUtterance *)utterance
 {
     UNUSED_PARAM(synthesizer);
-    UNUSED_PARAM(utterance);
-    if (!m_utterance)
+    if (!m_utterance || m_utterance->wrapper() != utterance)
         return;
 
     // Clear the m_utterance variable in case finish speaking kicks off a new speaking job immediately.
@@ -251,9 +247,7 @@
 - (void)speechSynthesizer:(AVSpeechSynthesizer *)synthesizer willSpeakRangeOfSpeechString:(NSRange)characterRange utterance:(AVSpeechUtterance *)utterance
 {
     UNUSED_PARAM(synthesizer);
-    UNUSED_PARAM(utterance);
-
-    if (!m_utterance)
+    if (!m_utterance || m_utterance->wrapper() != utterance)
         return;
 
     // AVSpeechSynthesizer only supports word boundaries.
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to