- Revision
- 125529
- Author
- [email protected]
- Date
- 2012-08-14 02:06:50 -0700 (Tue, 14 Aug 2012)
Log Message
Speech Input: wrong position was reported for scolled-down elements
https://bugs.webkit.org/show_bug.cgi?id=93634
Reviewed by Kent Tamura.
Source/WebCore:
When clicking on a speech-enabled input element, WebKit reports
the position of the element to the embedder, so that it can show
a bubble indicating that speech recognition is in progress for
the element that the user clicked on.
On a page that was scrolled, this position was being reported
erroneously: it was given relative to the frame content as opposed to
the root view, and the in-progress bubble would be shown in the wrong
place.
Test: fast/speech/bubble-position-scrolled.html
* html/shadow/TextControlInnerElements.cpp:
(WebCore::InputFieldSpeechButtonElement::startSpeechInput):
LayoutTests:
Test that the position of the speech element is passed to the embedder
corectly, i.e. where the user clicked, when the page is scrolled down.
* fast/speech/bubble-position-scrolled-expected.txt: Added.
* fast/speech/bubble-position-scrolled.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (125528 => 125529)
--- trunk/LayoutTests/ChangeLog 2012-08-14 09:06:14 UTC (rev 125528)
+++ trunk/LayoutTests/ChangeLog 2012-08-14 09:06:50 UTC (rev 125529)
@@ -1,3 +1,16 @@
+2012-08-14 Hans Wennborg <[email protected]>
+
+ Speech Input: wrong position was reported for scolled-down elements
+ https://bugs.webkit.org/show_bug.cgi?id=93634
+
+ Reviewed by Kent Tamura.
+
+ Test that the position of the speech element is passed to the embedder
+ corectly, i.e. where the user clicked, when the page is scrolled down.
+
+ * fast/speech/bubble-position-scrolled-expected.txt: Added.
+ * fast/speech/bubble-position-scrolled.html: Added.
+
2012-08-14 Sheriff Bot <[email protected]>
Unreviewed, rolling out r125519.
Added: trunk/LayoutTests/fast/speech/bubble-position-scrolled-expected.txt (0 => 125529)
--- trunk/LayoutTests/fast/speech/bubble-position-scrolled-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/speech/bubble-position-scrolled-expected.txt 2012-08-14 09:06:50 UTC (rev 125529)
@@ -0,0 +1,14 @@
+Tests for speech button click with <input type="text" speech>.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Clicking the speech button.
+onSpeechChange
+x OK
+y OK
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
+
Added: trunk/LayoutTests/fast/speech/bubble-position-scrolled.html (0 => 125529)
--- trunk/LayoutTests/fast/speech/bubble-position-scrolled.html (rev 0)
+++ trunk/LayoutTests/fast/speech/bubble-position-scrolled.html 2012-08-14 09:06:50 UTC (rev 125529)
@@ -0,0 +1,63 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script type="text/_javascript_">
+description('Tests for speech button click with <input type="text" speech>.');
+
+function onSpeechChange() {
+ debug('onSpeechChange');
+ var rect = input.value.split(',');
+ var x = parseInt(rect[0]);
+ var y = parseInt(rect[1]);
+
+ if (Math.abs(x - clickTargetX) > 20) {
+ testFailed('x too far away from clickTargetX');
+ debug('x: ' + x + ' clickTargetX: ' + clickTargetX);
+ } else {
+ debug('x OK');
+ }
+
+ if (Math.abs(y - clickTargetY) > 20) {
+ testFailed('y too far away from clickTargetY');
+ debug('y: ' + y + ' clickTargetY: ' + clickTargetY);
+ } else {
+ debug('y OK');
+ }
+
+ finishJSTest();
+}
+
+function run() {
+ window.input = document.getElementsByTagName('input')[0];
+ input._onwebkitspeechchange_ = onSpeechChange;
+
+ var scrollAmount = 100;
+ window.scrollTo(0, scrollAmount);
+
+ if (window.testRunner && window.eventSender) {
+ testRunner.setMockSpeechInputDumpRect(true);
+ debug('Clicking the speech button.');
+
+ window.clickTargetX = input.offsetLeft + input.offsetWidth - 4;
+ window.clickTargetY = input.offsetTop + input.offsetHeight / 2;
+
+ clickTargetY -= scrollAmount;
+
+ eventSender.mouseMoveTo(clickTargetX, clickTargetY);
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+ }
+}
+
+window._onload_ = run;
+window.jsTestIsAsync = true;
+</script>
+<script src=""
+<div style="height: 200px"></div>
+<input x-webkit-speech>
+<div style="height: 1000px"></div>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (125528 => 125529)
--- trunk/Source/WebCore/ChangeLog 2012-08-14 09:06:14 UTC (rev 125528)
+++ trunk/Source/WebCore/ChangeLog 2012-08-14 09:06:50 UTC (rev 125529)
@@ -1,3 +1,25 @@
+2012-08-14 Hans Wennborg <[email protected]>
+
+ Speech Input: wrong position was reported for scolled-down elements
+ https://bugs.webkit.org/show_bug.cgi?id=93634
+
+ Reviewed by Kent Tamura.
+
+ When clicking on a speech-enabled input element, WebKit reports
+ the position of the element to the embedder, so that it can show
+ a bubble indicating that speech recognition is in progress for
+ the element that the user clicked on.
+
+ On a page that was scrolled, this position was being reported
+ erroneously: it was given relative to the frame content as opposed to
+ the root view, and the in-progress bubble would be shown in the wrong
+ place.
+
+ Test: fast/speech/bubble-position-scrolled.html
+
+ * html/shadow/TextControlInnerElements.cpp:
+ (WebCore::InputFieldSpeechButtonElement::startSpeechInput):
+
2012-08-14 Taiju Tsuiki <[email protected]>
Web Inspector: Drop "Loading..." message from FileContentView
Modified: trunk/Source/WebCore/html/shadow/TextControlInnerElements.cpp (125528 => 125529)
--- trunk/Source/WebCore/html/shadow/TextControlInnerElements.cpp 2012-08-14 09:06:14 UTC (rev 125528)
+++ trunk/Source/WebCore/html/shadow/TextControlInnerElements.cpp 2012-08-14 09:06:50 UTC (rev 125529)
@@ -633,8 +633,7 @@
RefPtr<HTMLInputElement> input = static_cast<HTMLInputElement*>(shadowHost());
AtomicString language = input->computeInheritedLanguage();
String grammar = input->getAttribute(webkitgrammarAttr);
- // FIXME: this should probably respect transforms
- IntRect rect = pixelSnappedIntRect(renderer()->view()->frameView()->contentsToWindow(renderer()->absoluteBoundingBoxRectIgnoringTransforms()));
+ IntRect rect = document()->view()->contentsToRootView(getPixelSnappedRect());
if (speechInput()->startRecognition(m_listenerId, rect, language, grammar, document()->securityOrigin()))
setState(Recording);
}
Modified: trunk/Source/WebCore/page/SpeechInputClient.h (125528 => 125529)
--- trunk/Source/WebCore/page/SpeechInputClient.h 2012-08-14 09:06:14 UTC (rev 125528)
+++ trunk/Source/WebCore/page/SpeechInputClient.h 2012-08-14 09:06:50 UTC (rev 125529)
@@ -51,7 +51,8 @@
// The client does not take ownership of the pointer.
virtual void setListener(SpeechInputListener*) = 0;
- // Starts speech recognition and audio recording.
+ // Starts speech recognition and audio recording. elementRect is the position
+ // of the element where the user clicked in the RootView coordinate system.
virtual bool startRecognition(int requestId, const IntRect& elementRect, const AtomicString& language, const String& grammar, SecurityOrigin*) = 0;
// Stops audio recording and performs recognition with the audio recorded until now
Modified: trunk/Source/WebKit/chromium/public/WebSpeechInputController.h (125528 => 125529)
--- trunk/Source/WebKit/chromium/public/WebSpeechInputController.h 2012-08-14 09:06:14 UTC (rev 125528)
+++ trunk/Source/WebKit/chromium/public/WebSpeechInputController.h 2012-08-14 09:06:50 UTC (rev 125529)
@@ -44,7 +44,8 @@
public:
// Starts speech recognition. Speech will get recorded until the endpointer detects silence,
// runs to the limit or stopRecording is called. Progress indications and the recognized
- // text are returned via the listener interface.
+ // text are returned via the listener interface. elementRect is the position
+ // of the element where the user clicked in the RootView coordinate system.
virtual bool startRecognition(int requestId, const WebRect& elementRect, const WebString& language, const WebString& grammar, const WebSecurityOrigin& origin)
{
WEBKIT_ASSERT_NOT_REACHED();