Changeset 146277 in webkit
- Timestamp:
- Mar 19, 2013 4:26:08 PM (11 years ago)
- Location:
- trunk/Source
- Files:
-
- 9 added
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/Platform/ChangeLog
r146251 r146277 1 2013-03-19 Dominic Mazzoni <dmazzoni@google.com> 2 3 Implement Web Speech Synthesis for Chromium 4 https://bugs.webkit.org/show_bug.cgi?id=111695 5 6 Reviewed by Adam Barth. 7 8 Exposes a platform API that the embedder can implement to 9 provide speech synthesis for the Chromium port. 10 11 * Platform.gypi: 12 * chromium/public/Platform.h: 13 (WebKit): 14 (Platform): 15 (WebKit::Platform::speechSynthesizer): 16 * chromium/public/WebSpeechSynthesisUtterance.h: Added. 17 (WebKit): 18 (WebSpeechSynthesisUtterance): 19 (WebKit::WebSpeechSynthesisUtterance::WebSpeechSynthesisUtterance): 20 (WebKit::WebSpeechSynthesisUtterance::~WebSpeechSynthesisUtterance): 21 (WebKit::WebSpeechSynthesisUtterance::operator=): 22 (WebKit::WebSpeechSynthesisUtterance::isNull): 23 * chromium/public/WebSpeechSynthesisVoice.h: Added. 24 (WebCore): 25 (WebKit): 26 (WebSpeechSynthesisVoice): 27 (WebKit::WebSpeechSynthesisVoice::WebSpeechSynthesisVoice): 28 (WebKit::WebSpeechSynthesisVoice::~WebSpeechSynthesisVoice): 29 (WebKit::WebSpeechSynthesisVoice::operator=): 30 * chromium/public/WebSpeechSynthesizer.h: Added. 31 (WebKit): 32 (WebSpeechSynthesizer): 33 (WebKit::WebSpeechSynthesizer::~WebSpeechSynthesizer): 34 * chromium/public/WebSpeechSynthesizerClient.h: Added. 35 (WebKit): 36 (WebSpeechSynthesizerClient): 37 (WebKit::WebSpeechSynthesizerClient::~WebSpeechSynthesizerClient): 38 1 39 2013-03-19 Mark Pilgrim <pilgrim@chromium.org> 2 40 -
trunk/Source/Platform/Platform.gypi
r146163 r146277 130 130 'chromium/public/WebSocketStreamHandleClient.h', 131 131 'chromium/public/WebSolidColorLayer.h', 132 'chromium/public/WebSpeechSynthesizer.h', 133 'chromium/public/WebSpeechSynthesizerClient.h', 134 'chromium/public/WebSpeechSynthesisUtterance.h', 135 'chromium/public/WebSpeechSynthesisVoice.h', 132 136 'chromium/public/WebStorageArea.h', 133 137 'chromium/public/WebStorageNamespace.h', -
trunk/Source/Platform/chromium/public/Platform.h
r144827 r146277 42 42 #include "WebGraphicsContext3D.h" 43 43 #include "WebLocalizedString.h" 44 #include "WebSpeechSynthesizer.h" 44 45 #include "WebString.h" 45 46 #include "WebVector.h" … … 70 71 class WebSandboxSupport; 71 72 class WebSocketStreamHandle; 73 class WebSpeechSynthesizer; 74 class WebSpeechSynthesizerClient; 72 75 class WebStorageNamespace; 73 76 class WebUnitTestSupport; … … 116 119 virtual WebHyphenator* hyphenator() { return 0; } 117 120 121 // May return null. 122 virtual WebSpeechSynthesizer* createSpeechSynthesizer(WebSpeechSynthesizerClient*) { return 0; } 118 123 119 124 // Audio -------------------------------------------------------------- -
trunk/Source/WebCore/ChangeLog
r146276 r146277 1 2013-03-19 Dominic Mazzoni <dmazzoni@google.com> 2 3 Implement Web Speech Synthesis for Chromium 4 https://bugs.webkit.org/show_bug.cgi?id=111695 5 6 Reviewed by Adam Barth. 7 8 Straightforward implementation of speech synthesis 9 for Chromium by exposing interfaces for the platform 10 to implement. 11 12 * Modules/speech/SpeechSynthesis.cpp: 13 (WebCore::SpeechSynthesis::boundaryEventOccurred): 14 (WebCore::SpeechSynthesis::didStartSpeaking): 15 (WebCore::SpeechSynthesis::didPauseSpeaking): 16 (WebCore::SpeechSynthesis::didResumeSpeaking): 17 (WebCore::SpeechSynthesis::didFinishSpeaking): 18 (WebCore::SpeechSynthesis::speakingErrorOccurred): 19 (WebCore): 20 * Modules/speech/SpeechSynthesis.h: 21 (SpeechSynthesis): 22 * Modules/speech/SpeechSynthesisUtterance.cpp: 23 (WebCore::SpeechSynthesisUtterance::SpeechSynthesisUtterance): 24 (WebCore): 25 (WebCore::SpeechSynthesisUtterance::~SpeechSynthesisUtterance): 26 (WebCore::SpeechSynthesisUtterance::setVoice): 27 * Modules/speech/SpeechSynthesisUtterance.h: 28 (SpeechSynthesisUtterance): 29 (WebCore::SpeechSynthesisUtterance::text): 30 (WebCore::SpeechSynthesisUtterance::setText): 31 (WebCore::SpeechSynthesisUtterance::lang): 32 (WebCore::SpeechSynthesisUtterance::setLang): 33 (WebCore::SpeechSynthesisUtterance::volume): 34 (WebCore::SpeechSynthesisUtterance::setVolume): 35 (WebCore::SpeechSynthesisUtterance::rate): 36 (WebCore::SpeechSynthesisUtterance::setRate): 37 (WebCore::SpeechSynthesisUtterance::pitch): 38 (WebCore::SpeechSynthesisUtterance::setPitch): 39 (WebCore::SpeechSynthesisUtterance::startTime): 40 (WebCore::SpeechSynthesisUtterance::setStartTime): 41 (WebCore::SpeechSynthesisUtterance::platformUtterance): 42 * Modules/speech/SpeechSynthesisVoice.h: 43 (WebCore::SpeechSynthesisVoice::~SpeechSynthesisVoice): 44 * WebCore.exp.in: 45 * WebCore.gypi: 46 * platform/PlatformSpeechSynthesis.h: 47 (PlatformSpeechSynthesis): 48 * platform/PlatformSpeechSynthesisUtterance.cpp: 49 (WebCore): 50 (WebCore::PlatformSpeechSynthesisUtterance::create): 51 * platform/PlatformSpeechSynthesisUtterance.h: 52 (PlatformSpeechSynthesisUtterance): 53 (WebCore::PlatformSpeechSynthesisUtterance::setClient): 54 * platform/PlatformSpeechSynthesisVoice.cpp: 55 (WebCore): 56 (WebCore::PlatformSpeechSynthesisVoice::create): 57 (WebCore::PlatformSpeechSynthesisVoice::PlatformSpeechSynthesisVoice): 58 * platform/PlatformSpeechSynthesisVoice.h: 59 (PlatformSpeechSynthesisVoice): 60 (WebCore::PlatformSpeechSynthesisVoice::setVoiceURI): 61 (WebCore::PlatformSpeechSynthesisVoice::setName): 62 (WebCore::PlatformSpeechSynthesisVoice::setLang): 63 (WebCore::PlatformSpeechSynthesisVoice::setLocalService): 64 (WebCore::PlatformSpeechSynthesisVoice::setIsDefault): 65 * platform/PlatformSpeechSynthesizer.cpp: 66 (WebCore::PlatformSpeechSynthesizer::create): 67 (WebCore::PlatformSpeechSynthesizer::setVoiceList): 68 (WebCore): 69 * platform/PlatformSpeechSynthesizer.h: 70 (WebKit): 71 (PlatformSpeechSynthesizerClient): 72 (PlatformSpeechSynthesizer): 73 * platform/chromium/PlatformSpeechSynthesizerChromium.cpp: Added. 74 (WebCore): 75 (WebCore::PlatformSpeechSynthesizer::PlatformSpeechSynthesizer): 76 (WebCore::PlatformSpeechSynthesizer::~PlatformSpeechSynthesizer): 77 (WebCore::PlatformSpeechSynthesizer::initializeVoiceList): 78 (WebCore::PlatformSpeechSynthesizer::speak): 79 (WebCore::PlatformSpeechSynthesizer::pause): 80 (WebCore::PlatformSpeechSynthesizer::resume): 81 (WebCore::PlatformSpeechSynthesizer::cancel): 82 * platform/chromium/support/WebSpeechSynthesisUtterance.cpp: Added. 83 (WebKit): 84 (WebKit::WebSpeechSynthesisUtterance::WebSpeechSynthesisUtterance): 85 (WebKit::WebSpeechSynthesisUtterance::operator=): 86 (WebKit::WebSpeechSynthesisUtterance::assign): 87 (WebKit::WebSpeechSynthesisUtterance::reset): 88 (WebKit::WebSpeechSynthesisUtterance::operator PassRefPtr<PlatformSpeechSynthesisUtterance>): 89 (WebKit::WebSpeechSynthesisUtterance::operator PlatformSpeechSynthesisUtterance*): 90 (WebKit::WebSpeechSynthesisUtterance::text): 91 (WebKit::WebSpeechSynthesisUtterance::lang): 92 (WebKit::WebSpeechSynthesisUtterance::voice): 93 (WebKit::WebSpeechSynthesisUtterance::volume): 94 (WebKit::WebSpeechSynthesisUtterance::rate): 95 (WebKit::WebSpeechSynthesisUtterance::pitch): 96 (WebKit::WebSpeechSynthesisUtterance::startTime): 97 * platform/chromium/support/WebSpeechSynthesisVoice.cpp: Added. 98 (WebKit): 99 (WebKit::WebSpeechSynthesisVoice::assign): 100 (WebKit::WebSpeechSynthesisVoice::reset): 101 (WebKit::WebSpeechSynthesisVoice::setVoiceURI): 102 (WebKit::WebSpeechSynthesisVoice::setName): 103 (WebKit::WebSpeechSynthesisVoice::setLanguage): 104 (WebKit::WebSpeechSynthesisVoice::setIsLocalService): 105 (WebKit::WebSpeechSynthesisVoice::setIsDefault): 106 (WebKit::WebSpeechSynthesisVoice::operator PassRefPtr<WebCore::PlatformSpeechSynthesisVoice>): 107 * platform/chromium/support/WebSpeechSynthesizerClientImpl.cpp: Added. 108 (WebCore): 109 (WebCore::WebSpeechSynthesizerClientImpl::WebSpeechSynthesizerClientImpl): 110 (WebCore::WebSpeechSynthesizerClientImpl::~WebSpeechSynthesizerClientImpl): 111 (WebCore::WebSpeechSynthesizerClientImpl::setVoiceList): 112 (WebCore::WebSpeechSynthesizerClientImpl::didStartSpeaking): 113 (WebCore::WebSpeechSynthesizerClientImpl::didFinishSpeaking): 114 (WebCore::WebSpeechSynthesizerClientImpl::didPauseSpeaking): 115 (WebCore::WebSpeechSynthesizerClientImpl::didResumeSpeaking): 116 (WebCore::WebSpeechSynthesizerClientImpl::speakingErrorOccurred): 117 (WebCore::WebSpeechSynthesizerClientImpl::wordBoundaryEventOccurred): 118 (WebCore::WebSpeechSynthesizerClientImpl::sentenceBoundaryEventOccurred): 119 * platform/chromium/support/WebSpeechSynthesizerClientImpl.h: Added. 120 (WebCore): 121 (WebSpeechSynthesizerClientImpl): 122 * platform/mac/PlatformSpeechSynthesizerMac.mm: 123 (-[WebSpeechSynthesisWrapper speakUtterance:WebCore::]): 124 (-[WebSpeechSynthesisWrapper speechSynthesizer:didFinishSpeaking:]): 125 (WebCore::PlatformSpeechSynthesizer::PlatformSpeechSynthesizer): 126 (WebCore): 127 (WebCore::PlatformSpeechSynthesizer::~PlatformSpeechSynthesizer): 128 (WebCore::PlatformSpeechSynthesizer::speak): 129 * platform/mock/PlatformSpeechSynthesizerMock.cpp: 130 (WebCore::PlatformSpeechSynthesizerMock::PlatformSpeechSynthesizerMock): 131 (WebCore::PlatformSpeechSynthesizerMock::speakingFinished): 132 (WebCore::PlatformSpeechSynthesizerMock::speak): 133 * platform/mock/PlatformSpeechSynthesizerMock.h: 134 (PlatformSpeechSynthesizerMock): 135 1 136 2013-03-19 Ryosuke Niwa <rniwa@webkit.org> 2 137 -
trunk/Source/WebCore/Modules/speech/SpeechSynthesis.cpp
r144703 r146277 29 29 #if ENABLE(SPEECH_SYNTHESIS) 30 30 31 #include "PlatformSpeechSynthesis.h"32 31 #include "PlatformSpeechSynthesisVoice.h" 32 #include "PlatformSpeechSynthesizer.h" 33 33 #include "SpeechSynthesisEvent.h" 34 34 #include "SpeechSynthesisUtterance.h" … … 153 153 } 154 154 155 void SpeechSynthesis::boundaryEventOccurred( const PlatformSpeechSynthesisUtterance*utterance, SpeechBoundary boundary, unsigned charIndex)155 void SpeechSynthesis::boundaryEventOccurred(PassRefPtr<PlatformSpeechSynthesisUtterance> utterance, SpeechBoundary boundary, unsigned charIndex) 156 156 { 157 157 DEFINE_STATIC_LOCAL(const String, wordBoundaryString, (ASCIILiteral("word"))); … … 170 170 } 171 171 172 void SpeechSynthesis::didStartSpeaking(const PlatformSpeechSynthesisUtterance* utterance) 173 { 174 fireEvent(eventNames().startEvent, static_cast<SpeechSynthesisUtterance*>(utterance->client()), 0, String()); 175 } 176 177 void SpeechSynthesis::didPauseSpeaking(const PlatformSpeechSynthesisUtterance* utterance) 172 void SpeechSynthesis::didStartSpeaking(PassRefPtr<PlatformSpeechSynthesisUtterance> utterance) 173 { 174 if (utterance->client()) 175 fireEvent(eventNames().startEvent, static_cast<SpeechSynthesisUtterance*>(utterance->client()), 0, String()); 176 } 177 178 void SpeechSynthesis::didPauseSpeaking(PassRefPtr<PlatformSpeechSynthesisUtterance> utterance) 178 179 { 179 180 m_isPaused = true; 180 fireEvent(eventNames().pauseEvent, static_cast<SpeechSynthesisUtterance*>(utterance->client()), 0, String()); 181 } 182 183 void SpeechSynthesis::didResumeSpeaking(const PlatformSpeechSynthesisUtterance* utterance) 181 if (utterance->client()) 182 fireEvent(eventNames().pauseEvent, static_cast<SpeechSynthesisUtterance*>(utterance->client()), 0, String()); 183 } 184 185 void SpeechSynthesis::didResumeSpeaking(PassRefPtr<PlatformSpeechSynthesisUtterance> utterance) 184 186 { 185 187 m_isPaused = false; 186 fireEvent(eventNames().resumeEvent, static_cast<SpeechSynthesisUtterance*>(utterance->client()), 0, String()); 187 } 188 189 void SpeechSynthesis::didFinishSpeaking(const PlatformSpeechSynthesisUtterance* utterance) 190 { 191 handleSpeakingCompleted(static_cast<SpeechSynthesisUtterance*>(utterance->client()), false); 192 } 193 194 void SpeechSynthesis::speakingErrorOccurred(const PlatformSpeechSynthesisUtterance* utterance) 195 { 196 handleSpeakingCompleted(static_cast<SpeechSynthesisUtterance*>(utterance->client()), true); 197 } 198 188 if (utterance->client()) 189 fireEvent(eventNames().resumeEvent, static_cast<SpeechSynthesisUtterance*>(utterance->client()), 0, String()); 190 } 191 192 void SpeechSynthesis::didFinishSpeaking(PassRefPtr<PlatformSpeechSynthesisUtterance> utterance) 193 { 194 if (utterance->client()) 195 handleSpeakingCompleted(static_cast<SpeechSynthesisUtterance*>(utterance->client()), false); 196 } 197 198 void SpeechSynthesis::speakingErrorOccurred(PassRefPtr<PlatformSpeechSynthesisUtterance> utterance) 199 { 200 if (utterance->client()) 201 handleSpeakingCompleted(static_cast<SpeechSynthesisUtterance*>(utterance->client()), true); 202 } 203 199 204 } // namespace WebCore 200 205 -
trunk/Source/WebCore/Modules/speech/SpeechSynthesis.h
r144335 r146277 66 66 // PlatformSpeechSynthesizerClient override methods. 67 67 virtual void voicesDidChange() OVERRIDE; 68 virtual void didStartSpeaking( const PlatformSpeechSynthesisUtterance*) OVERRIDE;69 virtual void didPauseSpeaking( const PlatformSpeechSynthesisUtterance*) OVERRIDE;70 virtual void didResumeSpeaking( const PlatformSpeechSynthesisUtterance*) OVERRIDE;71 virtual void didFinishSpeaking( const PlatformSpeechSynthesisUtterance*) OVERRIDE;72 virtual void speakingErrorOccurred( const PlatformSpeechSynthesisUtterance*) OVERRIDE;73 virtual void boundaryEventOccurred( const PlatformSpeechSynthesisUtterance*, SpeechBoundary, unsigned charIndex) OVERRIDE;68 virtual void didStartSpeaking(PassRefPtr<PlatformSpeechSynthesisUtterance>) OVERRIDE; 69 virtual void didPauseSpeaking(PassRefPtr<PlatformSpeechSynthesisUtterance>) OVERRIDE; 70 virtual void didResumeSpeaking(PassRefPtr<PlatformSpeechSynthesisUtterance>) OVERRIDE; 71 virtual void didFinishSpeaking(PassRefPtr<PlatformSpeechSynthesisUtterance>) OVERRIDE; 72 virtual void speakingErrorOccurred(PassRefPtr<PlatformSpeechSynthesisUtterance>) OVERRIDE; 73 virtual void boundaryEventOccurred(PassRefPtr<PlatformSpeechSynthesisUtterance>, SpeechBoundary, unsigned charIndex) OVERRIDE; 74 74 75 75 void startSpeakingImmediately(SpeechSynthesisUtterance*); -
trunk/Source/WebCore/Modules/speech/SpeechSynthesisUtterance.cpp
r144679 r146277 38 38 SpeechSynthesisUtterance::SpeechSynthesisUtterance(ScriptExecutionContext* context, const String& text) 39 39 : ContextDestructionObserver(context) 40 , m_platformUtterance(PlatformSpeechSynthesisUtterance (this))40 , m_platformUtterance(PlatformSpeechSynthesisUtterance::create(this)) 41 41 { 42 m_platformUtterance.setText(text); 42 m_platformUtterance->setText(text); 43 } 44 45 SpeechSynthesisUtterance::~SpeechSynthesisUtterance() 46 { 47 m_platformUtterance->setClient(0); 43 48 } 44 49 … … 65 70 66 71 if (voice) 67 m_platformUtterance .setVoice(voice->platformVoice());72 m_platformUtterance->setVoice(voice->platformVoice()); 68 73 } 69 74 -
trunk/Source/WebCore/Modules/speech/SpeechSynthesisUtterance.h
r144679 r146277 42 42 static PassRefPtr<SpeechSynthesisUtterance> create(ScriptExecutionContext*, const String&); 43 43 44 const String& text() const { return m_platformUtterance.text(); } 45 void setText(const String& text) { m_platformUtterance.setText(text); } 44 ~SpeechSynthesisUtterance(); 46 45 47 const String& lang() const { return m_platformUtterance.lang(); } 48 void setLang(const String& lang) { m_platformUtterance.setLang(lang); } 46 const String& text() const { return m_platformUtterance->text(); } 47 void setText(const String& text) { m_platformUtterance->setText(text); } 48 49 const String& lang() const { return m_platformUtterance->lang(); } 50 void setLang(const String& lang) { m_platformUtterance->setLang(lang); } 49 51 50 52 SpeechSynthesisVoice* voice() const; 51 53 void setVoice(SpeechSynthesisVoice*); 52 54 53 float volume() const { return m_platformUtterance .volume(); }54 void setVolume(float volume) { m_platformUtterance .setVolume(volume); }55 float volume() const { return m_platformUtterance->volume(); } 56 void setVolume(float volume) { m_platformUtterance->setVolume(volume); } 55 57 56 float rate() const { return m_platformUtterance .rate(); }57 void setRate(float rate) { m_platformUtterance .setRate(rate); }58 float rate() const { return m_platformUtterance->rate(); } 59 void setRate(float rate) { m_platformUtterance->setRate(rate); } 58 60 59 float pitch() const { return m_platformUtterance .pitch(); }60 void setPitch(float pitch) { m_platformUtterance .setPitch(pitch); }61 float pitch() const { return m_platformUtterance->pitch(); } 62 void setPitch(float pitch) { m_platformUtterance->setPitch(pitch); } 61 63 62 double startTime() const { return m_platformUtterance .startTime(); }63 void setStartTime(double startTime) { m_platformUtterance .setStartTime(startTime); }64 double startTime() const { return m_platformUtterance->startTime(); } 65 void setStartTime(double startTime) { m_platformUtterance->setStartTime(startTime); } 64 66 65 67 DEFINE_ATTRIBUTE_EVENT_LISTENER(start); … … 76 78 virtual ScriptExecutionContext* scriptExecutionContext() const; 77 79 78 const PlatformSpeechSynthesisUtterance& platformUtterance() const { return m_platformUtterance; }80 PlatformSpeechSynthesisUtterance* platformUtterance() const { return m_platformUtterance.get(); } 79 81 80 82 private: 81 83 SpeechSynthesisUtterance(ScriptExecutionContext*, const String&); 82 PlatformSpeechSynthesisUtterancem_platformUtterance;84 RefPtr<PlatformSpeechSynthesisUtterance> m_platformUtterance; 83 85 RefPtr<SpeechSynthesisVoice> m_voice; 84 86 -
trunk/Source/WebCore/Modules/speech/SpeechSynthesisVoice.h
r144679 r146277 38 38 class SpeechSynthesisVoice : public RefCounted<SpeechSynthesisVoice> { 39 39 public: 40 virtual ~SpeechSynthesisVoice() { } 40 41 static PassRefPtr<SpeechSynthesisVoice> create(PassRefPtr<PlatformSpeechSynthesisVoice>); 41 42 -
trunk/Source/WebCore/WebCore.exp.in
r146264 r146277 1567 1567 #if ENABLE(SPEECH_SYNTHESIS) 1568 1568 __ZTVN7WebCore25PlatformSpeechSynthesizerE 1569 __ZN7WebCore25PlatformSpeechSynthesizerD2Ev 1569 1570 #endif 1570 1571 __ZTVN7WebCore28InspectorFrontendClientLocal8SettingsE -
trunk/Source/WebCore/WebCore.gypi
r146208 r146277 993 993 'Modules/speech/SpeechSynthesisVoice.cpp', 994 994 'Modules/speech/SpeechSynthesisVoice.h', 995 'Modules/speech/chromium/SpeechSynthesisChromium.cpp',996 995 'Modules/webaudio/AudioBasicInspectorNode.cpp', 997 996 'Modules/webaudio/AudioBasicInspectorNode.h', … … 3697 3696 'platform/PlatformMemoryInstrumentation.cpp', 3698 3697 'platform/PlatformMemoryInstrumentation.h', 3698 'platform/PlatformSpeechSynthesisUtterance.cpp', 3699 'platform/PlatformSpeechSynthesisUtterance.h', 3700 'platform/PlatformSpeechSynthesisVoice.cpp', 3701 'platform/PlatformSpeechSynthesisVoice.h', 3702 'platform/PlatformSpeechSynthesizer.cpp', 3703 'platform/PlatformSpeechSynthesizer.h', 3699 3704 'platform/PlatformStrategies.cpp', 3700 3705 'platform/PlatformTouchEvent.h', … … 3869 3874 'platform/chromium/PlatformThemeChromiumDefault.cpp', 3870 3875 'platform/chromium/PlatformThemeChromiumDefault.h', 3876 'platform/chromium/PlatformSpeechSynthesizerChromium.cpp', 3871 3877 'platform/chromium/PlatformWidget.h', 3872 3878 'platform/chromium/PopupContainer.cpp', … … 7438 7444 'platform/chromium/support/WebScrollbarImpl.cpp', 7439 7445 'platform/chromium/support/WebScrollbarImpl.h', 7446 'platform/chromium/support/WebSpeechSynthesisUtterance.cpp', 7447 'platform/chromium/support/WebSpeechSynthesisVoice.cpp', 7448 'platform/chromium/support/WebSpeechSynthesizerClientImpl.cpp', 7449 'platform/chromium/support/WebSpeechSynthesizerClientImpl.h', 7440 7450 'platform/chromium/support/WebThreadSafeData.cpp', 7441 7451 'platform/chromium/support/WebTransformKeyframe.cpp', -
trunk/Source/WebCore/platform/PlatformSpeechSynthesis.h
r142320 r146277 29 29 #if ENABLE(SPEECH_SYNTHESIS) 30 30 31 #include <wtf/PassRefPtr.h> 31 32 #include <wtf/RefCounted.h> 33 #include <wtf/Vector.h> 32 34 33 35 namespace WebCore { … … 47 49 PlatformSpeechSynthesis(SpeechSynthesis*); 48 50 49 SpeechSynthesis* m_speechSynth sis;51 SpeechSynthesis* m_speechSynthesis; 50 52 }; 51 53 -
trunk/Source/WebCore/platform/PlatformSpeechSynthesisUtterance.cpp
r142433 r146277 30 30 31 31 namespace WebCore { 32 33 PassRefPtr<PlatformSpeechSynthesisUtterance> PlatformSpeechSynthesisUtterance::create(PlatformSpeechSynthesisUtteranceClient* client) 34 { 35 return adoptRef(new PlatformSpeechSynthesisUtterance(client)); 36 } 32 37 33 38 PlatformSpeechSynthesisUtterance::PlatformSpeechSynthesisUtterance(PlatformSpeechSynthesisUtteranceClient* client) -
trunk/Source/WebCore/platform/PlatformSpeechSynthesisUtterance.h
r144679 r146277 30 30 31 31 #include "PlatformSpeechSynthesisVoice.h" 32 #include <wtf/PassRefPtr.h> 33 #include <wtf/RefCounted.h> 32 34 #include <wtf/text/WTFString.h> 33 35 … … 41 43 }; 42 44 43 class PlatformSpeechSynthesisUtterance {45 class PlatformSpeechSynthesisUtterance : public RefCounted<PlatformSpeechSynthesisUtterance> { 44 46 public: 45 explicit PlatformSpeechSynthesisUtterance(PlatformSpeechSynthesisUtteranceClient*);47 static PassRefPtr<PlatformSpeechSynthesisUtterance> create(PlatformSpeechSynthesisUtteranceClient*); 46 48 47 49 const String& text() const { return m_text; } … … 70 72 71 73 PlatformSpeechSynthesisUtteranceClient* client() const { return m_client; } 74 void setClient(PlatformSpeechSynthesisUtteranceClient* client) { m_client = client; } 72 75 73 76 private: 77 explicit PlatformSpeechSynthesisUtterance(PlatformSpeechSynthesisUtteranceClient*); 78 74 79 PlatformSpeechSynthesisUtteranceClient* m_client; 75 80 String m_text; -
trunk/Source/WebCore/platform/PlatformSpeechSynthesisVoice.cpp
r142320 r146277 35 35 return adoptRef(new PlatformSpeechSynthesisVoice(voiceURI, name, lang, localService, isDefault)); 36 36 } 37 38 PassRefPtr<PlatformSpeechSynthesisVoice> PlatformSpeechSynthesisVoice::create() 39 { 40 return adoptRef(new PlatformSpeechSynthesisVoice()); 41 } 37 42 38 43 PlatformSpeechSynthesisVoice::PlatformSpeechSynthesisVoice(const String& voiceURI, const String& name, const String& lang, bool localService, bool isDefault) … … 45 50 } 46 51 52 PlatformSpeechSynthesisVoice::PlatformSpeechSynthesisVoice() 53 : m_localService(false) 54 , m_default(false) 55 { 56 } 57 47 58 } // namespace WebCore 48 59 -
trunk/Source/WebCore/platform/PlatformSpeechSynthesisVoice.h
r142320 r146277 38 38 public: 39 39 static PassRefPtr<PlatformSpeechSynthesisVoice> create(const String& voiceURI, const String& name, const String& lang, bool localService, bool isDefault); 40 40 static PassRefPtr<PlatformSpeechSynthesisVoice> create(); 41 41 42 const String& voiceURI() const { return m_voiceURI; } 43 void setVoiceURI(const String& voiceURI) { m_voiceURI =voiceURI; } 44 42 45 const String& name() const { return m_name; } 46 void setName(const String& name) { m_name = name; } 47 43 48 const String& lang() const { return m_lang; } 49 void setLang(const String& lang) { m_lang = lang; } 50 44 51 bool localService() const { return m_localService; } 52 void setLocalService(bool localService) { m_localService = localService; } 53 45 54 bool isDefault() const { return m_default; } 46 55 void setIsDefault(bool isDefault) { m_default = isDefault; } 56 47 57 private: 48 58 PlatformSpeechSynthesisVoice(const String& voiceURI, const String& name, const String& lang, bool localService, bool isDefault); 59 PlatformSpeechSynthesisVoice(); 49 60 50 61 String m_voiceURI; -
trunk/Source/WebCore/platform/PlatformSpeechSynthesizer.cpp
r143136 r146277 33 33 PassOwnPtr<PlatformSpeechSynthesizer> PlatformSpeechSynthesizer::create(PlatformSpeechSynthesizerClient* client) 34 34 { 35 return adoptPtr(new PlatformSpeechSynthesizer(client)); 35 OwnPtr<PlatformSpeechSynthesizer> synthesizer = adoptPtr(new PlatformSpeechSynthesizer(client)); 36 synthesizer->initializeVoiceList(); 37 return synthesizer.release(); 36 38 } 37 39 38 PlatformSpeechSynthesizer::PlatformSpeechSynthesizer(PlatformSpeechSynthesizerClient* client) 39 : m_speechSynthesizerClient(client) 40 void PlatformSpeechSynthesizer::setVoiceList(Vector<RefPtr<PlatformSpeechSynthesisVoice> >& voices) 40 41 { 41 initializeVoiceList();42 m_voiceList = voices; 42 43 } 43 44 45 44 46 } // namespace WebCore 45 47 -
trunk/Source/WebCore/platform/PlatformSpeechSynthesizer.h
r144335 r146277 38 38 #endif 39 39 40 #if PLATFORM(CHROMIUM) 41 namespace WebKit { 42 class WebSpeechSynthesizer; 43 class WebSpeechSynthesizerClient; 44 } 45 #endif 46 40 47 namespace WebCore { 41 48 … … 49 56 class PlatformSpeechSynthesizerClient { 50 57 public: 51 virtual void didStartSpeaking( const PlatformSpeechSynthesisUtterance*) = 0;52 virtual void didFinishSpeaking( const PlatformSpeechSynthesisUtterance*) = 0;53 virtual void didPauseSpeaking( const PlatformSpeechSynthesisUtterance*) = 0;54 virtual void didResumeSpeaking( const PlatformSpeechSynthesisUtterance*) = 0;55 virtual void speakingErrorOccurred( const PlatformSpeechSynthesisUtterance*) = 0;56 virtual void boundaryEventOccurred( const PlatformSpeechSynthesisUtterance*, SpeechBoundary, unsigned charIndex) = 0;58 virtual void didStartSpeaking(PassRefPtr<PlatformSpeechSynthesisUtterance>) = 0; 59 virtual void didFinishSpeaking(PassRefPtr<PlatformSpeechSynthesisUtterance>) = 0; 60 virtual void didPauseSpeaking(PassRefPtr<PlatformSpeechSynthesisUtterance>) = 0; 61 virtual void didResumeSpeaking(PassRefPtr<PlatformSpeechSynthesisUtterance>) = 0; 62 virtual void speakingErrorOccurred(PassRefPtr<PlatformSpeechSynthesisUtterance>) = 0; 63 virtual void boundaryEventOccurred(PassRefPtr<PlatformSpeechSynthesisUtterance>, SpeechBoundary, unsigned charIndex) = 0; 57 64 virtual void voicesDidChange() = 0; 58 65 protected: … … 64 71 static PassOwnPtr<PlatformSpeechSynthesizer> create(PlatformSpeechSynthesizerClient*); 65 72 66 virtual ~PlatformSpeechSynthesizer() { }73 virtual ~PlatformSpeechSynthesizer(); 67 74 68 75 const Vector<RefPtr<PlatformSpeechSynthesisVoice> >& voiceList() const { return m_voiceList; } 69 virtual void speak( const PlatformSpeechSynthesisUtterance&);76 virtual void speak(PassRefPtr<PlatformSpeechSynthesisUtterance>); 70 77 virtual void pause(); 71 78 virtual void resume(); … … 73 80 74 81 PlatformSpeechSynthesizerClient* client() const { return m_speechSynthesizerClient; } 75 82 83 void setVoiceList(Vector<RefPtr<PlatformSpeechSynthesisVoice> >&); 84 76 85 protected: 86 virtual void initializeVoiceList(); 77 87 explicit PlatformSpeechSynthesizer(PlatformSpeechSynthesizerClient*); 78 88 Vector<RefPtr<PlatformSpeechSynthesisVoice> > m_voiceList; … … 80 90 private: 81 91 PlatformSpeechSynthesizerClient* m_speechSynthesizerClient; 82 virtual void initializeVoiceList();83 92 84 93 #if PLATFORM(MAC) 85 94 RetainPtr<WebSpeechSynthesisWrapper> m_platformSpeechWrapper; 95 #endif 96 #if PLATFORM(CHROMIUM) 97 OwnPtr<WebKit::WebSpeechSynthesizer> m_webSpeechSynthesizer; 98 OwnPtr<WebKit::WebSpeechSynthesizerClient> m_webSpeechSynthesizerClient; 86 99 #endif 87 100 }; -
trunk/Source/WebCore/platform/mac/PlatformSpeechSynthesizerMac.mm
r144679 r146277 30 30 #include "PlatformSpeechSynthesisVoice.h" 31 31 #include <AppKit/NSSpeechSynthesizer.h> 32 #include <wtf/PassRefPtr.h> 32 33 #include <wtf/RetainPtr.h> 33 34 … … 38 39 WebCore::PlatformSpeechSynthesizer* m_synthesizerObject; 39 40 // Hold a Ref to the utterance so that it won't disappear until the synth is done with it. 40 constWebCore::PlatformSpeechSynthesisUtterance* m_utterance;41 WebCore::PlatformSpeechSynthesisUtterance* m_utterance; 41 42 42 43 RetainPtr<NSSpeechSynthesizer> m_synthesizer; … … 45 46 46 47 - (WebSpeechSynthesisWrapper *)initWithSpeechSynthesizer:(WebCore::PlatformSpeechSynthesizer *)synthesizer; 47 - (void)speakUtterance:( constWebCore::PlatformSpeechSynthesisUtterance *)utterance;48 - (void)speakUtterance:(WebCore::PlatformSpeechSynthesisUtterance *)utterance; 48 49 49 50 @end … … 82 83 } 83 84 84 - (void)speakUtterance:( constWebCore::PlatformSpeechSynthesisUtterance *)utterance85 - (void)speakUtterance:(WebCore::PlatformSpeechSynthesisUtterance *)utterance 85 86 { 86 87 // When speak is called we should not have an existing speech utterance outstanding. … … 166 167 167 168 // Clear the m_utterance variable in case finish speaking kicks off a new speaking job immediately. 168 constWebCore::PlatformSpeechSynthesisUtterance* utterance = m_utterance;169 WebCore::PlatformSpeechSynthesisUtterance* utterance = m_utterance; 169 170 m_utterance = 0; 170 171 … … 188 189 189 190 namespace WebCore { 191 192 PlatformSpeechSynthesizer::PlatformSpeechSynthesizer(PlatformSpeechSynthesizerClient* client) 193 : m_speechSynthesizerClient(client) 194 { 195 } 196 197 PlatformSpeechSynthesizer::~PlatformSpeechSynthesizer() 198 { 199 } 190 200 191 201 void PlatformSpeechSynthesizer::initializeVoiceList() … … 221 231 } 222 232 223 void PlatformSpeechSynthesizer::speak( const PlatformSpeechSynthesisUtterance&utterance)233 void PlatformSpeechSynthesizer::speak(PassRefPtr<PlatformSpeechSynthesisUtterance> utterance) 224 234 { 225 235 if (!m_platformSpeechWrapper) 226 236 m_platformSpeechWrapper.adoptNS([[WebSpeechSynthesisWrapper alloc] initWithSpeechSynthesizer:this]); 227 237 228 [m_platformSpeechWrapper.get() speakUtterance: &utterance];238 [m_platformSpeechWrapper.get() speakUtterance:utterance.get()]; 229 239 } 230 240 -
trunk/Source/WebCore/platform/mock/PlatformSpeechSynthesizerMock.cpp
r145304 r146277 34 34 PassOwnPtr<PlatformSpeechSynthesizerMock> PlatformSpeechSynthesizerMock::create(PlatformSpeechSynthesizerClient* client) 35 35 { 36 return adoptPtr(new PlatformSpeechSynthesizerMock(client)); 36 OwnPtr<PlatformSpeechSynthesizerMock> synthesizer = adoptPtr(new PlatformSpeechSynthesizerMock(client)); 37 synthesizer->initializeVoiceList(); 38 return synthesizer.release(); 37 39 } 38 40 … … 40 42 : PlatformSpeechSynthesizer(client) 41 43 , m_speakingFinishedTimer(this, &PlatformSpeechSynthesizerMock::speakingFinished) 42 , m_utterance(0)43 44 { 44 45 } … … 51 52 void PlatformSpeechSynthesizerMock::speakingFinished(Timer<PlatformSpeechSynthesizerMock>*) 52 53 { 53 ASSERT(m_utterance );54 ASSERT(m_utterance.get()); 54 55 client()->didFinishSpeaking(m_utterance); 55 56 m_utterance = 0; … … 64 65 } 65 66 66 void PlatformSpeechSynthesizerMock::speak( const PlatformSpeechSynthesisUtterance&utterance)67 void PlatformSpeechSynthesizerMock::speak(PassRefPtr<PlatformSpeechSynthesisUtterance> utterance) 67 68 { 68 69 ASSERT(!m_utterance); 69 m_utterance = &utterance;70 m_utterance = utterance; 70 71 client()->didStartSpeaking(m_utterance); 71 72 -
trunk/Source/WebCore/platform/mock/PlatformSpeechSynthesizerMock.h
r144244 r146277 40 40 41 41 virtual ~PlatformSpeechSynthesizerMock(); 42 virtual void speak( const PlatformSpeechSynthesisUtterance&);42 virtual void speak(PassRefPtr<PlatformSpeechSynthesisUtterance>); 43 43 virtual void pause(); 44 44 virtual void resume(); … … 51 51 52 52 Timer<PlatformSpeechSynthesizerMock> m_speakingFinishedTimer; 53 const PlatformSpeechSynthesisUtterance*m_utterance;53 RefPtr<PlatformSpeechSynthesisUtterance> m_utterance; 54 54 }; 55 55 -
trunk/Source/WebKit/chromium/features.gypi
r145774 r146277 114 114 'ENABLE_SHADOW_DOM=1', 115 115 'ENABLE_SMOOTH_SCROLLING=1', 116 'ENABLE_SPEECH_SYNTHESIS= 0',116 'ENABLE_SPEECH_SYNTHESIS=1', 117 117 'ENABLE_SQL_DATABASE=<(enable_sql_database)', 118 118 'ENABLE_STYLE_SCOPED=1',
Note: See TracChangeset
for help on using the changeset viewer.