Commit a739a241 authored by satish@chromium.org's avatar satish@chromium.org

2010-11-18 Satish Sampath <satish@chromium.org>

        Reviewed by Jeremy Orlow.

        For speech input event, send an event object containing all the recognition results and metadata.
        https://bugs.webkit.org/show_bug.cgi?id=49736

        * fast/speech/input-onspeechchange-event-expected.txt: Added.
        * fast/speech/input-onspeechchange-event.html: New test to check multiple results.
        * fast/speech/input-text-language-tag.html: Updated with new method signature.
        * fast/speech/input-text-speechbutton.html: Ditto.
        * fast/speech/speech-button-ignore-generated-events.html: Ditto.
2010-11-18  Satish Sampath  <satish@chromium.org>

        Reviewed by Jeremy Orlow.

        For speech input event, send an event object containing all the recognition results and metadata.
        https://bugs.webkit.org/show_bug.cgi?id=49736

        Currently the speech input event 'onwebkitspeechchange' receives no parameters. WebCore already
        has the full list of recognition results and populates only the top result into the input field
        automatically. In this patch we pass a SpeechInputEvent object to the event handler, and the JS
        code can access the full list of results via "event.results.length", "results[i].utterance" and
        "results[i].confidence". Also updated mock object with appropriate methods to test multiple results.

        Test: fast/speech/input-onspeechchange-event.html

        * CMakeLists.txt:
        * GNUmakefile.am:
        * WebCore.gypi:
        * WebCore.pri:
        * WebCore.pro:
        * WebCore.xcodeproj/project.pbxproj:
        * bindings/js/JSEventCustom.cpp:
        (WebCore::toJS): Added new event
        * bindings/v8/custom/V8EventCustom.cpp:
        (WebCore::toV8): Added new event
        * dom/Event.cpp:
        (WebCore::Event::isSpeechInputEvent):
        * dom/Event.h:
        * html/HTMLInputElement.cpp:
        * html/HTMLInputElement.h:
        * page/SpeechInputEvent.h: New file implementing SpeechInputEvent.idl
        (WebCore::SpeechInputEvent::~SpeechInputEvent):
        (WebCore::SpeechInputEvent::create):
        (WebCore::SpeechInputEvent::isSpeechInputEvent):
        (WebCore::SpeechInputEvent::results):
        (WebCore::SpeechInputEvent::SpeechInputEvent):
        * page/SpeechInputEvent.idl: New file defining SpeechInputEvent object
        * page/SpeechInputListener.h:
        * page/SpeechInputResult.cpp:
        (WebCore::SpeechInputResult::create):
        * page/SpeechInputResult.h:
        * page/SpeechInputResult.idl: New file defining a single SpeechInputResult object
        * page/SpeechInputResultList.h: New file implementing SpeechInputResultList.idl
        (WebCore::SpeechInputResultList::create):
        (WebCore::SpeechInputResultList::length):
        (WebCore::SpeechInputResultList::item):
        (WebCore::SpeechInputResultList::SpeechInputResultList):
        * page/SpeechInputResultList.idl: New file defining a list of SpeechInputResult objects
        * platform/mock/SpeechInputClientMock.cpp:
        (WebCore::SpeechInputClientMock::addRecognitionResult): Renamed method and added one parameter.
        (WebCore::SpeechInputClientMock::clearResults):
        (WebCore::SpeechInputClientMock::timerFired):
        * platform/mock/SpeechInputClientMock.h:
        * rendering/TextControlInnerElements.cpp:
        (WebCore::InputFieldSpeechButtonElement::setRecognitionResult): Pass new event object to handler.
2010-11-18  Satish Sampath  <satish@chromium.org>

        Reviewed by Jeremy Orlow.

        For speech input event, send an event object containing all the recognition results and metadata.
        https://bugs.webkit.org/show_bug.cgi?id=49736

        Updated mock object's method to new signature.

        * public/WebSpeechInputControllerMock.h:
        * src/WebSpeechInputControllerMockImpl.cpp:
        (WebKit::WebSpeechInputControllerMockImpl::addMockRecognitionResult):
        * src/WebSpeechInputControllerMockImpl.h:
2010-11-18  Satish Sampath  <satish@chromium.org>

        Reviewed by Jeremy Orlow.

        For speech input event, send an event object containing all the recognition results and metadata.
        https://bugs.webkit.org/show_bug.cgi?id=49736

        Updated DRT by renaming the mock result method on all platforms to the new signature.

        * DumpRenderTree/LayoutTestController.cpp:
        (addMockSpeechInputResultCallback):
        (LayoutTestController::staticFunctions):
        * DumpRenderTree/LayoutTestController.h:
        * DumpRenderTree/chromium/LayoutTestController.cpp:
        (LayoutTestController::LayoutTestController):
        (LayoutTestController::addMockSpeechInputResult):
        * DumpRenderTree/chromium/LayoutTestController.h:
        * DumpRenderTree/gtk/LayoutTestControllerGtk.cpp:
        (LayoutTestController::addMockSpeechInputResult):
        * DumpRenderTree/mac/LayoutTestControllerMac.mm:
        (LayoutTestController::addMockSpeechInputResult):
        * DumpRenderTree/qt/LayoutTestControllerQt.cpp:
        (LayoutTestController::addMockSpeechInputResult):
        * DumpRenderTree/qt/LayoutTestControllerQt.h:
        * DumpRenderTree/win/LayoutTestControllerWin.cpp:
        (LayoutTestController::addMockSpeechInputResult):
        * DumpRenderTree/wx/LayoutTestControllerWx.cpp:
        (LayoutTestController::addMockSpeechInputResult):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72591 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 31bdf571
2010-11-18 Satish Sampath <satish@chromium.org>
Reviewed by Jeremy Orlow.
For speech input event, send an event object containing all the recognition results and metadata.
https://bugs.webkit.org/show_bug.cgi?id=49736
* fast/speech/input-onspeechchange-event-expected.txt: Added.
* fast/speech/input-onspeechchange-event.html: New test to check multiple results.
* fast/speech/input-text-language-tag.html: Updated with new method signature.
* fast/speech/input-text-speechbutton.html: Ditto.
* fast/speech/speech-button-ignore-generated-events.html: Ditto.
2010-11-22 Alexey Proskuryakov <ap@apple.com>
Reviewed by Darin Adler.
Tests for the onspeechchange event with <input type="text" speech>.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS document.getElementById("speechInput").value is "Green eggs and ham"
PASS window.event.results.length is 3
PASS window.event.results[0].utterance is "Green eggs and ham"
PASS window.event.results[0].confidence is 0.8
PASS window.event.results[1].utterance is "Green x and ham"
PASS window.event.results[1].confidence is 0.5
PASS window.event.results[2].utterance is "3 x and am"
PASS window.event.results[2].confidence is 0.2
PASS successfullyParsed is true
TEST COMPLETE
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<link rel="stylesheet" href="../js/resources/js-test-style.css">
<script src="../js/resources/js-test-pre.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<script type="text/javascript">
description('Tests for the onspeechchange event with &lt;input type="text" speech>.');
function onSpeechChange() {
shouldBeEqualToString('document.getElementById("speechInput").value', 'Green eggs and ham');
shouldEvaluateTo('window.event.results.length', 3);
shouldBeEqualToString('window.event.results[0].utterance', 'Green eggs and ham');
shouldEvaluateTo('window.event.results[0].confidence', 0.8);
shouldBeEqualToString('window.event.results[1].utterance', 'Green x and ham');
shouldEvaluateTo('window.event.results[1].confidence', 0.5);
shouldBeEqualToString('window.event.results[2].utterance', '3 x and am');
shouldEvaluateTo('window.event.results[2].confidence', 0.2);
finishJSTest();
}
function run() {
if (window.layoutTestController && window.eventSender) {
layoutTestController.addMockSpeechInputResult('Green eggs and ham', 0.8, '');
layoutTestController.addMockSpeechInputResult('Green x and ham', 0.5, '');
layoutTestController.addMockSpeechInputResult('3 x and am', 0.2, '');
// Clicking the speech button should fill in mock speech-recognized text.
var input = document.getElementById('speechInput');
var x = input.offsetLeft + input.offsetWidth - 4;
var y = input.offsetTop + input.offsetHeight / 2;
eventSender.mouseMoveTo(x, y);
eventSender.mouseDown();
eventSender.mouseUp();
}
}
window.onload = run;
window.jsTestIsAsync = true;
window.successfullyParsed = true;
</script>
<script src="../js/resources/js-test-post.js"></script>
<input id='speechInput' x-webkit-speech onwebkitspeechchange="onSpeechChange()">
</body>
</html>
......@@ -38,8 +38,8 @@ function speechButtonClick(elementId) {
function run() {
if (window.layoutTestController && window.eventSender) {
layoutTestController.setMockSpeechInputResult('Pictures of the moon', 'en-GB');
layoutTestController.setMockSpeechInputResult('月の写真', 'ja');
layoutTestController.addMockSpeechInputResult('Pictures of the moon', 1.0, 'en-GB');
layoutTestController.addMockSpeechInputResult('月の写真', 1.0, 'ja');
speechButtonClick('speechInputNone');
}
}
......
......@@ -32,7 +32,7 @@ function onWebkitSpeechChange() {
function run() {
if (window.layoutTestController && window.eventSender) {
layoutTestController.setMockSpeechInputResult('Pictures of the moon', '');
layoutTestController.addMockSpeechInputResult('Pictures of the moon', 1.0, '');
// Clicking the speech button should fill in mock speech-recognized text.
var input = document.getElementById('speechInput');
......
......@@ -49,7 +49,7 @@ function setupDispatchEventTest() {
function run() {
if (window.layoutTestController && window.eventSender) {
// Running in DRT, test the eventSender case.
layoutTestController.setMockSpeechInputResult('Pictures of the moon', '');
layoutTestController.addMockSpeechInputResult('Pictures of the moon', 1.0, '');
document.getElementById('speechInput').onwebkitspeechchange = function() {
shouldBeEqualToString('document.getElementById("speechInput").value', 'Pictures of the moon');
......
......@@ -3208,3 +3208,8 @@ BUGCR64129 MAC DEBUG : fast/files/revoke-blob-url.html = CRASH PASS
// Test added with http://trac.webkit.org/changeset/72504 needs better expectations for Chromium.
BUGWK4989 WIN LINUX : fast/css/font-face-data-uri.html = TEXT
// Remove these once the Chromium side has caught on with multiple speech input results.
BUG49736 : fast/speech/input-onspeechchange-event.html = TEXT
BUG49736 : fast/speech/input-text-language-tag.html = TEXT
BUG49736 : fast/speech/input-text-speechbutton.html = TEXT
BUG49736 : fast/speech/speech-button-ignore-generated-events.html = TEXT
......@@ -330,6 +330,9 @@ SET(WebCore_IDL_FILES
page/PerformanceTiming.idl
page/PositionError.idl
page/Screen.idl
page/SpeechInputEvent.idl
page/SpeechInputResult.idl
page/SpeechInputResultList.idl
page/WebKitPoint.idl
page/WorkerNavigator.idl
......
2010-11-18 Satish Sampath <satish@chromium.org>
Reviewed by Jeremy Orlow.
For speech input event, send an event object containing all the recognition results and metadata.
https://bugs.webkit.org/show_bug.cgi?id=49736
Currently the speech input event 'onwebkitspeechchange' receives no parameters. WebCore already
has the full list of recognition results and populates only the top result into the input field
automatically. In this patch we pass a SpeechInputEvent object to the event handler, and the JS
code can access the full list of results via "event.results.length", "results[i].utterance" and
"results[i].confidence". Also updated mock object with appropriate methods to test multiple results.
Test: fast/speech/input-onspeechchange-event.html
* CMakeLists.txt:
* GNUmakefile.am:
* WebCore.gypi:
* WebCore.pri:
* WebCore.pro:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSEventCustom.cpp:
(WebCore::toJS): Added new event
* bindings/v8/custom/V8EventCustom.cpp:
(WebCore::toV8): Added new event
* dom/Event.cpp:
(WebCore::Event::isSpeechInputEvent):
* dom/Event.h:
* html/HTMLInputElement.cpp:
* html/HTMLInputElement.h:
* page/SpeechInputEvent.h: New file implementing SpeechInputEvent.idl
(WebCore::SpeechInputEvent::~SpeechInputEvent):
(WebCore::SpeechInputEvent::create):
(WebCore::SpeechInputEvent::isSpeechInputEvent):
(WebCore::SpeechInputEvent::results):
(WebCore::SpeechInputEvent::SpeechInputEvent):
* page/SpeechInputEvent.idl: New file defining SpeechInputEvent object
* page/SpeechInputListener.h:
* page/SpeechInputResult.cpp:
(WebCore::SpeechInputResult::create):
* page/SpeechInputResult.h:
* page/SpeechInputResult.idl: New file defining a single SpeechInputResult object
* page/SpeechInputResultList.h: New file implementing SpeechInputResultList.idl
(WebCore::SpeechInputResultList::create):
(WebCore::SpeechInputResultList::length):
(WebCore::SpeechInputResultList::item):
(WebCore::SpeechInputResultList::SpeechInputResultList):
* page/SpeechInputResultList.idl: New file defining a list of SpeechInputResult objects
* platform/mock/SpeechInputClientMock.cpp:
(WebCore::SpeechInputClientMock::addRecognitionResult): Renamed method and added one parameter.
(WebCore::SpeechInputClientMock::clearResults):
(WebCore::SpeechInputClientMock::timerFired):
* platform/mock/SpeechInputClientMock.h:
* rendering/TextControlInnerElements.cpp:
(WebCore::InputFieldSpeechButtonElement::setRecognitionResult): Pass new event object to handler.
2010-11-22 Alexey Proskuryakov <ap@apple.com>
Reviewed by Darin Adler.
......@@ -304,6 +304,9 @@ DOM_CLASSES = \
SharedWorkerContext \
ScriptProfile \
ScriptProfileNode \
SpeechInputEvent \
SpeechInputResult \
SpeechInputResultList \
SQLError \
SQLException \
SQLResultSet \
......
......@@ -497,6 +497,12 @@ webcore_built_sources += \
DerivedSources/WebCore/JSSharedWorkerContext.h \
DerivedSources/WebCore/JSSharedWorker.cpp \
DerivedSources/WebCore/JSSharedWorker.h \
DerivedSources/WebCore/JSSpeechInputEvent.cpp \
DerivedSources/WebCore/JSSpeechInputEvent.h \
DerivedSources/WebCore/JSSpeechInputResult.cpp \
DerivedSources/WebCore/JSSpeechInputResult.h \
DerivedSources/WebCore/JSSpeechInputResultList.cpp \
DerivedSources/WebCore/JSSpeechInputResultList.h \
DerivedSources/WebCore/JSStyleMedia.cpp \
DerivedSources/WebCore/JSStyleMedia.h \
DerivedSources/WebCore/JSStyleSheet.cpp \
......@@ -2171,11 +2177,15 @@ webcore_sources += \
WebCore/page/SpatialNavigation.cpp \
WebCore/page/SpatialNavigation.h \
WebCore/page/SpeechInputClient.h \
WebCore/page/SpeechInputEvent.cpp \
WebCore/page/SpeechInputEvent.h \
WebCore/page/SpeechInput.cpp \
WebCore/page/SpeechInput.h \
WebCore/page/SpeechInputListener.h \
WebCore/page/SpeechInputResult.cpp \
WebCore/page/SpeechInputResult.h \
WebCore/page/SpeechInputResultList.cpp \
WebCore/page/SpeechInputResultList.h \
WebCore/page/SuspendableTimer.cpp \
WebCore/page/SuspendableTimer.h \
WebCore/page/UserContentTypes.h \
......
......@@ -251,6 +251,9 @@
'page/PerformanceTiming.idl',
'page/PositionError.idl',
'page/Screen.idl',
'page/SpeechInputEvent.idl',
'page/SpeechInputResult.idl',
'page/SpeechInputResultList.idl',
'page/WebKitPoint.idl',
'page/WorkerNavigator.idl',
'plugins/DOMMimeType.idl',
......@@ -2303,9 +2306,13 @@
'page/SpeechInput.cpp',
'page/SpeechInput.h',
'page/SpeechInputClient.h',
'page/SpeechInputEvent.cpp',
'page/SpeechInputEvent.h',
'page/SpeechInputListener.h',
'page/SpeechInputResult.cpp',
'page/SpeechInputResult.h',
'page/SpeechInputResultList.cpp',
'page/SpeechInputResultList.h',
'page/SuspendableTimer.cpp',
'page/SuspendableTimer.h',
'page/UserContentURLPattern.cpp',
......
......@@ -312,6 +312,9 @@ IDL_BINDINGS += \
page/PerformanceTiming.idl \
page/PositionError.idl \
page/Screen.idl \
page/SpeechInputEvent.idl \
page/SpeechInputResult.idl \
page/SpeechInputResultList.idl \
page/WebKitPoint.idl \
page/WorkerNavigator.idl \
plugins/DOMPlugin.idl \
......
......@@ -2025,8 +2025,10 @@ HEADERS += \
page/SpatialNavigation.h \
page/SpeechInput.h \
page/SpeechInputClient.h \
page/SpeechInputEvent.h \
page/SpeechInputListener.h \
page/SpeechInputResult.h \
page/SpeechInputResultList.h \
page/WindowFeatures.h \
page/WorkerNavigator.h \
page/XSSAuditor.h \
......@@ -3149,7 +3151,9 @@ contains(DEFINES, ENABLE_SHARED_WORKERS=1) {
contains(DEFINES, ENABLE_INPUT_SPEECH=1) {
SOURCES += \
page/SpeechInput.cpp \
page/SpeechInputEvent.cpp \
page/SpeechInputResult.cpp \
page/SpeechInputResultList.cpp \
rendering/RenderInputSpeech.cpp
}
......
......@@ -1512,6 +1512,16 @@
7535BC9512020CFF0037EC45 /* SpeechInputClientMock.h in Headers */ = {isa = PBXBuildFile; fileRef = 7535BC9312020CFF0037EC45 /* SpeechInputClientMock.h */; };
754133A8102E00E800075D00 /* InspectorTimelineAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = 754133A7102E00E800075D00 /* InspectorTimelineAgent.h */; };
754133AA102E00F400075D00 /* InspectorTimelineAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 754133A9102E00F400075D00 /* InspectorTimelineAgent.cpp */; };
75415AFD12958D5E003AD669 /* SpeechInputEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 75415AF812958D5E003AD669 /* SpeechInputEvent.h */; };
75415B0012958D5E003AD669 /* SpeechInputResultList.h in Headers */ = {isa = PBXBuildFile; fileRef = 75415AFB12958D5E003AD669 /* SpeechInputResultList.h */; };
75415C28129A9920003AD669 /* SpeechInputEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 75415C26129A9920003AD669 /* SpeechInputEvent.cpp */; };
75415C29129A9920003AD669 /* SpeechInputResultList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 75415C27129A9920003AD669 /* SpeechInputResultList.cpp */; };
75415D55129AB2D2003AD669 /* JSSpeechInputEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 75415D4F129AB2D2003AD669 /* JSSpeechInputEvent.cpp */; };
75415D56129AB2D2003AD669 /* JSSpeechInputEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 75415D50129AB2D2003AD669 /* JSSpeechInputEvent.h */; };
75415D57129AB2D2003AD669 /* JSSpeechInputResult.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 75415D51129AB2D2003AD669 /* JSSpeechInputResult.cpp */; };
75415D58129AB2D2003AD669 /* JSSpeechInputResult.h in Headers */ = {isa = PBXBuildFile; fileRef = 75415D52129AB2D2003AD669 /* JSSpeechInputResult.h */; };
75415D59129AB2D2003AD669 /* JSSpeechInputResultList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 75415D53129AB2D2003AD669 /* JSSpeechInputResultList.cpp */; };
75415D5A129AB2D2003AD669 /* JSSpeechInputResultList.h in Headers */ = {isa = PBXBuildFile; fileRef = 75415D54129AB2D2003AD669 /* JSSpeechInputResultList.h */; };
7553CFE8108F473F00EA281E /* TimelineRecordFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = 7553CFE6108F473F00EA281E /* TimelineRecordFactory.h */; };
7553CFE9108F473F00EA281E /* TimelineRecordFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7553CFE7108F473F00EA281E /* TimelineRecordFactory.cpp */; };
7578F90B11DDF26900D933C5 /* SpeechInput.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7578F90811DDF26900D933C5 /* SpeechInput.cpp */; };
......@@ -7670,6 +7680,19 @@
7535BC9312020CFF0037EC45 /* SpeechInputClientMock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SpeechInputClientMock.h; path = mock/SpeechInputClientMock.h; sourceTree = "<group>"; };
754133A7102E00E800075D00 /* InspectorTimelineAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorTimelineAgent.h; sourceTree = "<group>"; };
754133A9102E00F400075D00 /* InspectorTimelineAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorTimelineAgent.cpp; sourceTree = "<group>"; };
75415AF812958D5E003AD669 /* SpeechInputEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SpeechInputEvent.h; sourceTree = "<group>"; };
75415AF912958D5E003AD669 /* SpeechInputEvent.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = SpeechInputEvent.idl; sourceTree = "<group>"; };
75415AFA12958D5E003AD669 /* SpeechInputResult.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = SpeechInputResult.idl; sourceTree = "<group>"; };
75415AFB12958D5E003AD669 /* SpeechInputResultList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SpeechInputResultList.h; sourceTree = "<group>"; };
75415AFC12958D5E003AD669 /* SpeechInputResultList.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = SpeechInputResultList.idl; sourceTree = "<group>"; };
75415C26129A9920003AD669 /* SpeechInputEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SpeechInputEvent.cpp; sourceTree = "<group>"; };
75415C27129A9920003AD669 /* SpeechInputResultList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SpeechInputResultList.cpp; sourceTree = "<group>"; };
75415D4F129AB2D2003AD669 /* JSSpeechInputEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSpeechInputEvent.cpp; sourceTree = "<group>"; };
75415D50129AB2D2003AD669 /* JSSpeechInputEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSSpeechInputEvent.h; sourceTree = "<group>"; };
75415D51129AB2D2003AD669 /* JSSpeechInputResult.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSpeechInputResult.cpp; sourceTree = "<group>"; };
75415D52129AB2D2003AD669 /* JSSpeechInputResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSSpeechInputResult.h; sourceTree = "<group>"; };
75415D53129AB2D2003AD669 /* JSSpeechInputResultList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSpeechInputResultList.cpp; sourceTree = "<group>"; };
75415D54129AB2D2003AD669 /* JSSpeechInputResultList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSSpeechInputResultList.h; sourceTree = "<group>"; };
7553CFE6108F473F00EA281E /* TimelineRecordFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TimelineRecordFactory.h; sourceTree = "<group>"; };
7553CFE7108F473F00EA281E /* TimelineRecordFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TimelineRecordFactory.cpp; sourceTree = "<group>"; };
7578F90811DDF26900D933C5 /* SpeechInput.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SpeechInput.cpp; sourceTree = "<group>"; };
......@@ -13340,9 +13363,16 @@
7578F90811DDF26900D933C5 /* SpeechInput.cpp */,
7578F90911DDF26900D933C5 /* SpeechInput.h */,
7578F90A11DDF26900D933C5 /* SpeechInputClient.h */,
75415C26129A9920003AD669 /* SpeechInputEvent.cpp */,
75415AF812958D5E003AD669 /* SpeechInputEvent.h */,
75415AF912958D5E003AD669 /* SpeechInputEvent.idl */,
7578F91E11E4E32800D933C5 /* SpeechInputListener.h */,
758978EA127090D60076D5A9 /* SpeechInputResult.cpp */,
758978EB127090D60076D5A9 /* SpeechInputResult.h */,
75415AFA12958D5E003AD669 /* SpeechInputResult.idl */,
75415C27129A9920003AD669 /* SpeechInputResultList.cpp */,
75415AFB12958D5E003AD669 /* SpeechInputResultList.h */,
75415AFC12958D5E003AD669 /* SpeechInputResultList.idl */,
62C1217A11AB9E76003C462C /* SuspendableTimer.cpp */,
62C1217B11AB9E77003C462C /* SuspendableTimer.h */,
003F1FE911E6AB43008258D9 /* UserContentTypes.h */,
......@@ -15894,6 +15924,12 @@
65DF31EC09D1CC60000BE325 /* JSProcessingInstruction.h */,
E4B423850CBFB73C00AF2ECE /* JSProgressEvent.cpp */,
E4B423860CBFB73C00AF2ECE /* JSProgressEvent.h */,
75415D4F129AB2D2003AD669 /* JSSpeechInputEvent.cpp */,
75415D50129AB2D2003AD669 /* JSSpeechInputEvent.h */,
75415D51129AB2D2003AD669 /* JSSpeechInputResult.cpp */,
75415D52129AB2D2003AD669 /* JSSpeechInputResult.h */,
75415D53129AB2D2003AD669 /* JSSpeechInputResultList.cpp */,
75415D54129AB2D2003AD669 /* JSSpeechInputResultList.h */,
65DF31EF09D1CC60000BE325 /* JSText.cpp */,
65DF31F009D1CC60000BE325 /* JSText.h */,
);
......@@ -21351,6 +21387,11 @@
D3A94A3B122DABAC00A37BBC /* MediaQueryListListener.h in Headers */,
D3A94A47122DC40F00A37BBC /* JSMediaQueryList.h in Headers */,
D3AA10F4123A98AA0092152B /* MediaQueryMatcher.h in Headers */,
75415AFD12958D5E003AD669 /* SpeechInputEvent.h in Headers */,
75415B0012958D5E003AD669 /* SpeechInputResultList.h in Headers */,
75415D56129AB2D2003AD669 /* JSSpeechInputEvent.h in Headers */,
75415D58129AB2D2003AD669 /* JSSpeechInputResult.h in Headers */,
75415D5A129AB2D2003AD669 /* JSSpeechInputResultList.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -23920,6 +23961,11 @@
D3A94A46122DC40F00A37BBC /* JSMediaQueryList.cpp in Sources */,
D3AA10F3123A98AA0092152B /* MediaQueryMatcher.cpp in Sources */,
D340629B1253BC8C009E4259 /* MediaQueryListListener.cpp in Sources */,
75415C28129A9920003AD669 /* SpeechInputEvent.cpp in Sources */,
75415C29129A9920003AD669 /* SpeechInputResultList.cpp in Sources */,
75415D55129AB2D2003AD669 /* JSSpeechInputEvent.cpp in Sources */,
75415D57129AB2D2003AD669 /* JSSpeechInputResult.cpp in Sources */,
75415D59129AB2D2003AD669 /* JSSpeechInputResultList.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -51,6 +51,7 @@
#include "JSPageTransitionEvent.h"
#include "JSPopStateEvent.h"
#include "JSProgressEvent.h"
#include "JSSpeechInputEvent.h"
#include "JSTextEvent.h"
#include "JSUIEvent.h"
#include "JSWebKitAnimationEvent.h"
......@@ -68,6 +69,7 @@
#include "PageTransitionEvent.h"
#include "PopStateEvent.h"
#include "ProgressEvent.h"
#include "SpeechInputEvent.h"
#include "TextEvent.h"
#include "UIEvent.h"
#include "WebKitAnimationEvent.h"
......@@ -192,6 +194,10 @@ JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, Event* event)
#if ENABLE(WEB_AUDIO)
else if (event->isAudioProcessingEvent())
wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, AudioProcessingEvent, event);
#endif
#if ENABLE(INPUT_SPEECH)
else if (event->isSpeechInputEvent())
wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, SpeechInputEvent, event);
#endif
else
wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, Event, event);
......
......@@ -55,6 +55,7 @@
#include "V8PopStateEvent.h"
#include "V8ProgressEvent.h"
#include "V8Proxy.h"
#include "V8SpeechInputEvent.h"
#include "V8StorageEvent.h"
#include "V8TextEvent.h"
#include "V8TouchEvent.h"
......@@ -171,6 +172,10 @@ v8::Handle<v8::Value> toV8(Event* impl)
#if ENABLE(WEB_AUDIO)
if (impl->isAudioProcessingEvent())
return toV8(static_cast<AudioProcessingEvent*>(impl));
#endif
#if ENABLE(INPUT_SPEECH)
if (impl->isSpeechInputEvent())
return toV8(static_cast<SpeechInputEvent*>(impl));
#endif
if (impl->isCustomEvent())
return toV8(static_cast<CustomEvent*>(impl));
......
......@@ -236,6 +236,13 @@ bool Event::isAudioProcessingEvent() const
}
#endif
#if ENABLE(INPUT_SPEECH)
bool Event::isSpeechInputEvent() const
{
return false;
}
#endif
bool Event::fromUserGesture()
{
if (!UserGestureIndicator::processingUserGesture())
......
......@@ -141,6 +141,9 @@ namespace WebCore {
#if ENABLE(DEVICE_ORIENTATION)
virtual bool isDeviceMotionEvent() const;
virtual bool isDeviceOrientationEvent() const;
#endif
#if ENABLE(INPUT_SPEECH)
virtual bool isSpeechInputEvent() const;
#endif
bool fromUserGesture();
......
......@@ -1937,11 +1937,6 @@ bool HTMLInputElement::isSpeechEnabled() const
return false;
}
void HTMLInputElement::dispatchWebkitSpeechChangeEvent()
{
ASSERT(isSpeechEnabled());
dispatchEvent(Event::create(eventNames().webkitspeechchangeEvent, true, false));
}
#endif
} // namespace
......@@ -108,7 +108,6 @@ public:
#if ENABLE(INPUT_SPEECH)
virtual bool isSpeechEnabled() const;
void dispatchWebkitSpeechChangeEvent();
#endif
bool checked() const { return m_checked; }
......
/*
* Copyright (C) 2010 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "SpeechInputEvent.h"
#if ENABLE(INPUT_SPEECH)
namespace WebCore {
PassRefPtr<SpeechInputEvent> SpeechInputEvent::create(const AtomicString& eventType, const SpeechInputResultArray& results)
{
return adoptRef(new SpeechInputEvent(eventType, results));
}
SpeechInputEvent::~SpeechInputEvent() {
}
SpeechInputEvent::SpeechInputEvent(const AtomicString& eventType, const SpeechInputResultArray& results)
: Event(eventType, true, false) // Can bubble, not cancelable
, m_results(SpeechInputResultList::create(results))
{
}
} // namespace WebCore
#endif // ENABLE(INPUT_SPEECH)
/*
* Copyright (C) 2010 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef SpeechInputEvent_h
#define SpeechInputEvent_h
#if ENABLE(INPUT_SPEECH)
#include "Event.h"
#include "SpeechInputResultList.h"
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
#include <wtf/Vector.h>
namespace WebCore {
class SpeechInputEvent : public Event {
public:
static PassRefPtr<SpeechInputEvent> create(const AtomicString& eventType, const SpeechInputResultArray& results);
~SpeechInputEvent();
virtual bool isSpeechInputEvent() const { return true; }
SpeechInputResultList* results() const { return m_results.get(); }
private:
SpeechInputEvent(const AtomicString& eventType, const SpeechInputResultArray& results);
RefPtr<SpeechInputResultList> m_results;
};
} // namespace WebCore
#endif // ENABLE(INPUT_SPEECH)
#endif // SpeechInputEvent_h
/*
* Copyright (C) 2010 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
module core {
interface [
Conditional=INPUT_SPEECH
] SpeechInputEvent : Event {
readonly attribute SpeechInputResultList results;
};
}
......@@ -38,8 +38,6 @@
namespace WebCore {
typedef Vector<RefPtr<SpeechInputResult> > SpeechInputResultArray;
// Interface to be implemented by the element which invokes SpeechInput.
class SpeechInputListener {
public:
......
......@@ -35,6 +35,11 @@ PassRefPtr<SpeechInputResult> SpeechInputResult::create(const String& utterance,
return adoptRef(new SpeechInputResult(utterance, confidence));
}
PassRefPtr<SpeechInputResult> SpeechInputResult::create(const SpeechInputResult& source)
{
return adoptRef(new SpeechInputResult(source.m_utterance, source.m_confidence));
}
SpeechInputResult::SpeechInputResult(const String& utterance, double confidence)
: m_utterance(utterance)
, m_confidence(confidence)
......
......@@ -38,6 +38,7 @@ namespace WebCore {
// fields, as received from the embedder.
class SpeechInputResult : public RefCounted<SpeechInputResult> {
public:
static PassRefPtr<SpeechInputResult> create(const SpeechInputResult& source);
static PassRefPtr<SpeechInputResult> create(const String& utterance, double confidence);
double confidence() const;
......@@ -50,6 +51,8 @@ private:
double m_confidence;
};
typedef Vector<RefPtr<SpeechInputResult> > SpeechInputResultArray;
} // namespace WebCore
#endif // ENABLE(INPUT_SPEECH)