Changeset 70567 in webkit
- Timestamp:
- Oct 26, 2010 1:40:37 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r70566 r70567 1 2010-10-26 Satish Sampath <satish@chromium.org> 2 3 Reviewed by Jeremy Orlow. 4 5 Add a 'grammar' attribute for speech input. 6 https://bugs.webkit.org/show_bug.cgi?id=48339 7 8 To differentiate between various types of speech input, we add a 'x-webkit-grammar' attribute to a 9 speech enabled input element. This is passed without validation to the speech recognizer. Typical values 10 could be "builtin:search", "builtin:dictation" and even an externally hosted SRGS grammar XML file URI. 11 It is up to the recognizer to interpret the value and use it as an aid in recognition. 12 13 * bindings/generic/RuntimeEnabledFeatures.h: 14 (WebCore::RuntimeEnabledFeatures::webkitGrammarEnabled): 15 * html/HTMLAttributeNames.in: 16 * html/HTMLInputElement.idl: 17 * page/SpeechInput.cpp: 18 (WebCore::SpeechInput::startRecognition): 19 * page/SpeechInput.h: 20 * page/SpeechInputClient.h: 21 * platform/mock/SpeechInputClientMock.cpp: 22 (WebCore::SpeechInputClientMock::startRecognition): 23 * platform/mock/SpeechInputClientMock.h: 24 * rendering/TextControlInnerElements.cpp: 25 (WebCore::InputFieldSpeechButtonElement::defaultEventHandler): 26 1 27 2010-10-26 Pavel Feldman <pfeldman@chromium.org> 2 28 -
trunk/WebCore/bindings/generic/RuntimeEnabledFeatures.h
r70478 r70567 140 140 static bool speechInputEnabled() { return isSpeechInputEnabled; } 141 141 static bool webkitSpeechEnabled() { return isSpeechInputEnabled; } 142 static bool webkitGrammarEnabled() { return isSpeechInputEnabled; } 142 143 143 144 #if ENABLE(XHR_RESPONSE_BLOB) -
trunk/WebCore/html/HTMLAttributeNames.in
r69100 r70567 261 261 span 262 262 x-webkit-speech 263 x-webkit-grammar 263 264 spellcheck 264 265 src -
trunk/WebCore/html/HTMLInputElement.idl
r69100 r70567 102 102 #if defined(ENABLE_INPUT_SPEECH) && ENABLE_INPUT_SPEECH 103 103 attribute [Reflect, EnabledAtRuntime] boolean webkitSpeech; 104 attribute [Reflect, EnabledAtRuntime] boolean webkitGrammar; 104 105 attribute [DontEnum] EventListener onwebkitspeechchange; 105 106 #endif -
trunk/WebCore/page/SpeechInput.cpp
r70490 r70567 94 94 } 95 95 96 bool SpeechInput::startRecognition(int listenerId, const IntRect& elementRect )96 bool SpeechInput::startRecognition(int listenerId, const IntRect& elementRect, const String& grammar) 97 97 { 98 98 ASSERT(m_listeners.contains(listenerId)); 99 return m_client->startRecognition(listenerId, elementRect );99 return m_client->startRecognition(listenerId, elementRect, grammar); 100 100 } 101 101 -
trunk/WebCore/page/SpeechInput.h
r70490 r70567 62 62 63 63 // Methods invoked by the input elements. 64 bool startRecognition(int , const IntRect&);64 bool startRecognition(int listenerId, const IntRect& elementRect, const String& grammar); 65 65 void stopRecording(int); 66 66 void cancelRecognition(int); -
trunk/WebCore/page/SpeechInputClient.h
r70302 r70567 32 32 #define SpeechInputClient_h 33 33 34 #include <wtf/Forward.h> 35 34 36 #if ENABLE(INPUT_SPEECH) 35 37 … … 49 51 50 52 // Starts speech recognition and audio recording. 51 virtual bool startRecognition(int requestId, const IntRect& elementRect ) = 0;53 virtual bool startRecognition(int requestId, const IntRect& elementRect, const String& grammar) = 0; 52 54 53 55 // Stops audio recording and performs recognition with the audio recorded until now -
trunk/WebCore/platform/mock/SpeechInputClientMock.cpp
r70490 r70567 51 51 } 52 52 53 bool SpeechInputClientMock::startRecognition(int requestId, const IntRect& )53 bool SpeechInputClientMock::startRecognition(int requestId, const IntRect& elementRect, const String& grammar) 54 54 { 55 55 if (m_timer.isActive()) -
trunk/WebCore/platform/mock/SpeechInputClientMock.h
r70302 r70567 51 51 // SpeechInputClient methods. 52 52 void setListener(SpeechInputListener*); 53 bool startRecognition(int , const IntRect&);53 bool startRecognition(int requestId, const IntRect& elementRect, const String& grammar); 54 54 void stopRecording(int); 55 55 void cancelRecognition(int); -
trunk/WebCore/rendering/TextControlInnerElements.cpp
r70490 r70567 432 432 switch (m_state) { 433 433 case Idle: 434 if (speechInput()->startRecognition(m_listenerId, input->renderer()->absoluteBoundingBoxRect() ))434 if (speechInput()->startRecognition(m_listenerId, input->renderer()->absoluteBoundingBoxRect(), input->getAttribute(webkitgrammarAttr))) 435 435 setState(Recording); 436 436 break; -
trunk/WebKit/chromium/ChangeLog
r70559 r70567 1 2010-10-26 Satish Sampath <satish@chromium.org> 2 3 Reviewed by Jeremy Orlow. 4 5 Add a 'grammar' attribute for speech input. 6 https://bugs.webkit.org/show_bug.cgi?id=48339 7 8 To differentiate between various types of speech input, we add a 'x-webkit-grammar' attribute to a 9 speech enabled input element. This is passed without validation to the speech recognizer. Typical values 10 could be "builtin:search", "builtin:dictation" and even an externally hosted SRGS grammar XML file URI. 11 It is up to the recognizer to interpret the value and use it as an aid in recognition. 12 13 * public/WebSpeechInputController.h: 14 (WebKit::WebSpeechInputController::startRecognition): 15 * src/SpeechInputClientImpl.cpp: 16 (WebKit::SpeechInputClientImpl::startRecognition): 17 * src/SpeechInputClientImpl.h: 18 * src/WebSpeechInputControllerMockImpl.cpp: 19 (WebKit::WebSpeechInputControllerMockImpl::startRecognition): 20 * src/WebSpeechInputControllerMockImpl.h: 21 1 22 2010-10-26 Hans Wennborg <hans@chromium.org> 2 23 -
trunk/WebKit/chromium/public/WebSpeechInputController.h
r70302 r70567 37 37 38 38 struct WebRect; 39 class WebString; 39 40 40 41 // Provides an embedder API called by WebKit. … … 44 45 // runs to the limit or stopRecording is called. Progress indications and the recognized 45 46 // text are returned via the listener interface. 47 virtual bool startRecognition(int requestId, const WebRect& elementRect, const WebString& grammar) 48 { 49 startRecognition(requestId, elementRect); 50 return false; 51 } 52 53 // FIXME: Remove this method once chromium implements the above method. 46 54 virtual bool startRecognition(int requestId, const WebRect&) 47 55 { -
trunk/WebKit/chromium/src/SpeechInputClientImpl.cpp
r70490 r70567 57 57 } 58 58 59 bool SpeechInputClientImpl::startRecognition(int requestId, const WebCore::IntRect& elementRect )59 bool SpeechInputClientImpl::startRecognition(int requestId, const WebCore::IntRect& elementRect, const WTF::String& grammar) 60 60 { 61 61 ASSERT(m_listener); 62 return m_controller->startRecognition(requestId, elementRect );62 return m_controller->startRecognition(requestId, elementRect, grammar); 63 63 } 64 64 -
trunk/WebKit/chromium/src/SpeechInputClientImpl.h
r70490 r70567 55 55 // SpeechInputClient methods. 56 56 void setListener(WebCore::SpeechInputListener*); 57 bool startRecognition(int , const WebCore::IntRect&);57 bool startRecognition(int requestId, const WebCore::IntRect& elementRect, const WTF::String& grammar); 58 58 void stopRecording(int); 59 59 void cancelRecognition(int); -
trunk/WebKit/chromium/src/WebSpeechInputControllerMockImpl.cpp
r70490 r70567 76 76 } 77 77 78 bool WebSpeechInputControllerMockImpl::startRecognition(int requestId, const WebRect& elementRect )78 bool WebSpeechInputControllerMockImpl::startRecognition(int requestId, const WebRect& elementRect, const WebString& grammar) 79 79 { 80 return m_webcoreMock->startRecognition(requestId, elementRect );80 return m_webcoreMock->startRecognition(requestId, elementRect, grammar); 81 81 } 82 82 -
trunk/WebKit/chromium/src/WebSpeechInputControllerMockImpl.h
r70490 r70567 58 58 59 59 // WebSpeechInputController methods. 60 bool startRecognition(int requestId, const WebRect& elementRect );60 bool startRecognition(int requestId, const WebRect& elementRect, const WebString& grammar); 61 61 void cancelRecognition(int requestId); 62 62 void stopRecording(int requestId);
Note: See TracChangeset
for help on using the changeset viewer.