[webkit-reviews] review granted: [Bug 125392] REGRESSION(r136280): input[type=image] should assume coords of 0, 0 when activated without physically clicking : [Attachment 218660] Merges the patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Dec 9 08:30:10 PST 2013


Darin Adler <darin at apple.com> has granted Ryosuke Niwa <rniwa at webkit.org>'s
request for review:
Bug 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

Attachment 218660: Merges the patch
https://bugs.webkit.org/attachment.cgi?id=218660&action=review

------- Additional Comments from Darin Adler <darin at apple.com>
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.


More information about the webkit-reviews mailing list