ContentCacheInChild shouldn't stop caching text content etc when there is no selection
Categories
(Core :: DOM: UI Events & Focus Handling, defect, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox99 | --- | fixed |
People
(Reporter: masayuki, Assigned: masayuki)
References
(Blocks 2 open bugs)
Details
(Keywords: inputmethod)
Attachments
(29 files)
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details |
There can be no selection (e.g., when Selection.removeAllRanges()
is called). Therefore, ContentCacheInChild
shouldn't stop handling to cache the content in the case.
Assignee | ||
Comment 1•3 years ago
|
||
Assignee | ||
Comment 2•3 years ago
|
||
Selection.removeAllRanges
can make there is no selection ranges. Therefore,
TSFTextStore::Selection
needs to represent the state. This patch changes its
mACP
to Maybe<TS_SELECTION_ACP>
for making Nothing
of it mean no
selection ranges. Then, GetSelection
will return TS_E_NOSELECTION
and
InsertTextAtSelection
will return "no change" if it's called for emulation.
According to Chromium:
https://source.chromium.org/chromium/chromium/src/+/main:ui/base/ime/win/tsf_text_store_unittest.cc
They don't check this case's behavior, and it seems that they ignore selection
change at removeAllRanges
:
https://source.chromium.org/chromium/chromium/src/+/main:ui/base/ime/win/tsf_text_store.cc;l=1153;drc=d50b5b8a78d3d4878c98b07af006a00ed65fddd0
or fill cached selection with collapsed at invalid position (UINT32_MAX
).
https://source.chromium.org/chromium/chromium/src/+/main:ui/base/ime/win/tsf_text_store.cc;l=1238;drc=d50b5b8a78d3d4878c98b07af006a00ed65fddd0
So anyway, we don't have better handling in the case.
Depends on D137404
Assignee | ||
Comment 3•3 years ago
|
||
It needs to have a state whether it's set or unset, and whether there is at
least one selection range or no selection range. Currently, its valid state
represents both of them, but it'll has no selection state in the following
patches. Therefore, the former state should be manged with Maybe
.
Depends on D137405
Assignee | ||
Comment 4•3 years ago
|
||
Most change has already been done in part 1-2. This patch does the remaining
work.
Depends on D137406
Assignee | ||
Comment 5•3 years ago
|
||
Depends on D137407
Assignee | ||
Comment 6•3 years ago
|
||
Depends on D137408
Assignee | ||
Comment 7•3 years ago
|
||
Depends on D137409
Assignee | ||
Comment 8•3 years ago
|
||
I'd like to use OffsetAndData
in IMMHandler
to store selection range.
Before doing this, this patch adds some useful methods into it.
Depends on D137410
Assignee | ||
Comment 9•3 years ago
|
||
For making it simpler and have "no selection" state, this patch rewrites it
with OffsetAndData<uint32_t>
wrapped with Maybe
. Although IMMHandler
does nothing if there is no selection.
Depends on D137411
Assignee | ||
Comment 10•3 years ago
|
||
With wrapping IMMHandler::mSelection
with Maybe
, we can represent there is
no unexpected cases, but there is no selection.
Depends on D137412
Assignee | ||
Comment 11•3 years ago
|
||
It's always overwritten with same value so that it is not necessary at least for
now and on Windows, we just do not update it in same situation. Therefore,
we should drop it until we become need to use it.
Depends on D137413
Assignee | ||
Comment 12•3 years ago
|
||
Depends on D137414
Assignee | ||
Comment 13•3 years ago
|
||
Depends on D137415
Assignee | ||
Comment 14•3 years ago
|
||
Depends on D137416
Assignee | ||
Comment 15•3 years ago
|
||
Depends on D137417
Assignee | ||
Comment 16•3 years ago
|
||
For consistency with IMMHandler::Selection
, let's make it use
OffsetAndData<uint32_t>
for preparing them to use a new common class.
Depends on D137418
Assignee | ||
Comment 17•3 years ago
|
||
Perhaps, we should disable IME when DOM Selection does not have range. However,
it's out of scope of this bug. This patch makes IMContextWrapper
try to
keep working with no selection range except at "compositionstart".
Depends on D137419
Assignee | ||
Comment 18•3 years ago
|
||
Now, IMContextWrapper::Selection
and IMMHandler::Selection
have same
structure. Therefore, we can merge them into one place. This will help to
fix bug 1259690 in the future.
Depends on D137420
Assignee | ||
Comment 19•3 years ago
|
||
It's intended to indicate whether the selection is collapsed or not, but it can
be referred by other members, there is no reasonable user and the name makes
developers confused.
Depends on D137421
Assignee | ||
Comment 20•3 years ago
|
||
Depends on D137422
Assignee | ||
Comment 21•3 years ago
|
||
Unfortunately, it cannot has Maybe
because of used by a union. Therefore,
it needs to manage with bool
members of whether it's initialized with or
without error and whether it has a range.
Note that this changes nsITextInputProcessorCallback.idl
which is currently
only for automated tests too. The new behavior will be tested by the last
patch in this bug.
Depends on D137423
Assignee | ||
Comment 22•3 years ago
|
||
Depends on D137424
Assignee | ||
Comment 23•3 years ago
|
||
Depends on D137425
Assignee | ||
Comment 24•3 years ago
|
||
StartOffset
and EndOffset
of IMENotification::SelectionChangeDataBase
depend on whether the range is reversed or not. Therefore, their actual
meaning is "anchor offset" and "focus offset" in the DOM selection terms.
Similarly, SelectionStartOffset
and SelectionEndOffset
of
WidgetQueryContentEvent::Reply
are exactly same ones.
Therefore, they should be renamed to AnchorOffset
and FocusOffset
for
making what they return clearer.
Depends on D137426
Assignee | ||
Comment 25•3 years ago
|
||
Depends on D137427
Assignee | ||
Comment 26•3 years ago
|
||
For managing the state of text content cache independent from selection, it
should be wrapped with Maybe
.
Depends on D137428
Assignee | ||
Comment 27•3 years ago
|
||
Even after applying this patch, it still returns error when queried with a
relative offset from selection and only when there is no composition string.
However, this shouldn't cause any problem because in this case, widget should
not try to query content with relative offset.
Depends on D137429
Assignee | ||
Comment 28•3 years ago
|
||
Currently, mSelection
is cached only when mText
is some, text rects are
cached only when mSelection
is cached. However, as far as widget can work
with IME, it should cache content as far as possible. Therefore, this patch
makes it keep querying content data even after something fails.
Depends on D137430
Assignee | ||
Comment 29•3 years ago
|
||
Finally, making WidgetQueryContentEvent::Succeeded
return true
when there
is no selection when its message is eQuerySelectedText
, and making
ContentEventHandler::OnQuerySelectedText
set the no selection range data even
when the queried selection type is "normal. Then, all things which are
changed by the previous patches start to work.
And this patch adds a simple test for ContentCache
and update tests of
nsITextInputProcessor
.
Depends on D137431
Comment 30•3 years ago
|
||
Comment 31•3 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/14e68c94b303
https://hg.mozilla.org/mozilla-central/rev/ff44b008f146
https://hg.mozilla.org/mozilla-central/rev/1971c9f47541
https://hg.mozilla.org/mozilla-central/rev/1dc1117af560
https://hg.mozilla.org/mozilla-central/rev/60724af309c9
https://hg.mozilla.org/mozilla-central/rev/8435cab898aa
https://hg.mozilla.org/mozilla-central/rev/13d7ba297d37
https://hg.mozilla.org/mozilla-central/rev/46dfc3a53efb
https://hg.mozilla.org/mozilla-central/rev/2a959b3c8938
https://hg.mozilla.org/mozilla-central/rev/670aeb65b5d7
https://hg.mozilla.org/mozilla-central/rev/8ce50cd6760e
https://hg.mozilla.org/mozilla-central/rev/76e3c19c0d4f
https://hg.mozilla.org/mozilla-central/rev/23a249b011f8
https://hg.mozilla.org/mozilla-central/rev/63e8e1bc2799
https://hg.mozilla.org/mozilla-central/rev/7642d525be8e
https://hg.mozilla.org/mozilla-central/rev/d3fdb943d696
https://hg.mozilla.org/mozilla-central/rev/432291215383
https://hg.mozilla.org/mozilla-central/rev/dc81d96d0adb
https://hg.mozilla.org/mozilla-central/rev/5f90ad3d8781
https://hg.mozilla.org/mozilla-central/rev/5cd908f74145
https://hg.mozilla.org/mozilla-central/rev/fa7bd59d3ed6
https://hg.mozilla.org/mozilla-central/rev/0d81c2841c4d
https://hg.mozilla.org/mozilla-central/rev/4eb5dc745ee8
https://hg.mozilla.org/mozilla-central/rev/2529c39ed6bf
https://hg.mozilla.org/mozilla-central/rev/88cd68e70502
https://hg.mozilla.org/mozilla-central/rev/4fe6068164c1
https://hg.mozilla.org/mozilla-central/rev/7d1d1864b99b
https://hg.mozilla.org/mozilla-central/rev/989ad9507a0c
https://hg.mozilla.org/mozilla-central/rev/3f6deedb2ffa
Description
•