зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1583766 - Consider `IMEContentObserver` to send selection change notification when its sender sends a text change notification r=m_kato
The previous change is wrong because the sender shouldn't send selection change notification if `IMEContentObserver` does not receive text change notifications nor selection change notifications. This patch reverts the change in the if block of previous change and instead sets `IMEContentObserver::mNeedsToNotifyIMEOfSelectionChange` to `true` if the sender sends a text change notification. (Note that even if there is another text change with a mutation event listener, we need to send selection change notification later so that this must be the right approach.) Differential Revision: https://phabricator.services.mozilla.com/D47564 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
c16fe33b0e
Коммит
b3450ef1e7
|
@ -1680,24 +1680,27 @@ IMEContentObserver::IMENotificationSender::Run() {
|
|||
if (observer->mNeedsToNotifyIMEOfTextChange) {
|
||||
observer->mNeedsToNotifyIMEOfTextChange = false;
|
||||
SendTextChange();
|
||||
// Even if the observer hasn't received selection change, let's try to send
|
||||
// selection change notification to IME because selection start offset may
|
||||
// be changed if the previous contents of selection start are changed. For
|
||||
// example, when previous `<p>` element of another `<p>` element which
|
||||
// contains caret is removed by a DOM mutation, selection change event
|
||||
// won't be fired, but selection start offset should be decreased by the
|
||||
// length of removed `<p>` element.
|
||||
observer->mNeedsToNotifyIMEOfSelectionChange = true;
|
||||
}
|
||||
|
||||
// If a text change notification causes another text change again, we should
|
||||
// notify IME of that before sending a selection change notification.
|
||||
// Otherwise, even if the observer hasn't received selection change, let's
|
||||
// try to send selection change notification to IME because selection
|
||||
// start offset may be changed if the previous contents of selection start
|
||||
// are changed. For example, when previous `<p>` element of another `<p>`
|
||||
// element which contains caret is removed by a DOM mutation, selection
|
||||
// change event won't be fired, but selection start offset should be
|
||||
// decreased by the length of removed `<p>` element.
|
||||
if (!observer->mNeedsToNotifyIMEOfTextChange) {
|
||||
// Be aware, PuppetWidget depends on the order of this. A selection change
|
||||
// notification should not be sent before a text change notification because
|
||||
// PuppetWidget shouldn't query new text content every selection change.
|
||||
if (observer->mNeedsToNotifyIMEOfSelectionChange) {
|
||||
observer->mNeedsToNotifyIMEOfSelectionChange = false;
|
||||
SendSelectionChange();
|
||||
}
|
||||
}
|
||||
|
||||
// If a text change notification causes another text change again or a
|
||||
// selection change notification causes either a text change or another
|
||||
|
|
Загрузка…
Ссылка в новой задаче