[Input Events] Implement InputEvent.getTargetRanges()
Categories
(Core :: DOM: Events, enhancement, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox75 | --- | fixed |
People
(Reporter: masayuki, Assigned: masayuki)
References
Details
Attachments
(4 files)
Assignee | ||
Updated•7 years ago
|
Updated•7 years ago
|
Assignee | ||
Comment 1•5 years ago
|
||
When I finish my current draft patches for improving mochitest's DnD API and related editor bugs, I'll start to work on this feature.
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Comment 2•5 years ago
|
||
As far as my investigation, we need a lot of risky patches to compute delete ranges which are currently computed at handling deletion. Both Chrome and Safari does not update Selection
before dispatching beforeinput
event so that InputEvent.getTargetRanges()
is the only way to check affected ranges of the input, but on the other hand, the range can guess with InputEvent.inputType
value and this API may be used for feature detection of beforeinput
event. Therefore, for QA team, we should implement this behind a pref without supporting the deletion ranges for now.
Assignee | ||
Comment 3•5 years ago
|
||
InputEvent.getTargetRanges()
can be used only when event type is
beforeinput
. So, it may be used for feature detection of beforeinput
event because Chrome does not implement onbeforeinput
event handler attribute.
Therefore, this patch makes it behind the pref for beforeinput
event.
Assignee | ||
Comment 4•5 years ago
|
||
InputEventOptions
should be able to take target ranges for beforeinput
event. However, it requires to include StaticRange.h
from nsContentUtils.h
even though most nsContentUtils.h
users don't need it. Therefore, this patch
moves it from nsContentUtils.h
to new header file.
And makes nsContentUtils::DispatchInputEvent()
moves the target ranges
from InputEventOptions
to InternalEditorInputEvent
.
Depends on D64728
Assignee | ||
Comment 5•5 years ago
|
||
In most cases, InputEvent.getTargetRange()
of beforeinput
event should
return Selection
ranges at dispatching the event.
This patch also handles special cases.
- composition change - target range should be the previous composition string
which will be replaced with new composition string. - replace text - target range should be the replace range. This is used by
spellchecker. - drop - target range should be the drop point.
However, the other exception is not handled by this patch. That is, deletions.
The target range(s) should be the range(s) which will be removed. In most
cases, they also matches selection ranges, but may be extended to:
- surrogate pair boundary
- grapheme cluster boundary like complex emoji
- word/line deletion deletion
Backspace
orDelete
from collapsed selection- to end of unnecessary whitespaces
For supporting these cases, we need to separate
HTMLEditor::HandleDeleteSelection()
and its helper methods and helper class
to range computation part and modifying the DOM tree part. Of course, it
requires big changes and InputEvent.getTargetRanges()
may be important for
feature detection of beforeinput
event so that we should put off the big
changes to bug 1618457.
Depends on D64729
Assignee | ||
Comment 6•5 years ago
|
||
Depends on D64730
Comment 8•5 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/bfae77db32fd
https://hg.mozilla.org/mozilla-central/rev/e77fd55d3323
https://hg.mozilla.org/mozilla-central/rev/834d5dc1be09
https://hg.mozilla.org/mozilla-central/rev/a01464b76591
Updated•5 years ago
|
Description
•