Changeset 69100 in webkit


Ignore:
Timestamp:
Oct 5, 2010 3:44:41 AM (14 years ago)
Author:
satish@chromium.org
Message:

2010-10-05 Satish Sampath <satish@chromium.org>

Reviewed by Kent Tamura.

Added event onwebkitspeechchange to invoke on new speech input results.
https://bugs.webkit.org/show_bug.cgi?id=47127

Updated to use onwebkitspeechchange instead of onchange.

  • fast/speech/input-text-speechbutton.html:
  • fast/speech/speech-button-ignore-generated-events.html:

2010-10-05 Satish Sampath <satish@chromium.org>

Reviewed by Kent Tamura.

Added event onwebkitspeechchange to invoke on new speech input results.
https://bugs.webkit.org/show_bug.cgi?id=47127

  • dom/EventNames.h: Added webkitspeechchange event name.
  • html/HTMLAttributeNames.in: Added onwebkitspeechchange attribute name.
  • html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::parseMappedAttribute): Handle new attribute set. (WebCore::HTMLInputElement::dispatchWebkitSpeechChangeEvent): Invoke the event handler.
  • html/HTMLInputElement.h:
  • html/HTMLInputElement.idl: Added attribute to IDL.
  • rendering/TextControlInnerElements.cpp: (WebCore::InputFieldSpeechButtonElement::setRecognitionResult): Invoke new event handler instead of onChange
Location:
trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r69099 r69100  
     12010-10-05  Satish Sampath  <satish@chromium.org>
     2
     3        Reviewed by Kent Tamura.
     4
     5        Added event onwebkitspeechchange to invoke on new speech input results.
     6        https://bugs.webkit.org/show_bug.cgi?id=47127
     7
     8        Updated to use onwebkitspeechchange instead of onchange.
     9
     10        * fast/speech/input-text-speechbutton.html:
     11        * fast/speech/speech-button-ignore-generated-events.html:
     12
    1132010-10-05  Satish Sampath  <satish@chromium.org>
    214
  • trunk/LayoutTests/fast/speech/input-text-speechbutton.html

    r69099 r69100  
    1111description('Tests for speech button click with &lt;input type="text" speech>.');
    1212
    13 function onChange() {
     13function onWebkitSpeechChange() {
    1414    shouldBeEqualToString('document.getElementById("speechInput").value', 'Pictures of the moon');
    1515    setTimeout(function() {
     
    1717        input.dir = 'rtl';
    1818        input.value = '';
    19         input.onchange = function() {
     19        input.onwebkitspeechchange = function() {
    2020            shouldBeEqualToString('document.getElementById("speechInput").value',
    2121                                  'Pictures of the moon');
     
    5050</script>
    5151<script src="../js/resources/js-test-post.js"></script>
    52 <input id='speechInput' x-webkit-speech onchange="onChange()">
     52<input id='speechInput' x-webkit-speech onwebkitspeechchange="onWebkitSpeechChange()">
    5353</body>
    5454</html>
  • trunk/LayoutTests/fast/speech/speech-button-ignore-generated-events.html

    r69099 r69100  
    3030
    3131function setupDispatchEventTest() {
    32     document.getElementById('speechInput').onchange = function() {
     32    document.getElementById('speechInput').onwebkitspeechchange = function() {
    3333        testFailed('speech button accepted a programmatic click and fired onChange event.');
    3434        finishJSTest();
     
    5151        // Running in DRT, test the eventSender case.
    5252        layoutTestController.setMockSpeechInputResult('Pictures of the moon');
    53         document.getElementById('speechInput').onchange = function() {
     53        document.getElementById('speechInput').onwebkitspeechchange = function() {
    5454            shouldBeEqualToString('document.getElementById("speechInput").value', 'Pictures of the moon');
    5555
  • trunk/WebCore/ChangeLog

    r69099 r69100  
     12010-10-05  Satish Sampath  <satish@chromium.org>
     2
     3        Reviewed by Kent Tamura.
     4
     5        Added event onwebkitspeechchange to invoke on new speech input results.
     6        https://bugs.webkit.org/show_bug.cgi?id=47127
     7
     8        * dom/EventNames.h: Added webkitspeechchange event name.
     9        * html/HTMLAttributeNames.in: Added onwebkitspeechchange attribute name.
     10        * html/HTMLInputElement.cpp:
     11        (WebCore::HTMLInputElement::parseMappedAttribute): Handle new attribute set.
     12        (WebCore::HTMLInputElement::dispatchWebkitSpeechChangeEvent): Invoke the event handler.
     13        * html/HTMLInputElement.h:
     14        * html/HTMLInputElement.idl: Added attribute to IDL.
     15        * rendering/TextControlInnerElements.cpp:
     16        (WebCore::InputFieldSpeechButtonElement::setRecognitionResult): Invoke new event handler instead of onChange
     17
    1182010-10-05  Satish Sampath  <satish@chromium.org>
    219
  • trunk/WebCore/dom/EventNames.h

    r66251 r69100  
    167167    macro(loadend) \
    168168    \
    169     macro(webkitfullscreenchange)
     169    macro(webkitfullscreenchange) \
     170    \
     171    macro(webkitspeechchange)
    170172    \
    171173// end of DOM_EVENT_NAMES_FOR_EACH
  • trunk/WebCore/html/HTMLAttributeNames.in

    r69099 r69100  
    207207onselect
    208208onselectstart
     209onwebkitspeechchange
    209210onstalled
    210211onstorage
  • trunk/WebCore/html/HTMLInputElement.cpp

    r69078 r69100  
    12161216          renderer()->updateFromElement();
    12171217      setNeedsStyleRecalc();
    1218     }
     1218    } else if (attr->name() == onwebkitspeechchangeAttr)
     1219        setAttributeEventListener(eventNames().webkitspeechchangeEvent, createAttributeEventListener(this, attr));
    12191220#endif
    12201221    else
     
    28942895    return false;
    28952896}
     2897
     2898void HTMLInputElement::dispatchWebkitSpeechChangeEvent()
     2899{
     2900    ASSERT(isSpeechEnabled());
     2901    dispatchEvent(Event::create(eventNames().webkitspeechchangeEvent, true, false));
     2902}
    28962903#endif
    28972904
  • trunk/WebCore/html/HTMLInputElement.h

    r68996 r69100  
    4545    virtual ~HTMLInputElement();
    4646
     47    DEFINE_ATTRIBUTE_EVENT_LISTENER(webkitspeechchange);
     48
    4749    bool autoComplete() const;
    4850
     
    99101#if ENABLE(INPUT_SPEECH)
    100102    virtual bool isSpeechEnabled() const;
    101 #endif   
     103    void dispatchWebkitSpeechChangeEvent();
     104#endif
    102105
    103106    bool checked() const { return m_checked; }
  • trunk/WebCore/html/HTMLInputElement.idl

    r69099 r69100  
    102102#if defined(ENABLE_INPUT_SPEECH) && ENABLE_INPUT_SPEECH
    103103        attribute [Reflect, EnabledAtRuntime] boolean webkitSpeech;
     104        attribute [DontEnum] EventListener onwebkitspeechchange;
    104105#endif
    105106    };
  • trunk/WebCore/rendering/TextControlInnerElements.cpp

    r66878 r69100  
    480480    RefPtr<HTMLInputElement> holdRef(input);
    481481    input->setValue(result);
    482     input->dispatchFormControlChangeEvent();
     482    input->dispatchWebkitSpeechChangeEvent();
    483483    renderer()->repaint();
    484484}
Note: See TracChangeset for help on using the changeset viewer.