Changeset 144335 in webkit
- Timestamp:
- Feb 28, 2013 11:33:48 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r144331 r144335 1 2013-02-28 Chris Fleizach <cfleizach@apple.com> 2 3 WebSpeech: support the boundary event 4 https://bugs.webkit.org/show_bug.cgi?id=107350 5 6 Reviewed by Beth Dakin. 7 8 * platform/mac/fast/speechsynthesis/speech-synthesis-boundary-events-expected.txt: Added. 9 * platform/mac/fast/speechsynthesis/speech-synthesis-boundary-events.html: Added. 10 1 11 2013-02-28 Adam Barth <abarth@webkit.org> 2 12 -
trunk/Source/WebCore/ChangeLog
r144330 r144335 1 2013-02-28 Chris Fleizach <cfleizach@apple.com> 2 3 WebSpeech: support the boundary event 4 https://bugs.webkit.org/show_bug.cgi?id=107350 5 6 Reviewed by Beth Dakin. 7 8 Generate boundary events for speech synthesis and have them fire the appropriate events. 9 This implements for the Mac platform, as well as simulating these events in the mock 10 synthesizer for testing purposes. 11 12 Test: platform/mac/fast/speechsynthesis/speech-synthesis-boundary-events.html 13 14 * Modules/speech/SpeechSynthesis.cpp: 15 (WebCore): 16 (WebCore::SpeechSynthesis::boundaryEventOccurred): 17 * Modules/speech/SpeechSynthesis.h: 18 (SpeechSynthesis): 19 * platform/PlatformSpeechSynthesizer.h: 20 (WebCore): 21 (PlatformSpeechSynthesizerClient): 22 * platform/mac/PlatformSpeechSynthesizerMac.mm: 23 (-[WebSpeechSynthesisWrapper speechSynthesizer:willSpeakWord:ofString:]): 24 * platform/mock/PlatformSpeechSynthesizerMock.cpp: 25 (WebCore::PlatformSpeechSynthesizerMock::speak): 26 1 27 2013-02-28 David Grogan <dgrogan@chromium.org> 2 28 -
trunk/Source/WebCore/Modules/speech/SpeechSynthesis.cpp
r144244 r144335 152 152 } 153 153 } 154 155 void SpeechSynthesis::boundaryEventOccurred(const PlatformSpeechSynthesisUtterance* utterance, SpeechBoundary boundary, unsigned charIndex) 156 { 157 DEFINE_STATIC_LOCAL(const String, wordBoundaryString, (ASCIILiteral("word"))); 158 DEFINE_STATIC_LOCAL(const String, sentenceBoundaryString, (ASCIILiteral("sentence"))); 159 160 switch (boundary) { 161 case SpeechWordBoundary: 162 fireEvent(eventNames().boundaryEvent, static_cast<SpeechSynthesisUtterance*>(utterance->client()), charIndex, wordBoundaryString); 163 break; 164 case SpeechSentenceBoundary: 165 fireEvent(eventNames().boundaryEvent, static_cast<SpeechSynthesisUtterance*>(utterance->client()), charIndex, sentenceBoundaryString); 166 break; 167 default: 168 ASSERT_NOT_REACHED(); 169 } 170 } 154 171 155 172 void SpeechSynthesis::didStartSpeaking(const PlatformSpeechSynthesisUtterance* utterance) -
trunk/Source/WebCore/Modules/speech/SpeechSynthesis.h
r144220 r144335 71 71 virtual void didFinishSpeaking(const PlatformSpeechSynthesisUtterance*) OVERRIDE; 72 72 virtual void speakingErrorOccurred(const PlatformSpeechSynthesisUtterance*) OVERRIDE; 73 virtual void boundaryEventOccurred(const PlatformSpeechSynthesisUtterance*, SpeechBoundary, unsigned charIndex) OVERRIDE; 73 74 74 75 void startSpeakingImmediately(SpeechSynthesisUtterance*); -
trunk/Source/WebCore/platform/PlatformSpeechSynthesizer.h
r144244 r144335 39 39 40 40 namespace WebCore { 41 41 42 enum SpeechBoundary { 43 SpeechWordBoundary, 44 SpeechSentenceBoundary 45 }; 46 42 47 class PlatformSpeechSynthesisUtterance; 43 48 … … 49 54 virtual void didResumeSpeaking(const PlatformSpeechSynthesisUtterance*) = 0; 50 55 virtual void speakingErrorOccurred(const PlatformSpeechSynthesisUtterance*) = 0; 51 56 virtual void boundaryEventOccurred(const PlatformSpeechSynthesisUtterance*, SpeechBoundary, unsigned charIndex) = 0; 52 57 virtual void voicesDidChange() = 0; 53 58 protected: -
trunk/Source/WebCore/platform/mac/PlatformSpeechSynthesizerMac.mm
r144244 r144335 158 158 } 159 159 160 - (void)speechSynthesizer:(NSSpeechSynthesizer *)sender willSpeakWord:(NSRange)characterRange ofString:(NSString *)string 161 { 162 ASSERT(m_utterance); 163 UNUSED_PARAM(sender); 164 UNUSED_PARAM(string); 165 166 // Mac platform only supports word boundaries. 167 m_synthesizerObject->client()->boundaryEventOccurred(m_utterance, WebCore::SpeechWordBoundary, characterRange.location); 168 } 169 160 170 @end 161 171 -
trunk/Source/WebCore/platform/mock/PlatformSpeechSynthesizerMock.cpp
r144244 r144335 26 26 #include "config.h" 27 27 #include "PlatformSpeechSynthesizerMock.h" 28 #include "PlatformSpeechSynthesisUtterance.h" 28 29 29 30 #if ENABLE(SPEECH_SYNTHESIS) … … 67 68 client()->didStartSpeaking(m_utterance); 68 69 70 // Fire a fake word and then sentence boundary event. 71 client()->boundaryEventOccurred(m_utterance, SpeechWordBoundary, 0); 72 client()->boundaryEventOccurred(m_utterance, SpeechSentenceBoundary, m_utterance->text().length()); 73 69 74 // Give the fake speech job some time so that pause and other functions have time to be called. 70 75 m_speakingFinishedTimer.startOneShot(.1);
Note: See TracChangeset
for help on using the changeset viewer.