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
Created attachment 218660 [details] Merges the patch
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.
Committed r160337: <http://trac.webkit.org/changeset/160337>