Changeset 95722 in webkit


Ignore:
Timestamp:
Sep 22, 2011 9:18:50 AM (13 years ago)
Author:
leandrogracia@chromium.org
Message:

Source/WebCore: Fire TextInput events on speech input, but not set/add any inputMethod attribute.
https://bugs.webkit.org/show_bug.cgi?id=60451

Reviewed by Ryosuke Niwa.

Introduce code to dispatch TextInput events when text is introduced via
the speech input feature. Handle also the cases where speech input is
started programmatically from the LayoutTestController.

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

  • dom/TextEventInputType.h:
  • html/shadow/TextControlInnerElements.cpp:

(WebCore::InputFieldSpeechButtonElement::setRecognitionResult):

LayoutTests: Testing text events triggered by speech input.
https://bugs.webkit.org/show_bug.cgi?id=60451

Reviewed by Ryosuke Niwa.

  • fast/speech/input-ontextinput-event-expected.txt: Added.
  • fast/speech/input-ontextinput-event.html: Added.
  • fast/speech/input-text-speechstart.html:
Location:
trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r95721 r95722  
     12011-09-22  Leandro Gracia Gil  <leandrogracia@chromium.org>
     2
     3        Testing text events triggered by speech input.
     4        https://bugs.webkit.org/show_bug.cgi?id=60451
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        * fast/speech/input-ontextinput-event-expected.txt: Added.
     9        * fast/speech/input-ontextinput-event.html: Added.
     10        * fast/speech/input-text-speechstart.html:
     11
    1122011-09-20  Jason Liu  <jason.liu@torchmobile.com.cn>
    213
  • trunk/LayoutTests/fast/speech/input-text-speechstart.html

    r94343 r95722  
    1414    // Test that we can trigger speech with a method call to the input
    1515    // element, so the user agent could toggle speech via a keypress,
    16     // for example.
     16    // for example. Select is required in order to ensure that the result
     17    // will be set in input during the generated TextInput event.
    1718    var input = document.getElementById(id);
     19    input.select();
    1820    layoutTestController.startSpeechInput(input);
    1921}
  • trunk/Source/WebCore/ChangeLog

    r95721 r95722  
     12011-09-22  Leandro Gracia Gil  <leandrogracia@chromium.org>
     2
     3        Fire TextInput events on speech input, but not set/add any inputMethod attribute.
     4        https://bugs.webkit.org/show_bug.cgi?id=60451
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        Introduce code to dispatch TextInput events when text is introduced via
     9        the speech input feature. Handle also the cases where speech input is
     10        started programmatically from the LayoutTestController.
     11
     12        Test: fast/speech/input-ontextinput-event.html
     13
     14        * dom/TextEventInputType.h:
     15        * html/shadow/TextControlInnerElements.cpp:
     16        (WebCore::InputFieldSpeechButtonElement::setRecognitionResult):
     17
    1182011-09-20  Jason Liu  <jason.liu@torchmobile.com.cn>
    219
  • trunk/Source/WebCore/dom/TextEventInputType.h

    r76482 r95722  
    3636    TextEventInputPaste,
    3737    TextEventInputDrop,
     38    TextEventInputOther,
    3839};
    3940
  • trunk/Source/WebCore/html/shadow/TextControlInnerElements.cpp

    r94659 r95722  
    4444#include "SpeechInput.h"
    4545#include "SpeechInputEvent.h"
     46#include "TextEvent.h"
     47#include "TextEventInputType.h"
    4648
    4749namespace WebCore {
     
    489491
    490492    RefPtr<InputFieldSpeechButtonElement> holdRefButton(this);
    491     input->setValue(results.isEmpty() ? "" : results[0]->utterance());
     493    if (document() && document()->domWindow())
     494        input->dispatchEvent(TextEvent::create(document()->domWindow(), results.isEmpty() ? "" : results[0]->utterance(), TextEventInputOther));
     495
     496    // This event is sent after the text event so the website can perform actions using the input field content immediately.
     497    // It provides alternative recognition hypotheses and notifies that the results come from speech input.
    492498    input->dispatchEvent(SpeechInputEvent::create(eventNames().webkitspeechchangeEvent, results));
    493499
Note: See TracChangeset for help on using the changeset viewer.