Changeset 70490 in webkit
- Timestamp:
- Oct 25, 2010 2:10:27 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/Android.mk
r70318 r70490 426 426 page/SpatialNavigation.cpp \ 427 427 page/SpeechInput.cpp \ 428 page/SpeechInputResult.cpp \ 428 429 page/SuspendableTimer.cpp \ 429 430 page/Timing.cpp \ -
trunk/WebCore/ChangeLog
r70488 r70490 1 2010-10-21 Satish Sampath <satish@chromium.org> 2 3 Reviewed by Jeremy Orlow. 4 5 Allow embedder to pass on all the speech recognition results to the input element. 6 https://bugs.webkit.org/show_bug.cgi?id=48068 7 8 No new tests added as functionality has not changed, tests will be added in the next 9 patch where these results are exposed as an attribute to scripts. 10 11 * Android.mk: Added new source files. 12 * GNUmakefile.am: 13 * WebCore.gypi: 14 * WebCore.pro: 15 * WebCore.xcodeproj/project.pbxproj: 16 * page/SpeechInput.cpp: 17 (WebCore::SpeechInput::setRecognitionResult): Accept an array instead of a single string. 18 * page/SpeechInput.h: 19 * page/SpeechInputListener.h: 20 * page/SpeechInputResult.cpp: Added, defines a class for managing a speech input result. 21 (WebCore::SpeechInputResult::create): 22 (WebCore::SpeechInputResult::SpeechInputResult): 23 (WebCore::SpeechInputResult::confidence): 24 (WebCore::SpeechInputResult::utterance): 25 * page/SpeechInputResult.h: Added. 26 * platform/mock/SpeechInputClientMock.cpp: 27 (WebCore::SpeechInputClientMock::timerFired): 28 * rendering/TextControlInnerElements.cpp: 29 (WebCore::InputFieldSpeechButtonElement::setRecognitionResult): 30 * rendering/TextControlInnerElements.h: 31 1 32 2010-10-25 Jian Li <jianli@chromium.org> 2 33 -
trunk/WebCore/GNUmakefile.am
r70410 r70490 2127 2127 WebCore/page/SpeechInput.h \ 2128 2128 WebCore/page/SpeechInputListener.h \ 2129 WebCore/page/SpeechInputResult.cpp \ 2130 WebCore/page/SpeechInputResult.h \ 2129 2131 WebCore/page/SuspendableTimer.cpp \ 2130 2132 WebCore/page/SuspendableTimer.h \ -
trunk/WebCore/WebCore.gypi
r70410 r70490 2264 2264 'page/SpeechInputClient.h', 2265 2265 'page/SpeechInputListener.h', 2266 'page/SpeechInputResult.cpp', 2267 'page/SpeechInputResult.h', 2266 2268 'page/SuspendableTimer.cpp', 2267 2269 'page/SuspendableTimer.h', -
trunk/WebCore/WebCore.pro
r70485 r70490 2000 2000 page/SpeechInputClient.h \ 2001 2001 page/SpeechInputListener.h \ 2002 page/SpeechInputResult.h \ 2002 2003 page/WindowFeatures.h \ 2003 2004 page/WorkerNavigator.h \ … … 3104 3105 SOURCES += \ 3105 3106 page/SpeechInput.cpp \ 3107 page/SpeechInputResult.cpp \ 3106 3108 rendering/RenderInputSpeech.cpp 3107 3109 } -
trunk/WebCore/WebCore.xcodeproj/project.pbxproj
r70410 r70490 1479 1479 75793ED40D0CE85B007FC0AC /* DOMMessageEvent.mm in Sources */ = {isa = PBXBuildFile; fileRef = 75793ED10D0CE85B007FC0AC /* DOMMessageEvent.mm */; }; 1480 1480 75793ED50D0CE85B007FC0AC /* DOMMessageEventInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 75793ED20D0CE85B007FC0AC /* DOMMessageEventInternal.h */; }; 1481 758978EC127090D60076D5A9 /* SpeechInputResult.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 758978EA127090D60076D5A9 /* SpeechInputResult.cpp */; }; 1482 758978ED127090D60076D5A9 /* SpeechInputResult.h in Headers */ = {isa = PBXBuildFile; fileRef = 758978EB127090D60076D5A9 /* SpeechInputResult.h */; }; 1481 1483 7637C541112E7B74003D6CDC /* WebSocketHandshakeRequest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7637C540112E7B74003D6CDC /* WebSocketHandshakeRequest.cpp */; }; 1482 1484 7637C543112E7B7E003D6CDC /* WebSocketHandshakeRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 7637C542112E7B7E003D6CDC /* WebSocketHandshakeRequest.h */; }; … … 7590 7592 75793ED10D0CE85B007FC0AC /* DOMMessageEvent.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMMessageEvent.mm; sourceTree = "<group>"; }; 7591 7593 75793ED20D0CE85B007FC0AC /* DOMMessageEventInternal.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DOMMessageEventInternal.h; sourceTree = "<group>"; }; 7594 758978EA127090D60076D5A9 /* SpeechInputResult.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SpeechInputResult.cpp; sourceTree = "<group>"; }; 7595 758978EB127090D60076D5A9 /* SpeechInputResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SpeechInputResult.h; sourceTree = "<group>"; }; 7592 7596 7637C540112E7B74003D6CDC /* WebSocketHandshakeRequest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebSocketHandshakeRequest.cpp; sourceTree = "<group>"; }; 7593 7597 7637C542112E7B7E003D6CDC /* WebSocketHandshakeRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSocketHandshakeRequest.h; sourceTree = "<group>"; }; … … 13217 13221 7578F90A11DDF26900D933C5 /* SpeechInputClient.h */, 13218 13222 7578F91E11E4E32800D933C5 /* SpeechInputListener.h */, 13223 758978EA127090D60076D5A9 /* SpeechInputResult.cpp */, 13224 758978EB127090D60076D5A9 /* SpeechInputResult.h */, 13219 13225 62C1217A11AB9E76003C462C /* SuspendableTimer.cpp */, 13220 13226 62C1217B11AB9E77003C462C /* SuspendableTimer.h */, … … 21156 21162 8AB4BC77126FDB7100DEB727 /* IgnoreDestructiveWriteCountIncrementer.h in Headers */, 21157 21163 087B84961272CEC800A14417 /* SVGAnimatedAngle.h in Headers */, 21164 758978ED127090D60076D5A9 /* SpeechInputResult.h in Headers */, 21158 21165 ); 21159 21166 runOnlyForDeploymentPostprocessing = 0; … … 23709 23716 7A1F2B52126C61B20006A7E6 /* InspectorClient.cpp in Sources */, 23710 23717 E13F01F11270E19000DFBA71 /* CookieStorageMac.mm in Sources */, 23718 758978EC127090D60076D5A9 /* SpeechInputResult.cpp in Sources */, 23711 23719 ); 23712 23720 runOnlyForDeploymentPostprocessing = 0; -
trunk/WebCore/page/SpeechInput.cpp
r70302 r70490 86 86 } 87 87 88 void SpeechInput::setRecognitionResult(int listenerId, const S tring& result)88 void SpeechInput::setRecognitionResult(int listenerId, const SpeechInputResultArray& result) 89 89 { 90 90 // Don't assert if not present as the element might have been removed by the page while -
trunk/WebCore/page/SpeechInput.h
r70302 r70490 69 69 virtual void didCompleteRecording(int); 70 70 virtual void didCompleteRecognition(int); 71 virtual void setRecognitionResult(int, const S tring&);71 virtual void setRecognitionResult(int, const SpeechInputResultArray&); 72 72 73 73 private: -
trunk/WebCore/page/SpeechInputListener.h
r65327 r70490 34 34 #if ENABLE(INPUT_SPEECH) 35 35 36 #include "SpeechInputResult.h" 36 37 #include <wtf/Forward.h> 37 38 38 39 namespace WebCore { 40 41 typedef Vector<RefPtr<SpeechInputResult> > SpeechInputResultArray; 39 42 40 43 // Interface to be implemented by the element which invokes SpeechInput. … … 54 57 // available as the user keeps speaking. If the speech could not be recognized properly 55 58 // or if there was any other errors in the process, this method may never be called. 56 virtual void setRecognitionResult(int requestId, const S tring& result) = 0;59 virtual void setRecognitionResult(int requestId, const SpeechInputResultArray&) = 0; 57 60 58 61 protected: -
trunk/WebCore/platform/mock/SpeechInputClientMock.cpp
r70302 r70490 93 93 m_timer.startOneShot(0); 94 94 } else { 95 m_listener->setRecognitionResult(m_requestId, m_recognitionResult); 95 SpeechInputResultArray results; 96 results.append(SpeechInputResult::create(m_recognitionResult, 1.0)); 97 m_listener->setRecognitionResult(m_requestId, results); 96 98 m_listener->didCompleteRecognition(m_requestId); 97 99 m_requestId = 0; -
trunk/WebCore/rendering/TextControlInnerElements.cpp
r70302 r70490 472 472 } 473 473 474 void InputFieldSpeechButtonElement::setRecognitionResult(int, const String& result) 475 { 474 void InputFieldSpeechButtonElement::setRecognitionResult(int, const SpeechInputResultArray& results) 475 { 476 m_results = results; 477 476 478 HTMLInputElement* input = static_cast<HTMLInputElement*>(shadowAncestorNode()); 477 479 // The call to setValue() below dispatches an event, and an event handler in the page might … … 479 481 // here, we take a temporary reference. 480 482 RefPtr<HTMLInputElement> holdRef(input); 481 input->setValue(result );483 input->setValue(results.isEmpty() ? "" : results[0]->utterance()); 482 484 input->dispatchWebkitSpeechChangeEvent(); 483 485 renderer()->repaint(); -
trunk/WebCore/rendering/TextControlInnerElements.h
r66001 r70490 142 142 void didCompleteRecording(int); 143 143 void didCompleteRecognition(int); 144 void setRecognitionResult(int, const S tring& result);144 void setRecognitionResult(int, const SpeechInputResultArray&); 145 145 146 146 private: … … 152 152 SpeechInputState m_state; 153 153 int m_listenerId; 154 SpeechInputResultArray m_results; 154 155 }; 155 156 -
trunk/WebKit/chromium/ChangeLog
r70463 r70490 1 2010-10-21 Satish Sampath <satish@chromium.org> 2 3 Reviewed by Jeremy Orlow. 4 5 Allow embedder to pass on all the speech recognition results to the input element. 6 https://bugs.webkit.org/show_bug.cgi?id=48068 7 8 * WebKit.gyp: Added new files 9 * public/WebSpeechInputListener.h: 10 * public/WebSpeechInputResult.h: Added, wrapper around WebCore::SpeechInputResult 11 (WebKit::WebSpeechInputResult::WebSpeechInputResult): 12 (WebKit::WebSpeechInputResult::~WebSpeechInputResult): 13 * src/SpeechInputClientImpl.cpp: 14 (WebKit::SpeechInputClientImpl::setRecognitionResult): Accepts an array instead of a single string. 15 * src/SpeechInputClientImpl.h: 16 * src/WebSpeechInputControllerMockImpl.cpp: 17 (WebKit::WebSpeechInputControllerMockImpl::setRecognitionResult): 18 * src/WebSpeechInputControllerMockImpl.h: 19 * src/WebSpeechInputResult.cpp: Added. 20 (WebKit::WebSpeechInputResult::reset): 21 (WebKit::WebSpeechInputResult::WebSpeechInputResult): 22 (WebKit::WebSpeechInputResult::set): 23 (WebKit::WebSpeechInputResult::operator PassRefPtr<WebCore::SpeechInputResult>): 24 1 25 2010-10-25 Sheriff Bot <webkit.review.bot@gmail.com> 2 26 -
trunk/WebKit/chromium/WebKit.gyp
r70273 r70490 258 258 'public/WebSpeechInputControllerMock.h', 259 259 'public/WebSpeechInputListener.h', 260 'public/WebSpeechInputResult.h', 260 261 'public/WebStorageArea.h', 261 262 'public/WebStorageEventDispatcher.h', … … 519 520 'src/WebSpeechInputControllerMockImpl.cpp', 520 521 'src/WebSpeechInputControllerMockImpl.h', 522 'src/WebSpeechInputResult.cpp', 521 523 'src/WebStorageAreaImpl.cpp', 522 524 'src/WebStorageAreaImpl.h', -
trunk/WebKit/chromium/public/WebSpeechInputListener.h
r65815 r70490 32 32 #define WebSpeechInputListener_h 33 33 34 #include "WebSpeechInputResult.h" 35 34 36 namespace WebKit { 35 37 … … 48 50 // Typically after this call the listener would update the UI to reflect that recognition is 49 51 // in progress. 50 virtual void didCompleteRecording(int) = 0;52 virtual void didCompleteRecording(int) { WEBKIT_ASSERT_NOT_REACHED(); } 51 53 52 54 // Gives results from speech recognition, either partial or the final results. … … 54 56 // available as the user keeps speaking. If the speech could not be recognized properly 55 57 // or if there was any other errors in the process, this method may never be called. 56 virtual void setRecognitionResult(int, const WebString&) = 0; 58 virtual void setRecognitionResult(int, const WebSpeechInputResultArray&) { WEBKIT_ASSERT_NOT_REACHED(); } 59 60 // FIXME: Remove this once the chromium side is able to send multiple recognition results 61 // using the above call. 62 virtual void setRecognitionResult(int requestId, const WebString& result) 63 { 64 WebSpeechInputResultArray results(1U); 65 results[0].set(result, 1.0); 66 setRecognitionResult(requestId, results); 67 } 57 68 58 69 // Informs that speech recognition has completed. This gets invoked irrespective of whether … … 60 71 // handler typically frees up any temporary resources allocated and waits for the next speech 61 72 // recognition request. 62 virtual void didCompleteRecognition(int) = 0;73 virtual void didCompleteRecognition(int) { WEBKIT_ASSERT_NOT_REACHED(); } 63 74 64 75 protected: -
trunk/WebKit/chromium/src/SpeechInputClientImpl.cpp
r70302 r70490 87 87 } 88 88 89 void SpeechInputClientImpl::setRecognitionResult(int requestId, const WebS tring& result)89 void SpeechInputClientImpl::setRecognitionResult(int requestId, const WebSpeechInputResultArray& results) 90 90 { 91 91 ASSERT(m_listener); 92 m_listener->setRecognitionResult(requestId, result); 92 WebCore::SpeechInputResultArray webcoreResults(results.size()); 93 for (size_t i = 0; i < results.size(); ++i) 94 webcoreResults[i] = results[i]; 95 m_listener->setRecognitionResult(requestId, webcoreResults); 93 96 } 94 97 -
trunk/WebKit/chromium/src/SpeechInputClientImpl.h
r70302 r70490 61 61 // WebSpeechInputListener methods. 62 62 void didCompleteRecording(int); 63 void setRecognitionResult(int, const WebS tring&);63 void setRecognitionResult(int, const WebSpeechInputResultArray&); 64 64 void didCompleteRecognition(int); 65 65 -
trunk/WebKit/chromium/src/WebSpeechInputControllerMockImpl.cpp
r70302 r70490 71 71 } 72 72 73 void WebSpeechInputControllerMockImpl::setRecognitionResult(int requestId, const W TF::String& result)73 void WebSpeechInputControllerMockImpl::setRecognitionResult(int requestId, const WebCore::SpeechInputResultArray& result) 74 74 { 75 75 m_listener->setRecognitionResult(requestId, result); -
trunk/WebKit/chromium/src/WebSpeechInputControllerMockImpl.h
r70302 r70490 55 55 void didCompleteRecording(int requestId); 56 56 void didCompleteRecognition(int requestId); 57 void setRecognitionResult(int requestId, const W TF::String& result);57 void setRecognitionResult(int requestId, const WebCore::SpeechInputResultArray& result); 58 58 59 59 // WebSpeechInputController methods.
Note: See TracChangeset
for help on using the changeset viewer.