Bug 42047

Summary: Add click handler to the input element's speech button.
Product: WebKit Reporter: Satish Sampath <satish>
Component: FormsAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, tkent, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Bug Depends on: 41518    
Bug Blocks: 39485    
Attachments:
Description Flags
Patch
none
Patch
none
Patch none

Description Satish Sampath 2010-07-11 14:57:38 PDT
Adds code to handle clicks on the input element's speech button and invoke speech recognition. The speech button now implements SpeechInputListener to receive progress events and the recognized text.

All code changes are behind the speech input compile time flag (disabled by default).

More information about the speech input API proposal can be found in the following links:
 Parent bug: https://bugs.webkit.org/show_bug.cgi?id=39485
 Full API proposal: https://docs.google.com/View?id=dcfg79pz_5dhnp23f5
 Relevant discussions in the WHATWG list:
  - http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2010-May/026338.html
  - http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2010-June/026747.html
Comment 1 Satish Sampath 2010-07-14 01:42:18 PDT
Created attachment 61486 [details]
Patch
Comment 2 Kent Tamura 2010-07-14 02:03:05 PDT
Comment on attachment 61486 [details]
Patch

WebCore/rendering/TextControlInnerElements.cpp:353
 +          input->focus();
focus() dispatches a focus event, and an event handler might remove 'input' node.  So the next input->select() can use a deleted object.
Please look at SpinButtonElement::defaultEventHandler() of the latest revision of TextControlInnerElements.cpp.


WebCore/rendering/TextControlInnerElements.cpp:392
 +      input->dispatchFormControlChangeEvent();
This has a similar problem.  An event handler of the event might remove the 'input' node.  So this InputFieldSpeechButtonElement instance might be removed.
So, we need
  RefPtr<InputFieldSpeechButtonElement> protector(this);
before input->dispatchFormControlChangeEvent().
Comment 3 Satish Sampath 2010-07-14 02:25:39 PDT
Created attachment 61494 [details]
Patch

Address Kent's comments
Comment 4 WebKit Review Bot 2010-07-14 02:31:23 PDT
Attachment 61494 [details] did not pass style-queue:

Failed to run "['WebKitTools/Scripts/check-webkit-style']" exit_code: 1
WebCore/rendering/TextControlInnerElements.cpp:356:  hold_ref is incorrectly named. Don't use underscores in your identifier names.  [readability/naming] [4]
WebCore/rendering/TextControlInnerElements.cpp:398:  hold_ref is incorrectly named. Don't use underscores in your identifier names.  [readability/naming] [4]
Total errors found: 2 in 3 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 5 Satish Sampath 2010-07-14 02:35:20 PDT
Created attachment 61495 [details]
Patch

Address Kent's comments (2nd try)
Comment 6 Kent Tamura 2010-07-14 03:26:39 PDT
Comment on attachment 61495 [details]
Patch

OK.
Comment 7 WebKit Commit Bot 2010-07-14 06:57:58 PDT
Comment on attachment 61495 [details]
Patch

Clearing flags on attachment: 61495

Committed r63315: <http://trac.webkit.org/changeset/63315>
Comment 8 WebKit Commit Bot 2010-07-14 06:58:09 PDT
All reviewed patches have been landed.  Closing bug.