Add an API to get proper type of event target from `nsIFrame`
Categories
(Core :: DOM: UI Events & Focus Handling, task)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox153 | --- | fixed |
People
(Reporter: masayuki, Assigned: masayuki)
References
(Blocks 1 open bug)
Details
Attachments
(8 files)
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review |
Currently, nsIFrame::GetContentForEvent() return explicit event target if an event is handled by the frame. I.e., it may return a Text even if the given event should target an Element node. Some callers use the event target for such event as-is and the others retrieve an element by themselves (and some of them use wrong way). So, there should be a method like nsIFrame::GetEventTargetContent().
(Before the national holiday week in Japan, I have a spare time, so, I'm trying to fix this now.)
| Assignee | ||
Comment 1•1 month ago
|
||
Most event targets an element node even if the input occurs on a Text.
EventStateManager, PresShell, PresShell::EventHandler, etc use
the result of nsIFrame::GetContentForEvent result as-is or looking
for proper ancestor element by the caller selves.
So, I think there should be GetEventTargetContent() which solves the
target node kind automatically and in the same way. And also this patch
renames nsIFrame::GetContentForEvent to
nsIFrame::GetEventTargetExplicitContent for consistency with
Event::mExplicitOriginalTarget.
Finally, this patch changes the callers which retrieves a parent
Element if the result of GetContentForEvent is not an Element to
use the new GetEventTargetContent.
The following patches make each caller of GetContentForEvent marked
with "FIXME" comment fix one by one.
| Assignee | ||
Comment 2•1 month ago
|
||
| Assignee | ||
Comment 3•1 month ago
|
||
| Assignee | ||
Comment 4•1 month ago
|
||
| Assignee | ||
Comment 5•1 month ago
|
||
| Assignee | ||
Comment 6•1 month ago
|
||
| Assignee | ||
Comment 7•1 month ago
|
||
Updated•1 month ago
|
Updated•1 month ago
|
| Assignee | ||
Updated•1 month ago
|
Updated•25 days ago
|
| Assignee | ||
Comment 8•19 days ago
|
||
They have only GetExplicitEventTargetContent and some callers may want
to get proper target Element. Therefore, we should add them and the
common logic should be shared.
nsListControlFrame::GetIndexFromEvent looks for an inclusive ancestor
<option>. So, it can start the loop from its inclusive ancestor
element of the explicit event target so that it can use the new API.
Comment 10•13 days ago
|
||
Comment 11•13 days ago
|
||
Reverted this because it was causing build bustages in EventStateManager.cpp.
- Revert link
- Push with failures
- Failure Log
- Failure line: /builds/worker/checkouts/gecko/dom/events/EventStateManager.cpp:X:29: error: no member named 'GetContentForEvent' in 'nsIFrame'
Comment 13•13 days ago
|
||
Comment 14•13 days ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/0e6e677eb115
https://hg.mozilla.org/mozilla-central/rev/e18c8223c6f9
https://hg.mozilla.org/mozilla-central/rev/76df321a398a
https://hg.mozilla.org/mozilla-central/rev/160817eec313
https://hg.mozilla.org/mozilla-central/rev/3c53869e5ecf
https://hg.mozilla.org/mozilla-central/rev/121df849d148
https://hg.mozilla.org/mozilla-central/rev/d36e0da0472b
https://hg.mozilla.org/mozilla-central/rev/73f6fdd33abd
Description
•