Changeset 72591 in webkit


Ignore:
Timestamp:
Nov 23, 2010 2:01:52 AM (13 years ago)
Author:
satish@chromium.org
Message:

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):
Location:
trunk
Files:
1 added
40 edited
8 copied

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r72590 r72591  
     12010-11-18  Satish Sampath  <satish@chromium.org>
     2
     3        Reviewed by Jeremy Orlow.
     4
     5        For speech input event, send an event object containing all the recognition results and metadata.
     6        https://bugs.webkit.org/show_bug.cgi?id=49736
     7
     8        * fast/speech/input-onspeechchange-event-expected.txt: Added.
     9        * fast/speech/input-onspeechchange-event.html: New test to check multiple results.
     10        * fast/speech/input-text-language-tag.html: Updated with new method signature.
     11        * fast/speech/input-text-speechbutton.html: Ditto.
     12        * fast/speech/speech-button-ignore-generated-events.html: Ditto.
     13
    1142010-11-22  Alexey Proskuryakov  <ap@apple.com>
    215
  • trunk/LayoutTests/fast/speech/input-onspeechchange-event.html

    r72590 r72591  
    99<div id="console"></div>
    1010<script type="text/javascript">
    11 description('Tests for speech button click with &lt;input type="text" speech>.');
     11description('Tests for the onspeechchange event with &lt;input type="text" speech>.');
    1212
    13 function onWebkitSpeechChange() {
    14     shouldBeEqualToString('document.getElementById("speechInput").value', 'Pictures of the moon');
    15     setTimeout(function() {
    16         var input = document.getElementById('speechInput');
    17         input.dir = 'rtl';
    18         input.value = '';
    19         input.onwebkitspeechchange = function() {
    20             shouldBeEqualToString('document.getElementById("speechInput").value',
    21                                   'Pictures of the moon');
    22             finishJSTest();
    23         };
    24 
    25         var x = input.offsetLeft + 4;
    26         var y = input.offsetTop + input.offsetHeight / 2;
    27         eventSender.mouseMoveTo(x, y);
    28         eventSender.mouseDown();
    29         eventSender.mouseUp();
    30     }, 50);
     13function onSpeechChange() {
     14    shouldBeEqualToString('document.getElementById("speechInput").value', 'Green eggs and ham');
     15    shouldEvaluateTo('window.event.results.length', 3);
     16    shouldBeEqualToString('window.event.results[0].utterance', 'Green eggs and ham');
     17    shouldEvaluateTo('window.event.results[0].confidence', 0.8);
     18    shouldBeEqualToString('window.event.results[1].utterance', 'Green x and ham');
     19    shouldEvaluateTo('window.event.results[1].confidence', 0.5);
     20    shouldBeEqualToString('window.event.results[2].utterance', '3 x and am');
     21    shouldEvaluateTo('window.event.results[2].confidence', 0.2);
     22    finishJSTest();
    3123}
    3224
    3325function run() {
    3426    if (window.layoutTestController && window.eventSender) {
    35         layoutTestController.setMockSpeechInputResult('Pictures of the moon', '');
     27        layoutTestController.addMockSpeechInputResult('Green eggs and ham', 0.8, '');
     28        layoutTestController.addMockSpeechInputResult('Green x and ham', 0.5, '');
     29        layoutTestController.addMockSpeechInputResult('3 x and am', 0.2, '');
    3630
    3731        // Clicking the speech button should fill in mock speech-recognized text.
     
    5044</script>
    5145<script src="../js/resources/js-test-post.js"></script>
    52 <input id='speechInput' x-webkit-speech onwebkitspeechchange="onWebkitSpeechChange()">
     46<input id='speechInput' x-webkit-speech onwebkitspeechchange="onSpeechChange()">
    5347</body>
    5448</html>
  • trunk/LayoutTests/fast/speech/input-text-language-tag.html

    r70863 r72591  
    3939function run() {
    4040    if (window.layoutTestController && window.eventSender) {
    41         layoutTestController.setMockSpeechInputResult('Pictures of the moon', 'en-GB');
    42         layoutTestController.setMockSpeechInputResult('月の写真', 'ja');
     41        layoutTestController.addMockSpeechInputResult('Pictures of the moon', 1.0, 'en-GB');
     42        layoutTestController.addMockSpeechInputResult('月の写真', 1.0, 'ja');
    4343        speechButtonClick('speechInputNone');
    4444    }
  • trunk/LayoutTests/fast/speech/input-text-speechbutton.html

    r70863 r72591  
    3333function run() {
    3434    if (window.layoutTestController && window.eventSender) {
    35         layoutTestController.setMockSpeechInputResult('Pictures of the moon', '');
     35        layoutTestController.addMockSpeechInputResult('Pictures of the moon', 1.0, '');
    3636
    3737        // Clicking the speech button should fill in mock speech-recognized text.
  • trunk/LayoutTests/fast/speech/speech-button-ignore-generated-events.html

    r70863 r72591  
    5050    if (window.layoutTestController && window.eventSender) {
    5151        // Running in DRT, test the eventSender case.
    52         layoutTestController.setMockSpeechInputResult('Pictures of the moon', '');
     52        layoutTestController.addMockSpeechInputResult('Pictures of the moon', 1.0, '');
    5353        document.getElementById('speechInput').onwebkitspeechchange = function() {
    5454            shouldBeEqualToString('document.getElementById("speechInput").value', 'Pictures of the moon');
  • trunk/LayoutTests/platform/chromium/test_expectations.txt

    r72565 r72591  
    32093209BUGWK4989 WIN LINUX : fast/css/font-face-data-uri.html = TEXT
    32103210
     3211// Remove these once the Chromium side has caught on with multiple speech input results.
     3212BUG49736 : fast/speech/input-onspeechchange-event.html = TEXT
     3213BUG49736 : fast/speech/input-text-language-tag.html = TEXT
     3214BUG49736 : fast/speech/input-text-speechbutton.html = TEXT
     3215BUG49736 : fast/speech/speech-button-ignore-generated-events.html = TEXT
  • trunk/WebCore/CMakeLists.txt

    r72590 r72591  
    331331    page/PositionError.idl
    332332    page/Screen.idl
     333    page/SpeechInputEvent.idl
     334    page/SpeechInputResult.idl
     335    page/SpeechInputResultList.idl
    333336    page/WebKitPoint.idl
    334337    page/WorkerNavigator.idl
  • trunk/WebCore/ChangeLog

    r72590 r72591  
     12010-11-18  Satish Sampath  <satish@chromium.org>
     2
     3        Reviewed by Jeremy Orlow.
     4
     5        For speech input event, send an event object containing all the recognition results and metadata.
     6        https://bugs.webkit.org/show_bug.cgi?id=49736
     7
     8        Currently the speech input event 'onwebkitspeechchange' receives no parameters. WebCore already
     9        has the full list of recognition results and populates only the top result into the input field
     10        automatically. In this patch we pass a SpeechInputEvent object to the event handler, and the JS
     11        code can access the full list of results via "event.results.length", "results[i].utterance" and
     12        "results[i].confidence". Also updated mock object with appropriate methods to test multiple results.
     13
     14        Test: fast/speech/input-onspeechchange-event.html
     15
     16        * CMakeLists.txt:
     17        * GNUmakefile.am:
     18        * WebCore.gypi:
     19        * WebCore.pri:
     20        * WebCore.pro:
     21        * WebCore.xcodeproj/project.pbxproj:
     22        * bindings/js/JSEventCustom.cpp:
     23        (WebCore::toJS): Added new event
     24        * bindings/v8/custom/V8EventCustom.cpp:
     25        (WebCore::toV8): Added new event
     26        * dom/Event.cpp:
     27        (WebCore::Event::isSpeechInputEvent):
     28        * dom/Event.h:
     29        * html/HTMLInputElement.cpp:
     30        * html/HTMLInputElement.h:
     31        * page/SpeechInputEvent.h: New file implementing SpeechInputEvent.idl
     32        (WebCore::SpeechInputEvent::~SpeechInputEvent):
     33        (WebCore::SpeechInputEvent::create):
     34        (WebCore::SpeechInputEvent::isSpeechInputEvent):
     35        (WebCore::SpeechInputEvent::results):
     36        (WebCore::SpeechInputEvent::SpeechInputEvent):
     37        * page/SpeechInputEvent.idl: New file defining SpeechInputEvent object
     38        * page/SpeechInputListener.h:
     39        * page/SpeechInputResult.cpp:
     40        (WebCore::SpeechInputResult::create):
     41        * page/SpeechInputResult.h:
     42        * page/SpeechInputResult.idl: New file defining a single SpeechInputResult object
     43        * page/SpeechInputResultList.h: New file implementing SpeechInputResultList.idl
     44        (WebCore::SpeechInputResultList::create):
     45        (WebCore::SpeechInputResultList::length):
     46        (WebCore::SpeechInputResultList::item):
     47        (WebCore::SpeechInputResultList::SpeechInputResultList):
     48        * page/SpeechInputResultList.idl: New file defining a list of SpeechInputResult objects
     49        * platform/mock/SpeechInputClientMock.cpp:
     50        (WebCore::SpeechInputClientMock::addRecognitionResult): Renamed method and added one parameter.
     51        (WebCore::SpeechInputClientMock::clearResults):
     52        (WebCore::SpeechInputClientMock::timerFired):
     53        * platform/mock/SpeechInputClientMock.h:
     54        * rendering/TextControlInnerElements.cpp:
     55        (WebCore::InputFieldSpeechButtonElement::setRecognitionResult): Pass new event object to handler.
     56
    1572010-11-22  Alexey Proskuryakov  <ap@apple.com>
    258
  • trunk/WebCore/DerivedSources.make

    r72552 r72591  
    305305    ScriptProfile \
    306306    ScriptProfileNode \
     307    SpeechInputEvent \
     308    SpeechInputResult \
     309    SpeechInputResultList \
    307310    SQLError \
    308311    SQLException \
  • trunk/WebCore/GNUmakefile.am

    r72590 r72591  
    498498        DerivedSources/WebCore/JSSharedWorker.cpp \
    499499        DerivedSources/WebCore/JSSharedWorker.h \
     500        DerivedSources/WebCore/JSSpeechInputEvent.cpp \
     501        DerivedSources/WebCore/JSSpeechInputEvent.h \
     502        DerivedSources/WebCore/JSSpeechInputResult.cpp \
     503        DerivedSources/WebCore/JSSpeechInputResult.h \
     504        DerivedSources/WebCore/JSSpeechInputResultList.cpp \
     505        DerivedSources/WebCore/JSSpeechInputResultList.h \
    500506        DerivedSources/WebCore/JSStyleMedia.cpp \
    501507        DerivedSources/WebCore/JSStyleMedia.h \
     
    21722178        WebCore/page/SpatialNavigation.h \
    21732179        WebCore/page/SpeechInputClient.h \
     2180        WebCore/page/SpeechInputEvent.cpp \
     2181        WebCore/page/SpeechInputEvent.h \
    21742182        WebCore/page/SpeechInput.cpp \
    21752183        WebCore/page/SpeechInput.h \
     
    21772185        WebCore/page/SpeechInputResult.cpp \
    21782186        WebCore/page/SpeechInputResult.h \
     2187        WebCore/page/SpeechInputResultList.cpp \
     2188        WebCore/page/SpeechInputResultList.h \
    21792189        WebCore/page/SuspendableTimer.cpp \
    21802190        WebCore/page/SuspendableTimer.h \
  • trunk/WebCore/WebCore.gypi

    r72590 r72591  
    252252            'page/PositionError.idl',
    253253            'page/Screen.idl',
     254            'page/SpeechInputEvent.idl',
     255            'page/SpeechInputResult.idl',
     256            'page/SpeechInputResultList.idl',
    254257            'page/WebKitPoint.idl',
    255258            'page/WorkerNavigator.idl',
     
    23042307            'page/SpeechInput.h',
    23052308            'page/SpeechInputClient.h',
     2309            'page/SpeechInputEvent.cpp',
     2310            'page/SpeechInputEvent.h',
    23062311            'page/SpeechInputListener.h',
    23072312            'page/SpeechInputResult.cpp',
    23082313            'page/SpeechInputResult.h',
     2314            'page/SpeechInputResultList.cpp',
     2315            'page/SpeechInputResultList.h',
    23092316            'page/SuspendableTimer.cpp',
    23102317            'page/SuspendableTimer.h',
  • trunk/WebCore/WebCore.pri

    r72552 r72591  
    313313    page/PositionError.idl \
    314314    page/Screen.idl \
     315    page/SpeechInputEvent.idl \
     316    page/SpeechInputResult.idl \
     317    page/SpeechInputResultList.idl \
    315318    page/WebKitPoint.idl \
    316319    page/WorkerNavigator.idl \
  • trunk/WebCore/WebCore.pro

    r72590 r72591  
    20262026    page/SpeechInput.h \
    20272027    page/SpeechInputClient.h \
     2028    page/SpeechInputEvent.h \
    20282029    page/SpeechInputListener.h \
    20292030    page/SpeechInputResult.h \
     2031    page/SpeechInputResultList.h \
    20302032    page/WindowFeatures.h \
    20312033    page/WorkerNavigator.h \
     
    31503152    SOURCES += \
    31513153        page/SpeechInput.cpp \
     3154        page/SpeechInputEvent.cpp \
    31523155        page/SpeechInputResult.cpp \
     3156        page/SpeechInputResultList.cpp \
    31533157        rendering/RenderInputSpeech.cpp
    31543158}
  • trunk/WebCore/WebCore.xcodeproj/project.pbxproj

    r72590 r72591  
    15131513                754133A8102E00E800075D00 /* InspectorTimelineAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = 754133A7102E00E800075D00 /* InspectorTimelineAgent.h */; };
    15141514                754133AA102E00F400075D00 /* InspectorTimelineAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 754133A9102E00F400075D00 /* InspectorTimelineAgent.cpp */; };
     1515                75415AFD12958D5E003AD669 /* SpeechInputEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 75415AF812958D5E003AD669 /* SpeechInputEvent.h */; };
     1516                75415B0012958D5E003AD669 /* SpeechInputResultList.h in Headers */ = {isa = PBXBuildFile; fileRef = 75415AFB12958D5E003AD669 /* SpeechInputResultList.h */; };
     1517                75415C28129A9920003AD669 /* SpeechInputEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 75415C26129A9920003AD669 /* SpeechInputEvent.cpp */; };
     1518                75415C29129A9920003AD669 /* SpeechInputResultList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 75415C27129A9920003AD669 /* SpeechInputResultList.cpp */; };
     1519                75415D55129AB2D2003AD669 /* JSSpeechInputEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 75415D4F129AB2D2003AD669 /* JSSpeechInputEvent.cpp */; };
     1520                75415D56129AB2D2003AD669 /* JSSpeechInputEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 75415D50129AB2D2003AD669 /* JSSpeechInputEvent.h */; };
     1521                75415D57129AB2D2003AD669 /* JSSpeechInputResult.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 75415D51129AB2D2003AD669 /* JSSpeechInputResult.cpp */; };
     1522                75415D58129AB2D2003AD669 /* JSSpeechInputResult.h in Headers */ = {isa = PBXBuildFile; fileRef = 75415D52129AB2D2003AD669 /* JSSpeechInputResult.h */; };
     1523                75415D59129AB2D2003AD669 /* JSSpeechInputResultList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 75415D53129AB2D2003AD669 /* JSSpeechInputResultList.cpp */; };
     1524                75415D5A129AB2D2003AD669 /* JSSpeechInputResultList.h in Headers */ = {isa = PBXBuildFile; fileRef = 75415D54129AB2D2003AD669 /* JSSpeechInputResultList.h */; };
    15151525                7553CFE8108F473F00EA281E /* TimelineRecordFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = 7553CFE6108F473F00EA281E /* TimelineRecordFactory.h */; };
    15161526                7553CFE9108F473F00EA281E /* TimelineRecordFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7553CFE7108F473F00EA281E /* TimelineRecordFactory.cpp */; };
     
    76717681                754133A7102E00E800075D00 /* InspectorTimelineAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorTimelineAgent.h; sourceTree = "<group>"; };
    76727682                754133A9102E00F400075D00 /* InspectorTimelineAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorTimelineAgent.cpp; sourceTree = "<group>"; };
     7683                75415AF812958D5E003AD669 /* SpeechInputEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SpeechInputEvent.h; sourceTree = "<group>"; };
     7684                75415AF912958D5E003AD669 /* SpeechInputEvent.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = SpeechInputEvent.idl; sourceTree = "<group>"; };
     7685                75415AFA12958D5E003AD669 /* SpeechInputResult.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = SpeechInputResult.idl; sourceTree = "<group>"; };
     7686                75415AFB12958D5E003AD669 /* SpeechInputResultList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SpeechInputResultList.h; sourceTree = "<group>"; };
     7687                75415AFC12958D5E003AD669 /* SpeechInputResultList.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = SpeechInputResultList.idl; sourceTree = "<group>"; };
     7688                75415C26129A9920003AD669 /* SpeechInputEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SpeechInputEvent.cpp; sourceTree = "<group>"; };
     7689                75415C27129A9920003AD669 /* SpeechInputResultList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SpeechInputResultList.cpp; sourceTree = "<group>"; };
     7690                75415D4F129AB2D2003AD669 /* JSSpeechInputEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSpeechInputEvent.cpp; sourceTree = "<group>"; };
     7691                75415D50129AB2D2003AD669 /* JSSpeechInputEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSSpeechInputEvent.h; sourceTree = "<group>"; };
     7692                75415D51129AB2D2003AD669 /* JSSpeechInputResult.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSpeechInputResult.cpp; sourceTree = "<group>"; };
     7693                75415D52129AB2D2003AD669 /* JSSpeechInputResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSSpeechInputResult.h; sourceTree = "<group>"; };
     7694                75415D53129AB2D2003AD669 /* JSSpeechInputResultList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSpeechInputResultList.cpp; sourceTree = "<group>"; };
     7695                75415D54129AB2D2003AD669 /* JSSpeechInputResultList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSSpeechInputResultList.h; sourceTree = "<group>"; };
    76737696                7553CFE6108F473F00EA281E /* TimelineRecordFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TimelineRecordFactory.h; sourceTree = "<group>"; };
    76747697                7553CFE7108F473F00EA281E /* TimelineRecordFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TimelineRecordFactory.cpp; sourceTree = "<group>"; };
     
    1334113364                                7578F90911DDF26900D933C5 /* SpeechInput.h */,
    1334213365                                7578F90A11DDF26900D933C5 /* SpeechInputClient.h */,
     13366                                75415C26129A9920003AD669 /* SpeechInputEvent.cpp */,
     13367                                75415AF812958D5E003AD669 /* SpeechInputEvent.h */,
     13368                                75415AF912958D5E003AD669 /* SpeechInputEvent.idl */,
    1334313369                                7578F91E11E4E32800D933C5 /* SpeechInputListener.h */,
    1334413370                                758978EA127090D60076D5A9 /* SpeechInputResult.cpp */,
    1334513371                                758978EB127090D60076D5A9 /* SpeechInputResult.h */,
     13372                                75415AFA12958D5E003AD669 /* SpeechInputResult.idl */,
     13373                                75415C27129A9920003AD669 /* SpeechInputResultList.cpp */,
     13374                                75415AFB12958D5E003AD669 /* SpeechInputResultList.h */,
     13375                                75415AFC12958D5E003AD669 /* SpeechInputResultList.idl */,
    1334613376                                62C1217A11AB9E76003C462C /* SuspendableTimer.cpp */,
    1334713377                                62C1217B11AB9E77003C462C /* SuspendableTimer.h */,
     
    1589515925                                E4B423850CBFB73C00AF2ECE /* JSProgressEvent.cpp */,
    1589615926                                E4B423860CBFB73C00AF2ECE /* JSProgressEvent.h */,
     15927                                75415D4F129AB2D2003AD669 /* JSSpeechInputEvent.cpp */,
     15928                                75415D50129AB2D2003AD669 /* JSSpeechInputEvent.h */,
     15929                                75415D51129AB2D2003AD669 /* JSSpeechInputResult.cpp */,
     15930                                75415D52129AB2D2003AD669 /* JSSpeechInputResult.h */,
     15931                                75415D53129AB2D2003AD669 /* JSSpeechInputResultList.cpp */,
     15932                                75415D54129AB2D2003AD669 /* JSSpeechInputResultList.h */,
    1589715933                                65DF31EF09D1CC60000BE325 /* JSText.cpp */,
    1589815934                                65DF31F009D1CC60000BE325 /* JSText.h */,
     
    2135221388                                D3A94A47122DC40F00A37BBC /* JSMediaQueryList.h in Headers */,
    2135321389                                D3AA10F4123A98AA0092152B /* MediaQueryMatcher.h in Headers */,
     21390                                75415AFD12958D5E003AD669 /* SpeechInputEvent.h in Headers */,
     21391                                75415B0012958D5E003AD669 /* SpeechInputResultList.h in Headers */,
     21392                                75415D56129AB2D2003AD669 /* JSSpeechInputEvent.h in Headers */,
     21393                                75415D58129AB2D2003AD669 /* JSSpeechInputResult.h in Headers */,
     21394                                75415D5A129AB2D2003AD669 /* JSSpeechInputResultList.h in Headers */,
    2135421395                        );
    2135521396                        runOnlyForDeploymentPostprocessing = 0;
     
    2392123962                                D3AA10F3123A98AA0092152B /* MediaQueryMatcher.cpp in Sources */,
    2392223963                                D340629B1253BC8C009E4259 /* MediaQueryListListener.cpp in Sources */,
     23964                                75415C28129A9920003AD669 /* SpeechInputEvent.cpp in Sources */,
     23965                                75415C29129A9920003AD669 /* SpeechInputResultList.cpp in Sources */,
     23966                                75415D55129AB2D2003AD669 /* JSSpeechInputEvent.cpp in Sources */,
     23967                                75415D57129AB2D2003AD669 /* JSSpeechInputResult.cpp in Sources */,
     23968                                75415D59129AB2D2003AD669 /* JSSpeechInputResultList.cpp in Sources */,
    2392323969                        );
    2392423970                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/WebCore/bindings/js/JSEventCustom.cpp

    r72048 r72591  
    5252#include "JSPopStateEvent.h"
    5353#include "JSProgressEvent.h"
     54#include "JSSpeechInputEvent.h"
    5455#include "JSTextEvent.h"
    5556#include "JSUIEvent.h"
     
    6970#include "PopStateEvent.h"
    7071#include "ProgressEvent.h"
     72#include "SpeechInputEvent.h"
    7173#include "TextEvent.h"
    7274#include "UIEvent.h"
     
    194196        wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, AudioProcessingEvent, event);
    195197#endif
     198#if ENABLE(INPUT_SPEECH)
     199    else if (event->isSpeechInputEvent())
     200        wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, SpeechInputEvent, event);
     201#endif
    196202    else
    197203        wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, Event, event);
  • trunk/WebCore/bindings/v8/custom/V8EventCustom.cpp

    r72048 r72591  
    5656#include "V8ProgressEvent.h"
    5757#include "V8Proxy.h"
     58#include "V8SpeechInputEvent.h"
    5859#include "V8StorageEvent.h"
    5960#include "V8TextEvent.h"
     
    173174        return toV8(static_cast<AudioProcessingEvent*>(impl));
    174175#endif
     176#if ENABLE(INPUT_SPEECH)
     177    if (impl->isSpeechInputEvent())
     178        return toV8(static_cast<SpeechInputEvent*>(impl));
     179#endif
    175180    if (impl->isCustomEvent())
    176181        return toV8(static_cast<CustomEvent*>(impl));
  • trunk/WebCore/dom/Event.cpp

    r72048 r72591  
    237237#endif
    238238
     239#if ENABLE(INPUT_SPEECH)
     240bool Event::isSpeechInputEvent() const
     241{
     242    return false;
     243}
     244#endif
     245
    239246bool Event::fromUserGesture()
    240247{
  • trunk/WebCore/dom/Event.h

    r72048 r72591  
    143143        virtual bool isDeviceOrientationEvent() const;
    144144#endif
     145#if ENABLE(INPUT_SPEECH)
     146        virtual bool isSpeechInputEvent() const;
     147#endif
    145148        bool fromUserGesture();
    146149       
  • trunk/WebCore/html/HTMLInputElement.cpp

    r72377 r72591  
    19381938}
    19391939
    1940 void HTMLInputElement::dispatchWebkitSpeechChangeEvent()
    1941 {
    1942     ASSERT(isSpeechEnabled());
    1943     dispatchEvent(Event::create(eventNames().webkitspeechchangeEvent, true, false));
    1944 }
    19451940#endif
    19461941
  • trunk/WebCore/html/HTMLInputElement.h

    r72363 r72591  
    109109#if ENABLE(INPUT_SPEECH)
    110110    virtual bool isSpeechEnabled() const;
    111     void dispatchWebkitSpeechChangeEvent();
    112111#endif
    113112
  • trunk/WebCore/page/SpeechInputEvent.cpp

    r72590 r72591  
    2929 */
    3030
    31 #ifndef WebSpeechInputControllerMock_h
    32 #define WebSpeechInputControllerMock_h
     31#include "config.h"
     32#include "SpeechInputEvent.h"
    3333
    34 #include "WebSpeechInputController.h"
     34#if ENABLE(INPUT_SPEECH)
    3535
    36 namespace WebKit {
     36namespace WebCore {
    3737
    38 class WebString;
    39 class WebSpeechInputListener;
     38PassRefPtr<SpeechInputEvent> SpeechInputEvent::create(const AtomicString& eventType, const SpeechInputResultArray& results)
     39{
     40    return adoptRef(new SpeechInputEvent(eventType, results));
     41}
    4042
    41 class WebSpeechInputControllerMock : public WebSpeechInputController {
    42 public:
    43     WEBKIT_API static WebSpeechInputControllerMock* create(
    44         WebSpeechInputListener* listener);
    45     virtual ~WebSpeechInputControllerMock() { }
     43SpeechInputEvent::~SpeechInputEvent() {
     44}
    4645
    47     virtual void setMockRecognitionResult(const WebString& result, const WebString& language) = 0;
     46SpeechInputEvent::SpeechInputEvent(const AtomicString& eventType, const SpeechInputResultArray& results)
     47    : Event(eventType, true, false) // Can bubble, not cancelable
     48    , m_results(SpeechInputResultList::create(results))
     49{
     50}
    4851
    49     virtual void clearResults() = 0;
    50 };
     52} // namespace WebCore
    5153
    52 } // namespace WebKit
    53 
    54 #endif
     54#endif // ENABLE(INPUT_SPEECH)
  • trunk/WebCore/page/SpeechInputEvent.h

    r72590 r72591  
    2424 */
    2525
    26 #ifndef SpeechInputResult_h
    27 #define SpeechInputResult_h
     26#ifndef SpeechInputEvent_h
     27#define SpeechInputEvent_h
    2828
    2929#if ENABLE(INPUT_SPEECH)
    3030
    31 #include "PlatformString.h"
     31#include "Event.h"
     32#include "SpeechInputResultList.h"
     33
    3234#include <wtf/PassRefPtr.h>
    3335#include <wtf/RefCounted.h>
     36#include <wtf/Vector.h>
    3437
    3538namespace WebCore {
    3639
    37 // This class holds one speech recognition result including the text and other related
    38 // fields, as received from the embedder.
    39 class SpeechInputResult : public RefCounted<SpeechInputResult> {
     40class SpeechInputEvent : public Event {
    4041public:
    41     static PassRefPtr<SpeechInputResult> create(const String& utterance, double confidence);
     42    static PassRefPtr<SpeechInputEvent> create(const AtomicString& eventType, const SpeechInputResultArray& results);
     43    ~SpeechInputEvent();
    4244
    43     double confidence() const;
    44     const String& utterance() const;
     45    virtual bool isSpeechInputEvent() const { return true; }
     46
     47    SpeechInputResultList* results() const { return m_results.get(); }
    4548
    4649private:
    47     SpeechInputResult(const String& utterance, double confidence);
     50    SpeechInputEvent(const AtomicString& eventType, const SpeechInputResultArray& results);
    4851
    49     String m_utterance;
    50     double m_confidence;
     52    RefPtr<SpeechInputResultList> m_results;
    5153};
    5254
     
    5557#endif // ENABLE(INPUT_SPEECH)
    5658
    57 #endif // SpeechInputResult_h
     59#endif // SpeechInputEvent_h
  • trunk/WebCore/page/SpeechInputEvent.idl

    r72590 r72591  
    2424 */
    2525
    26 #include "config.h"
    27 #include "SpeechInputResult.h"
     26module core {
    2827
    29 #if ENABLE(INPUT_SPEECH)
     28    interface [
     29        Conditional=INPUT_SPEECH
     30    ] SpeechInputEvent : Event {
     31        readonly attribute SpeechInputResultList results;
     32    };
    3033
    31 namespace WebCore {
    32 
    33 PassRefPtr<SpeechInputResult> SpeechInputResult::create(const String& utterance, double confidence)
    34 {
    35     return adoptRef(new SpeechInputResult(utterance, confidence));
    3634}
    37 
    38 SpeechInputResult::SpeechInputResult(const String& utterance, double confidence)
    39     : m_utterance(utterance)
    40     , m_confidence(confidence)
    41 {
    42 }
    43 
    44 double SpeechInputResult::confidence() const
    45 {
    46     return m_confidence;
    47 }
    48 
    49 const String& SpeechInputResult::utterance() const
    50 {
    51     return m_utterance;
    52 }
    53 
    54 } // namespace WebCore
    55 
    56 #endif // ENABLE(INPUT_SPEECH)
  • trunk/WebCore/page/SpeechInputListener.h

    r70490 r72591  
    3939namespace WebCore {
    4040
    41 typedef Vector<RefPtr<SpeechInputResult> > SpeechInputResultArray;
    42 
    4341// Interface to be implemented by the element which invokes SpeechInput.
    4442class SpeechInputListener {
  • trunk/WebCore/page/SpeechInputResult.cpp

    r70490 r72591  
    3636}
    3737
     38PassRefPtr<SpeechInputResult> SpeechInputResult::create(const SpeechInputResult& source)
     39{
     40    return adoptRef(new SpeechInputResult(source.m_utterance, source.m_confidence));
     41}
     42
    3843SpeechInputResult::SpeechInputResult(const String& utterance, double confidence)
    3944    : m_utterance(utterance)
  • trunk/WebCore/page/SpeechInputResult.h

    r70490 r72591  
    3939class SpeechInputResult : public RefCounted<SpeechInputResult> {
    4040public:
     41    static PassRefPtr<SpeechInputResult> create(const SpeechInputResult& source);
    4142    static PassRefPtr<SpeechInputResult> create(const String& utterance, double confidence);
    4243
     
    5152};
    5253
     54typedef Vector<RefPtr<SpeechInputResult> > SpeechInputResultArray;
     55
    5356} // namespace WebCore
    5457
  • trunk/WebCore/page/SpeechInputResult.idl

    r72590 r72591  
    2424 */
    2525
    26 #include "config.h"
    27 #include "SpeechInputResult.h"
     26module core {
    2827
    29 #if ENABLE(INPUT_SPEECH)
     28    interface [
     29        Conditional=INPUT_SPEECH
     30    ] SpeechInputResult {
     31        readonly attribute DOMString utterance;
     32        readonly attribute float confidence;
     33    };
    3034
    31 namespace WebCore {
    32 
    33 PassRefPtr<SpeechInputResult> SpeechInputResult::create(const String& utterance, double confidence)
    34 {
    35     return adoptRef(new SpeechInputResult(utterance, confidence));
    3635}
    37 
    38 SpeechInputResult::SpeechInputResult(const String& utterance, double confidence)
    39     : m_utterance(utterance)
    40     , m_confidence(confidence)
    41 {
    42 }
    43 
    44 double SpeechInputResult::confidence() const
    45 {
    46     return m_confidence;
    47 }
    48 
    49 const String& SpeechInputResult::utterance() const
    50 {
    51     return m_utterance;
    52 }
    53 
    54 } // namespace WebCore
    55 
    56 #endif // ENABLE(INPUT_SPEECH)
  • trunk/WebCore/page/SpeechInputResultList.cpp

    r72590 r72591  
    2929 */
    3030
    31 #ifndef WebSpeechInputControllerMock_h
    32 #define WebSpeechInputControllerMock_h
     31#include "config.h"
     32#include "SpeechInputResultList.h"
    3333
    34 #include "WebSpeechInputController.h"
     34#if ENABLE(INPUT_SPEECH)
    3535
    36 namespace WebKit {
     36namespace WebCore {
    3737
    38 class WebString;
    39 class WebSpeechInputListener;
     38PassRefPtr<SpeechInputResultList> SpeechInputResultList::create(const SpeechInputResultArray& results)
     39{
     40    return adoptRef(new SpeechInputResultList(results));
     41}
    4042
    41 class WebSpeechInputControllerMock : public WebSpeechInputController {
    42 public:
    43     WEBKIT_API static WebSpeechInputControllerMock* create(
    44         WebSpeechInputListener* listener);
    45     virtual ~WebSpeechInputControllerMock() { }
     43SpeechInputResult* SpeechInputResultList::item(unsigned index)
     44{
     45    return index >= m_results.size() ? 0 : m_results[index].get();
     46}
    4647
    47     virtual void setMockRecognitionResult(const WebString& result, const WebString& language) = 0;
     48SpeechInputResultList::SpeechInputResultList(const SpeechInputResultArray& results)
     49    : m_results(results) // Takes a copy of the array of RefPtrs.
     50{
     51}
    4852
    49     virtual void clearResults() = 0;
    50 };
     53} // namespace WebCore
    5154
    52 } // namespace WebKit
    53 
    54 #endif
     55#endif // ENABLE(INPUT_SPEECH)
  • trunk/WebCore/page/SpeechInputResultList.h

    r72590 r72591  
    2424 */
    2525
    26 #ifndef SpeechInputResult_h
    27 #define SpeechInputResult_h
     26#ifndef SpeechInputResultList_h
     27#define SpeechInputResultList_h
    2828
    2929#if ENABLE(INPUT_SPEECH)
    3030
    31 #include "PlatformString.h"
     31#include "SpeechInputResult.h"
     32
    3233#include <wtf/PassRefPtr.h>
    3334#include <wtf/RefCounted.h>
     35#include <wtf/Vector.h>
    3436
    3537namespace WebCore {
    3638
    37 // This class holds one speech recognition result including the text and other related
    38 // fields, as received from the embedder.
    39 class SpeechInputResult : public RefCounted<SpeechInputResult> {
     39class SpeechInputResultList : public RefCounted<SpeechInputResultList> {
    4040public:
    41     static PassRefPtr<SpeechInputResult> create(const String& utterance, double confidence);
     41    static PassRefPtr<SpeechInputResultList> create(const SpeechInputResultArray& results);
    4242
    43     double confidence() const;
    44     const String& utterance() const;
     43    // Methods from the IDL.
     44    size_t length() { return m_results.size(); }
     45    SpeechInputResult* item(unsigned index);
    4546
    4647private:
    47     SpeechInputResult(const String& utterance, double confidence);
     48    SpeechInputResultList(const SpeechInputResultArray& results);
    4849
    49     String m_utterance;
    50     double m_confidence;
     50    SpeechInputResultArray m_results;
    5151};
    5252
     
    5555#endif // ENABLE(INPUT_SPEECH)
    5656
    57 #endif // SpeechInputResult_h
     57#endif // SpeechInputResultList_h
  • trunk/WebCore/page/SpeechInputResultList.idl

    r72590 r72591  
    2424 */
    2525
    26 #include "config.h"
    27 #include "SpeechInputResult.h"
     26module core {
    2827
    29 #if ENABLE(INPUT_SPEECH)
     28    interface [
     29        HasIndexGetter,
     30        Conditional=INPUT_SPEECH
     31    ] SpeechInputResultList {
     32        readonly attribute unsigned long length;
     33        SpeechInputResult item(in [IsIndex] unsigned long index);
     34    };
    3035
    31 namespace WebCore {
    32 
    33 PassRefPtr<SpeechInputResult> SpeechInputResult::create(const String& utterance, double confidence)
    34 {
    35     return adoptRef(new SpeechInputResult(utterance, confidence));
    3636}
    37 
    38 SpeechInputResult::SpeechInputResult(const String& utterance, double confidence)
    39     : m_utterance(utterance)
    40     , m_confidence(confidence)
    41 {
    42 }
    43 
    44 double SpeechInputResult::confidence() const
    45 {
    46     return m_confidence;
    47 }
    48 
    49 const String& SpeechInputResult::utterance() const
    50 {
    51     return m_utterance;
    52 }
    53 
    54 } // namespace WebCore
    55 
    56 #endif // ENABLE(INPUT_SPEECH)
  • trunk/WebCore/platform/mock/SpeechInputClientMock.cpp

    r72206 r72591  
    8282}
    8383
    84 void SpeechInputClientMock::setRecognitionResult(const String& result, const AtomicString& language)
     84void SpeechInputClientMock::addRecognitionResult(const String& result, double confidence, const AtomicString& language)
    8585{
    8686    if (language.isEmpty())
    87         m_resultForEmptyLanguage = result;
    88     else
    89         m_recognitionResult.set(language, result);
     87        m_resultsForEmptyLanguage.append(SpeechInputResult::create(result, confidence));
     88    else {
     89        if (!m_recognitionResults.contains(language))
     90            m_recognitionResults.set(language, SpeechInputResultArray());
     91        m_recognitionResults.find(language)->second.append(SpeechInputResult::create(result, confidence));
     92    }
    9093}
    9194
    9295void SpeechInputClientMock::clearResults()
    9396{
    94     m_resultForEmptyLanguage = String();
    95     m_recognitionResult.clear();
     97    m_resultsForEmptyLanguage.clear();
     98    m_recognitionResults.clear();
    9699}
    97100
     
    103106        m_timer.startOneShot(0);
    104107    } else {
    105         SpeechInputResultArray results;
    106108        bool noResultsFound = false;
    107109
    108110        // Empty language case must be handled separately to avoid problems with HashMap and empty keys.
    109111        if (m_language.isEmpty()) {
    110             if (!m_resultForEmptyLanguage.isNull())
    111                 results.append(SpeechInputResult::create(m_resultForEmptyLanguage, 1.0));
     112            if (!m_resultsForEmptyLanguage.isEmpty())
     113                m_listener->setRecognitionResult(m_requestId, m_resultsForEmptyLanguage);
    112114            else
    113115                noResultsFound = true;
    114116        } else {
    115             if (m_recognitionResult.contains(m_language))
    116                 results.append(SpeechInputResult::create(m_recognitionResult.get(m_language), 1.0));
     117            if (m_recognitionResults.contains(m_language))
     118                m_listener->setRecognitionResult(m_requestId, m_recognitionResults.get(m_language));
    117119            else
    118120                noResultsFound = true;
     
    125127            error.append(m_language);
    126128            error.append("'");
     129            SpeechInputResultArray results;
    127130            results.append(SpeechInputResult::create(error, 1.0));
     131            m_listener->setRecognitionResult(m_requestId, results);
    128132        }
    129133
    130         m_listener->setRecognitionResult(m_requestId, results);
    131134        m_listener->didCompleteRecognition(m_requestId);
    132135        m_requestId = 0;
  • trunk/WebCore/platform/mock/SpeechInputClientMock.h

    r72206 r72591  
    3434#include "PlatformString.h"
    3535#include "SpeechInputClient.h"
     36#include "SpeechInputResult.h"
    3637#include "Timer.h"
    3738#include <wtf/HashMap.h>
     
    4950    SpeechInputClientMock();
    5051
    51     void setRecognitionResult(const String& result, const AtomicString& language);
     52    void addRecognitionResult(const String& result, double confidence, const AtomicString& language);
    5253    void clearResults();
    5354
     
    6667    int m_requestId;
    6768
    68     HashMap<String, String> m_recognitionResult;
     69    HashMap<String, SpeechInputResultArray> m_recognitionResults;
    6970    AtomicString m_language;
    70     String m_resultForEmptyLanguage;
     71    SpeechInputResultArray m_resultsForEmptyLanguage;
    7172};
    7273
  • trunk/WebCore/rendering/TextControlInnerElements.cpp

    r72052 r72591  
    4242#include "ScrollbarTheme.h"
    4343#include "SpeechInput.h"
     44#include "SpeechInputEvent.h"
    4445
    4546namespace WebCore {
     
    479480    RefPtr<HTMLInputElement> holdRef(input);
    480481    input->setValue(results.isEmpty() ? "" : results[0]->utterance());
    481     input->dispatchWebkitSpeechChangeEvent();
     482    input->dispatchEvent(SpeechInputEvent::create(eventNames().webkitspeechchangeEvent, results));
    482483    renderer()->repaint();
    483484}
  • trunk/WebKit/chromium/ChangeLog

    r72587 r72591  
     12010-11-18  Satish Sampath  <satish@chromium.org>
     2
     3        Reviewed by Jeremy Orlow.
     4
     5        For speech input event, send an event object containing all the recognition results and metadata.
     6        https://bugs.webkit.org/show_bug.cgi?id=49736
     7
     8        Updated mock object's method to new signature.
     9
     10        * public/WebSpeechInputControllerMock.h:
     11        * src/WebSpeechInputControllerMockImpl.cpp:
     12        (WebKit::WebSpeechInputControllerMockImpl::addMockRecognitionResult):
     13        * src/WebSpeechInputControllerMockImpl.h:
     14
    1152010-11-22  Alexey Marinichev  <amarinichev@chromium.org>
    216
  • trunk/WebKit/chromium/public/WebSpeechInputControllerMock.h

    r72206 r72591  
    4545    virtual ~WebSpeechInputControllerMock() { }
    4646
    47     virtual void setMockRecognitionResult(const WebString& result, const WebString& language) = 0;
     47    virtual void addMockRecognitionResult(const WebString& result, double confidence, const WebString& language) = 0;
    4848
    4949    virtual void clearResults() = 0;
  • trunk/WebKit/chromium/src/WebSpeechInputControllerMockImpl.cpp

    r72206 r72591  
    5656}
    5757
    58 void WebSpeechInputControllerMockImpl::setMockRecognitionResult(const WebString& result, const WebString &language)
     58void WebSpeechInputControllerMockImpl::addMockRecognitionResult(const WebString& result, double confidence, const WebString &language)
    5959{
    60     m_webcoreMock->setRecognitionResult(result, language);
     60    m_webcoreMock->addRecognitionResult(result, confidence, language);
    6161}
    6262
  • trunk/WebKit/chromium/src/WebSpeechInputControllerMockImpl.h

    r72206 r72591  
    6363
    6464    // WebSpeechInputControllerMock methods.
    65     void setMockRecognitionResult(const WebString& result, const WebString& language);
     65    void addMockRecognitionResult(const WebString& result, double confidence, const WebString& language);
    6666    void clearResults();
    6767
  • trunk/WebKitTools/ChangeLog

    r72576 r72591  
     12010-11-18  Satish Sampath  <satish@chromium.org>
     2
     3        Reviewed by Jeremy Orlow.
     4
     5        For speech input event, send an event object containing all the recognition results and metadata.
     6        https://bugs.webkit.org/show_bug.cgi?id=49736
     7
     8        Updated DRT by renaming the mock result method on all platforms to the new signature.
     9
     10        * DumpRenderTree/LayoutTestController.cpp:
     11        (addMockSpeechInputResultCallback):
     12        (LayoutTestController::staticFunctions):
     13        * DumpRenderTree/LayoutTestController.h:
     14        * DumpRenderTree/chromium/LayoutTestController.cpp:
     15        (LayoutTestController::LayoutTestController):
     16        (LayoutTestController::addMockSpeechInputResult):
     17        * DumpRenderTree/chromium/LayoutTestController.h:
     18        * DumpRenderTree/gtk/LayoutTestControllerGtk.cpp:
     19        (LayoutTestController::addMockSpeechInputResult):
     20        * DumpRenderTree/mac/LayoutTestControllerMac.mm:
     21        (LayoutTestController::addMockSpeechInputResult):
     22        * DumpRenderTree/qt/LayoutTestControllerQt.cpp:
     23        (LayoutTestController::addMockSpeechInputResult):
     24        * DumpRenderTree/qt/LayoutTestControllerQt.h:
     25        * DumpRenderTree/win/LayoutTestControllerWin.cpp:
     26        (LayoutTestController::addMockSpeechInputResult):
     27        * DumpRenderTree/wx/LayoutTestControllerWx.cpp:
     28        (LayoutTestController::addMockSpeechInputResult):
     29
    1302010-11-22  Dirk Pranke  <dpranke@chromium.org>
    231
  • trunk/WebKitTools/DumpRenderTree/LayoutTestController.cpp

    r72441 r72591  
    10771077}
    10781078
    1079 static JSValueRef setMockSpeechInputResultCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
    1080 {
    1081     if (argumentCount < 2)
     1079static JSValueRef addMockSpeechInputResultCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
     1080{
     1081    if (argumentCount < 3)
    10821082        return JSValueMakeUndefined(context);
    10831083
     
    10851085    ASSERT(!*exception);
    10861086
    1087     JSRetainPtr<JSStringRef> language(Adopt, JSValueToStringCopy(context, arguments[1], exception));
    1088     ASSERT(!*exception);
    1089 
    1090     LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
    1091     controller->setMockSpeechInputResult(result.get(), language.get());
     1087    double confidence = JSValueToNumber(context, arguments[1], exception);
     1088
     1089    JSRetainPtr<JSStringRef> language(Adopt, JSValueToStringCopy(context, arguments[2], exception));
     1090    ASSERT(!*exception);
     1091
     1092    LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
     1093    controller->addMockSpeechInputResult(result.get(), confidence, language.get());
    10921094
    10931095    return JSValueMakeUndefined(context);
     
    19741976        { "setMockGeolocationError", setMockGeolocationErrorCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    19751977        { "setMockGeolocationPosition", setMockGeolocationPositionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    1976         { "setMockSpeechInputResult", setMockSpeechInputResultCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
     1978        { "addMockSpeechInputResult", addMockSpeechInputResultCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    19771979        { "setNewWindowsCopyBackForwardList", setNewWindowsCopyBackForwardListCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    19781980        { "setPOSIXLocale", setPOSIXLocaleCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
  • trunk/WebKitTools/DumpRenderTree/LayoutTestController.h

    r70863 r72591  
    9595    void setMockGeolocationError(int code, JSStringRef message);
    9696    void setMockGeolocationPosition(double latitude, double longitude, double accuracy);
    97     void setMockSpeechInputResult(JSStringRef result, JSStringRef language);
     97    void addMockSpeechInputResult(JSStringRef result, double confidence, JSStringRef language);
    9898    void setPersistentUserStyleSheetLocation(JSStringRef path);
    9999    void setPluginsEnabled(bool flag);
  • trunk/WebKitTools/DumpRenderTree/chromium/LayoutTestController.cpp

    r72441 r72591  
    151151    bindMethod("setMockGeolocationError", &LayoutTestController::setMockGeolocationError);
    152152    bindMethod("setMockGeolocationPosition", &LayoutTestController::setMockGeolocationPosition);
    153     bindMethod("setMockSpeechInputResult", &LayoutTestController::setMockSpeechInputResult);
     153    bindMethod("addMockSpeechInputResult", &LayoutTestController::addMockSpeechInputResult);
    154154    bindMethod("setPopupBlockingEnabled", &LayoutTestController::setPopupBlockingEnabled);
    155155    bindMethod("setPOSIXLocale", &LayoutTestController::setPOSIXLocale);
     
    15381538}
    15391539
    1540 void LayoutTestController::setMockSpeechInputResult(const CppArgumentList& arguments, CppVariant* result)
    1541 {
    1542     result->setNull();
    1543     if (arguments.size() < 2 || !arguments[0].isString() || !arguments[1].isString())
    1544         return;
    1545 
    1546     m_shell->webViewHost()->speechInputControllerMock()->setMockRecognitionResult(cppVariantToWebString(arguments[0]), cppVariantToWebString(arguments[1]));
     1540void LayoutTestController::addMockSpeechInputResult(const CppArgumentList& arguments, CppVariant* result)
     1541{
     1542    result->setNull();
     1543    if (arguments.size() < 3 || !arguments[0].isString() || !arguments[1].isNumber() || !arguments[2].isString())
     1544        return;
     1545
     1546    m_shell->webViewHost()->speechInputControllerMock()->addMockRecognitionResult(cppVariantToWebString(arguments[0]), arguments[1].toDouble(), cppVariantToWebString(arguments[2]));
    15471547}
    15481548
  • trunk/WebKitTools/DumpRenderTree/chromium/LayoutTestController.h

    r72071 r72591  
    327327
    328328    // Speech input related functions.
    329     void setMockSpeechInputResult(const CppArgumentList&, CppVariant*);
     329    void addMockSpeechInputResult(const CppArgumentList&, CppVariant*);
    330330
    331331    void layerTreeAsText(const CppArgumentList& args, CppVariant* result);
  • trunk/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp

    r71888 r72591  
    501501}
    502502
    503 void LayoutTestController::setMockSpeechInputResult(JSStringRef result, JSStringRef language)
     503void LayoutTestController::addMockSpeechInputResult(JSStringRef result, double confidence, JSStringRef language)
    504504{
    505505    // FIXME: Implement for speech input layout tests.
  • trunk/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm

    r72211 r72591  
    374374}
    375375
    376 void LayoutTestController::setMockSpeechInputResult(JSStringRef result, JSStringRef language)
     376void LayoutTestController::addMockSpeechInputResult(JSStringRef result, double confidence, JSStringRef language)
    377377{
    378378    // FIXME: Implement for speech input layout tests.
  • trunk/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp

    r72101 r72591  
    769769}
    770770
    771 void LayoutTestController::setMockSpeechInputResult(const QString& result, const QString& language)
     771void LayoutTestController::addMockSpeechInputResult(const QString& result, double confidence, const QString& language)
    772772{
    773773    // FIXME: Implement for speech input layout tests.
  • trunk/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h

    r72098 r72591  
    219219    bool geolocationPermission() const { return m_geolocationPermission; }
    220220
    221     void setMockSpeechInputResult(const QString& result, const QString& language);
     221    void addMockSpeechInputResult(const QString& result, double confidence, const QString& language);
    222222
    223223    // Empty stub method to keep parity with object model exposed by global LayoutTestController.
  • trunk/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp

    r72311 r72591  
    412412}
    413413
    414 void LayoutTestController::setMockSpeechInputResult(JSStringRef result, JSStringRef language)
     414void LayoutTestController::addMockSpeechInputResult(JSStringRef result, double confidence, JSStringRef language)
    415415{
    416416    // FIXME: Implement for speech input layout tests.
  • trunk/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp

    r70863 r72591  
    321321}
    322322
    323 void LayoutTestController::setMockSpeechInputResult(JSStringRef result, JSStringRef language)
     323void LayoutTestController::addMockSpeechInputResult(JSStringRef result, double confidence, JSStringRef language)
    324324{
    325325    // FIXME: Implement for speech input layout tests.
Note: See TracChangeset for help on using the changeset viewer.