RESOLVED FIXED 125392
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
Summary REGRESSION(r136280): input[type=image] should assume coords of 0,0 when activ...
Ryosuke Niwa
Reported 2013-12-07 11:52:34 PST
Activating an image button with the keyboard or element.click() should result in selected coords of (0,0). This is consistent with the spec and IE and Firefox. The relevant spec is: "If the user activates the control without explicitly selecting a coordinate, then the coordinate (0,0) must be assumed." http://www.whatwg.org/specs/web-apps/current-work/multipage/states-of-the-type-attribute.html#image-button-state-(type=image) https://code.google.com/p/chromium/issues/detail?id=306392
Attachments
Merges the patch (5.99 KB, patch)
2013-12-07 12:10 PST, Ryosuke Niwa
darin: review+
Ryosuke Niwa
Comment 1 2013-12-07 12:10:05 PST
Created attachment 218660 [details] Merges the patch
Darin Adler
Comment 2 2013-12-09 08:28:25 PST
Comment on attachment 218660 [details] Merges the patch View in context: https://bugs.webkit.org/attachment.cgi?id=218660&action=review > Source/WebCore/html/ImageInputType.cpp:96 > +static IntPoint clickLocationForEvent(Event& event) > +{ > + if (!event.underlyingEvent()) > + return IntPoint(); > + > + Event& underlyingEvent = *event.underlyingEvent(); > + if (!underlyingEvent.isMouseEvent()) > + return IntPoint(); > + > + MouseEvent& mouseEvent = toMouseEvent(underlyingEvent); > + if (mouseEvent.isSimulated()) > + return IntPoint(); > + > + return IntPoint(mouseEvent.offsetX(), mouseEvent.offsetY()); > +} This is not a very good standalone function. The function relies on the fact that the event passed to it is not itself a mouse event, and instead goes right at the underlying event. A general purpose function would want to handle the case where the event itself was a mouse event, and also arguably needs a loop that keeps following underlyingEvent pointers until it finds a mouse event. I understand the desire to make ImageInputType::handleDOMActivateEvent more elegant by factoring out the code, but the code was specific to DOM activate in a subtle way.
Ryosuke Niwa
Comment 3 2013-12-09 15:41:15 PST
Note You need to log in before you can comment on or make changes to this bug.