Title: [160337] trunk
- Revision
- 160337
- Author
- rn...@webkit.org
- Date
- 2013-12-09 15:44:19 -0800 (Mon, 09 Dec 2013)
Log Message
REGRESSION(r136280): input[type=image] should assume coords of 0,0 when activated without physically clicking
https://bugs.webkit.org/show_bug.cgi?id=125392
Reviewed by Darin Adler.
Source/WebCore:
Merge https://chromium.googlesource.com/chromium/blink/+/3c33d42207cd209bb171083ba66c225f694f2101
Activating an image button with the keyboard or element.click() should result in selected coords of (0,0) per
http://www.w3.org/TR/2013/CR-html5-20130806/forms.html#image-button-state-(type=image)
"If the user activates the control without explicitly selecting a coordinate, then the coordinate (0,0) must be assumed."
New behavior also matches that of Internet Explorer and Firefox.
Tests: fast/forms/input-image-submit.html
* html/ImageInputType.cpp:
(WebCore::ImageInputType::handleDOMActivateEvent): Set m_clickLocation to (0, 0) for simulated events.
LayoutTests:
* fast/events/stopPropagation-submit-expected.txt:
* fast/forms/input-image-submit.html:
* platform/gtk/fast/events/stopPropagation-submit-expected.txt: Removed.
Modified Paths
Removed Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (160336 => 160337)
--- trunk/LayoutTests/ChangeLog 2013-12-09 23:36:56 UTC (rev 160336)
+++ trunk/LayoutTests/ChangeLog 2013-12-09 23:44:19 UTC (rev 160337)
@@ -1,3 +1,14 @@
+2013-12-09 Ryosuke Niwa <rn...@webkit.org>
+
+ REGRESSION(r136280): input[type=image] should assume coords of 0,0 when activated without physically clicking
+ https://bugs.webkit.org/show_bug.cgi?id=125392
+
+ Reviewed by Darin Adler.
+
+ * fast/events/stopPropagation-submit-expected.txt:
+ * fast/forms/input-image-submit.html:
+ * platform/gtk/fast/events/stopPropagation-submit-expected.txt: Removed.
+
2013-12-09 Jer Noble <jer.no...@apple.com>
[MSE] Add support for VideoPlaybackMetrics.
Modified: trunk/LayoutTests/fast/events/stopPropagation-submit-expected.txt (160336 => 160337)
--- trunk/LayoutTests/fast/events/stopPropagation-submit-expected.txt 2013-12-09 23:36:56 UTC (rev 160336)
+++ trunk/LayoutTests/fast/events/stopPropagation-submit-expected.txt 2013-12-09 23:44:19 UTC (rev 160337)
@@ -1,2 +1,2 @@
PASS
-?x=-8&y=-60
+?x=0&y=0
Modified: trunk/LayoutTests/fast/forms/input-image-submit.html (160336 => 160337)
--- trunk/LayoutTests/fast/forms/input-image-submit.html 2013-12-09 23:36:56 UTC (rev 160336)
+++ trunk/LayoutTests/fast/forms/input-image-submit.html 2013-12-09 23:44:19 UTC (rev 160337)
@@ -60,7 +60,7 @@
var query = window.location.search;
if (query.indexOf('state=') == -1) {
- // Step 1: Normal submission with type=image
+ // Step 1a: Normal submission by mouse click with type=image
state.value = 'normal';
image.dispatchEvent(clickEvent);
} else if (query.indexOf('state=normal') != -1) {
@@ -70,6 +70,30 @@
return;
}
+ // Step 1b: Submission by element.click() method with type=image
+ state.value = 'click-method';
+ image.click();
+ } else if (query.indexOf('state=click-method') != -1) {
+ if (query.indexOf('image.x=0&image.y=0&image=value') == -1) {
+ failAndDone('Click method failed: ' + query);
+ return;
+ }
+
+ // Step 1c: Submission by keyboard activation with type=image
+ state.value = 'keyboard';
+ if (window.eventSender) {
+ image.focus();
+ eventSender.keyDown(' ');
+ } else {
+ failAndDone('This test requires eventSender');
+ return;
+ }
+ } else if (query.indexOf('state=keyboard') != -1) {
+ if (query.indexOf('image.x=0&image.y=0&image=value') == -1) {
+ failAndDone('Activating with keyboard failed: ' + query);
+ return;
+ }
+
// Step 2: Change the type to text on 'submit' event
state.value = 'to-text-on-submit';
image.dispatchEvent(clickEvent);
Deleted: trunk/LayoutTests/platform/gtk/fast/events/stopPropagation-submit-expected.txt (160336 => 160337)
--- trunk/LayoutTests/platform/gtk/fast/events/stopPropagation-submit-expected.txt 2013-12-09 23:36:56 UTC (rev 160336)
+++ trunk/LayoutTests/platform/gtk/fast/events/stopPropagation-submit-expected.txt 2013-12-09 23:44:19 UTC (rev 160337)
@@ -1,2 +0,0 @@
-PASS
-?x=-8&y=-58
Modified: trunk/Source/WebCore/ChangeLog (160336 => 160337)
--- trunk/Source/WebCore/ChangeLog 2013-12-09 23:36:56 UTC (rev 160336)
+++ trunk/Source/WebCore/ChangeLog 2013-12-09 23:44:19 UTC (rev 160337)
@@ -1,3 +1,23 @@
+2013-12-09 Ryosuke Niwa <rn...@webkit.org>
+
+ REGRESSION(r136280): input[type=image] should assume coords of 0,0 when activated without physically clicking
+ https://bugs.webkit.org/show_bug.cgi?id=125392
+
+ Reviewed by Darin Adler.
+
+ Merge https://chromium.googlesource.com/chromium/blink/+/3c33d42207cd209bb171083ba66c225f694f2101
+
+ Activating an image button with the keyboard or element.click() should result in selected coords of (0,0) per
+ http://www.w3.org/TR/2013/CR-html5-20130806/forms.html#image-button-state-(type=image)
+ "If the user activates the control without explicitly selecting a coordinate, then the coordinate (0,0) must be assumed."
+
+ New behavior also matches that of Internet Explorer and Firefox.
+
+ Tests: fast/forms/input-image-submit.html
+
+ * html/ImageInputType.cpp:
+ (WebCore::ImageInputType::handleDOMActivateEvent): Set m_clickLocation to (0, 0) for simulated events.
+
2013-12-09 Jer Noble <jer.no...@apple.com>
[MSE] Add support for VideoPlaybackMetrics.
Modified: trunk/Source/WebCore/html/ImageInputType.cpp (160336 => 160337)
--- trunk/Source/WebCore/html/ImageInputType.cpp 2013-12-09 23:36:56 UTC (rev 160336)
+++ trunk/Source/WebCore/html/ImageInputType.cpp 2013-12-09 23:44:19 UTC (rev 160337)
@@ -85,11 +85,17 @@
if (element->isDisabledFormControl() || !element->form())
return;
element->setActivatedSubmit(true);
- if (event->underlyingEvent() && event->underlyingEvent()->isMouseEvent()) {
- MouseEvent* mouseEvent = static_cast<MouseEvent*>(event->underlyingEvent());
- m_clickLocation = IntPoint(mouseEvent->offsetX(), mouseEvent->offsetY());
- } else
- m_clickLocation = IntPoint();
+
+ m_clickLocation = IntPoint();
+ if (event->underlyingEvent()) {
+ Event& underlyingEvent = *event->underlyingEvent();
+ if (underlyingEvent.isMouseEvent()) {
+ MouseEvent& mouseEvent = toMouseEvent(underlyingEvent);
+ if (!mouseEvent.isSimulated())
+ m_clickLocation = IntPoint(mouseEvent.offsetX(), mouseEvent.offsetY());
+ }
+ }
+
element->form()->prepareForSubmission(event); // Event handlers can run.
element->setActivatedSubmit(false);
event->setDefaultHandled();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes