diff options
author | dmazzoni@chromium.org <dmazzoni@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-14 07:25:26 +0000 |
---|---|---|
committer | dmazzoni@chromium.org <dmazzoni@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-14 07:25:26 +0000 |
commit | d23cdced2fcfaf7c80bf2bad0cd45f289fd06de9 (patch) | |
tree | 6d382182d803754417edb2c4b4dcaa77d7872ecc /content | |
parent | e48e05150a1180ea87a52fbb32e8f042ecf89610 (diff) | |
download | chromium_src-d23cdced2fcfaf7c80bf2bad0cd45f289fd06de9.zip chromium_src-d23cdced2fcfaf7c80bf2bad0cd45f289fd06de9.tar.gz chromium_src-d23cdced2fcfaf7c80bf2bad0cd45f289fd06de9.tar.bz2 |
Fix speech input keystroke crash.
It was trying to cast a WebElement to WebInputElement if it was a text
form control, but this broke for <textarea>. Now checking for the "input"
tag.
BUG=96058
TEST=manual testing
Review URL: http://codereview.chromium.org/7754029
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@101035 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r-- | content/renderer/speech_input_dispatcher.cc | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/content/renderer/speech_input_dispatcher.cc b/content/renderer/speech_input_dispatcher.cc index af798e4..96ab209 100644 --- a/content/renderer/speech_input_dispatcher.cc +++ b/content/renderer/speech_input_dispatcher.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -118,21 +118,20 @@ void SpeechInputDispatcher::OnSpeechRecognitionToggleSpeechInput() { if (document.isNull()) return; - WebNode focusedNode = document.focusedNode(); - if (focusedNode.isNull() || !focusedNode.isElementNode()) + WebNode focused_node = document.focusedNode(); + if (focused_node.isNull() || !focused_node.isElementNode()) return; - WebKit::WebElement element = focusedNode.to<WebKit::WebElement>(); - if (!element.isTextFormControlElement()) + WebKit::WebElement element = focused_node.to<WebKit::WebElement>(); + WebKit::WebInputElement* input_element = WebKit::toWebInputElement(&element); + if (!input_element) return; - - WebKit::WebInputElement inputElement = element.to<WebKit::WebInputElement>(); - if (!inputElement.isSpeechInputEnabled()) + if (!input_element->isSpeechInputEnabled()) return; - if (inputElement.getSpeechInputState() == WebInputElement::Idle) { - inputElement.startSpeechInput(); + if (input_element->getSpeechInputState() == WebInputElement::Idle) { + input_element->startSpeechInput(); } else { - inputElement.stopSpeechInput(); + input_element->stopSpeechInput(); } } |