Bug 110004 - Selection doesn't change when clicked on an image element
Summary: Selection doesn't change when clicked on an image element
Alias: None
Product: WebKit
Classification: Unclassified
Component: UI Events (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
Depends on:
Reported: 2013-02-15 23:39 PST by nvineeth
Modified: 2019-02-06 21:04 PST (History)
9 users (show)

See Also:

test html page to reproduce the problem. (532 bytes, application/zip)
2013-02-15 23:41 PST, nvineeth
no flags Details
Patch for HTMLImageElement.cpp (389 bytes, patch)
2013-02-18 05:57 PST, Aneesh
rniwa: review-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description nvineeth 2013-02-15 23:39:21 PST
document.onselectionchange is not fired when we click on an img.
I have attached simple html page using which this is reproducible. 
Clicking anywhere in the <p> tag results in onselectionchange being called, but this not fired when clicked on the img.
Verified on Chrome 24 on Windows 7 and OSx 10.7 as well.
Comment 1 nvineeth 2013-02-15 23:41:39 PST
Created attachment 188696 [details]
test html page to reproduce the problem.
Comment 2 Aneesh 2013-02-18 05:55:40 PST
Returning 'true' from HTMLImageElement::CanStartSelection() will fix this issue.
Comment 3 Aneesh 2013-02-18 05:57:40 PST
Created attachment 188866 [details]
Patch for HTMLImageElement.cpp

Please review.
Comment 4 Ryosuke Niwa 2013-02-18 10:48:51 PST
This isn't about selectionchange event not being fired. It's just that WebKit doesn't move selection when clicked on an image element.

Given that this is also the behavior observed on Firefox and native applications like TextEdit, I don't think we should change our behavior.
Comment 5 Ryosuke Niwa 2013-02-18 10:50:20 PST
Comment on attachment 188866 [details]
Patch for HTMLImageElement.cpp

r- because the current behavior is desirable.
Comment 6 Tony Chang 2013-02-19 15:05:35 PST
It looks like this is an invalid bug report.

FWIW, I get the same behavior in Firefox as I do in WebKit, which makes me think that the existing behavior is correct.
Comment 7 Lucas Forschler 2019-02-06 09:19:14 PST
Mass move bugs into the DOM component.
Comment 8 Ryosuke Niwa 2019-02-06 21:04:39 PST
Another bug which belongs to UI Events.