[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
commit-queue at webkit.org
commit-queue at webkit.org
Wed Dec 22 11:57:28 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 6e5cf4c9a1d060fbf41d4fc08cb8f74eaa616a2d
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Aug 12 06:42:44 2010 +0000
2010-08-11 Satish Sampath <satish at chromium.org>
Reviewed by Kent Tamura.
Handle clicks and recognition events for the speech input button
https://bugs.webkit.org/show_bug.cgi?id=43857
* rendering/RenderInputSpeech.cpp:
(WebCore::RenderInputSpeech::paintInputFieldSpeechButton): Selects the image based on current state.
* rendering/TextControlInnerElements.cpp:
(WebCore::InputFieldSpeechButtonElement::InputFieldSpeechButtonElement):
(WebCore::InputFieldSpeechButtonElement::defaultEventHandler):
(WebCore::InputFieldSpeechButtonElement::set_state): Switch to a new state and update the UI.
(WebCore::InputFieldSpeechButtonElement::didCompleteRecording):
(WebCore::InputFieldSpeechButtonElement::didCompleteRecognition):
* rendering/TextControlInnerElements.h:
(WebCore::InputFieldSpeechButtonElement::):
(WebCore::InputFieldSpeechButtonElement::state):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@65220 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 1353f9e..c2cbb65 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,22 @@
+2010-08-11 Satish Sampath <satish at chromium.org>
+
+ Reviewed by Kent Tamura.
+
+ Handle clicks and recognition events for the speech input button
+ https://bugs.webkit.org/show_bug.cgi?id=43857
+
+ * rendering/RenderInputSpeech.cpp:
+ (WebCore::RenderInputSpeech::paintInputFieldSpeechButton): Selects the image based on current state.
+ * rendering/TextControlInnerElements.cpp:
+ (WebCore::InputFieldSpeechButtonElement::InputFieldSpeechButtonElement):
+ (WebCore::InputFieldSpeechButtonElement::defaultEventHandler):
+ (WebCore::InputFieldSpeechButtonElement::set_state): Switch to a new state and update the UI.
+ (WebCore::InputFieldSpeechButtonElement::didCompleteRecording):
+ (WebCore::InputFieldSpeechButtonElement::didCompleteRecognition):
+ * rendering/TextControlInnerElements.h:
+ (WebCore::InputFieldSpeechButtonElement::):
+ (WebCore::InputFieldSpeechButtonElement::state):
+
2010-08-11 Fumitoshi Ukai <ukai at chromium.org>
Reviewed by Alexey Proskuryakov.
diff --git a/WebCore/rendering/RenderInputSpeech.cpp b/WebCore/rendering/RenderInputSpeech.cpp
index df17944..5472025 100644
--- a/WebCore/rendering/RenderInputSpeech.cpp
+++ b/WebCore/rendering/RenderInputSpeech.cpp
@@ -36,6 +36,7 @@
#include "GraphicsContext.h"
#include "HTMLNames.h"
#include "RenderBox.h"
+#include "TextControlInnerElements.h"
namespace WebCore {
@@ -79,7 +80,16 @@ bool RenderInputSpeech::paintInputFieldSpeechButton(RenderObject* object, const
buttonRect.move(rect.x(), rect.y());
DEFINE_STATIC_LOCAL(RefPtr<Image>, imageStateNormal, (Image::loadPlatformResource("inputSpeech")));
- paintInfo.context->drawImage(imageStateNormal.get(), object->style()->colorSpace(), buttonRect);
+ DEFINE_STATIC_LOCAL(RefPtr<Image>, imageStateRecording, (Image::loadPlatformResource("inputSpeechRecording")));
+ DEFINE_STATIC_LOCAL(RefPtr<Image>, imageStateWaiting, (Image::loadPlatformResource("inputSpeechWaiting")));
+
+ InputFieldSpeechButtonElement* speechButton = reinterpret_cast<InputFieldSpeechButtonElement*>(object->node());
+ Image* image = imageStateNormal.get();
+ if (speechButton->state() == InputFieldSpeechButtonElement::Recording)
+ image = imageStateRecording.get();
+ else if (speechButton->state() == InputFieldSpeechButtonElement::Recognizing)
+ image = imageStateWaiting.get();
+ paintInfo.context->drawImage(image, object->style()->colorSpace(), buttonRect);
return false;
}
diff --git a/WebCore/rendering/TextControlInnerElements.cpp b/WebCore/rendering/TextControlInnerElements.cpp
index cf0e864..f532101 100644
--- a/WebCore/rendering/TextControlInnerElements.cpp
+++ b/WebCore/rendering/TextControlInnerElements.cpp
@@ -345,6 +345,7 @@ void SpinButtonElement::setHovered(bool flag)
inline InputFieldSpeechButtonElement::InputFieldSpeechButtonElement(Node* shadowParent)
: TextControlInnerElement(shadowParent->document(), shadowParent)
, m_capturing(false)
+ , m_state(Idle)
{
}
@@ -383,7 +384,18 @@ void InputFieldSpeechButtonElement::defaultEventHandler(Event* event)
}
if (event->type() == eventNames().clickEvent) {
- speechInput()->startRecognition(this);
+ switch (m_state) {
+ case Idle:
+ if (speechInput()->startRecognition(this))
+ setState(Recording);
+ break;
+ case Recording:
+ speechInput()->stopRecording();
+ break;
+ case Recognizing:
+ // Nothing to do here, we will continue to wait for results.
+ break;
+ }
event->setDefaultHandled();
}
@@ -391,6 +403,14 @@ void InputFieldSpeechButtonElement::defaultEventHandler(Event* event)
HTMLDivElement::defaultEventHandler(event);
}
+void InputFieldSpeechButtonElement::setState(SpeechInputState state)
+{
+ if (m_state != state) {
+ m_state = state;
+ shadowAncestorNode()->renderer()->repaint();
+ }
+}
+
SpeechInput* InputFieldSpeechButtonElement::speechInput()
{
return document()->page()->speechInput();
@@ -398,13 +418,12 @@ SpeechInput* InputFieldSpeechButtonElement::speechInput()
void InputFieldSpeechButtonElement::didCompleteRecording()
{
- // FIXME: Add UI feedback here to indicate that audio recording stopped and recognition is
- // in progress.
+ setState(Recognizing);
}
void InputFieldSpeechButtonElement::didCompleteRecognition()
{
- // FIXME: Add UI feedback here to indicate that audio recognition has ended.
+ setState(Idle);
}
void InputFieldSpeechButtonElement::setRecognitionResult(const String& result)
diff --git a/WebCore/rendering/TextControlInnerElements.h b/WebCore/rendering/TextControlInnerElements.h
index 2859bd5..e7ee98f 100644
--- a/WebCore/rendering/TextControlInnerElements.h
+++ b/WebCore/rendering/TextControlInnerElements.h
@@ -119,10 +119,17 @@ class InputFieldSpeechButtonElement
: public TextControlInnerElement,
public SpeechInputListener {
public:
+ enum SpeechInputState {
+ Idle,
+ Recording,
+ Recognizing,
+ };
+
static PassRefPtr<InputFieldSpeechButtonElement> create(Node*);
virtual void detach();
virtual void defaultEventHandler(Event*);
+ SpeechInputState state() const { return m_state; }
// SpeechInputListener methods.
void didCompleteRecording();
@@ -132,8 +139,10 @@ public:
private:
InputFieldSpeechButtonElement(Node*);
SpeechInput* speechInput();
+ void setState(SpeechInputState state);
bool m_capturing;
+ SpeechInputState m_state;
};
#endif // ENABLE(INPUT_SPEECH)
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list