github web-platform-tests/wpt merge_pr_47804

latest releases: merge_pr_49470, epochs/three_hourly/2024-12-03_06H, epochs/six_hourly/2024-12-03_06H...
4 months ago

Make IMEContentObserver observe ParentChainChanged and let IMEStateManager know that

mozAutoDocUpdate does not make it in a document change when container node
of insertBefore has already been removed from the tree. Therefore, once
IMEContentObserver::mRootElement is removed from the DOM tree without a
focus move, IMEContentObserver is notified mutations not in a document change.

Similar situations are handled in IMEStateManager::OnRemoveContent with
emulating a focus change and that will destroy the active IMEContentObserver.
Therefore, if IMEContentObserver::mRootElement is removed, we should emulate
a focus move when IMEStateManager does not have focused element but there
is active IMEContentObserver (that means it is/was in the design mode).

However, checking whether the removed node contains the observing node of the
active IMEContentObserver may be expensive. So, doing expensive things in
IMEStateManager::OnRemoveContent may make mutations slower. Therefore, this
patch makes IMEContentObserver observe ParentChainChanged and it let
IMEStateManager know that with calling its
OnParentChainChangedOfObservingElement. Finally, it calls
IMEStateManager::OnRemoveContent to emulate "blur" (and refocus if it's
required).

Differential Revision: https://phabricator.services.mozilla.com/D218696

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1911010
gecko-commit: 94b450b0b48767bdd10d69d952ac942a8f9a6168
gecko-reviewers: smaug

Don't miss a new wpt release

NewReleases is sending notifications on new releases.