Bug 1514940 - part 1: Forcibly disable new keyCode/charCode value of keypress events if the document is Confluence r=smaug,Ehsan,kmag

Old Confluence does not aware of conflated model keypress event (see UI Events
spec, https://w3c.github.io/uievents/#determine-keypress-keyCode).
Additionally, Confluence can be hosted with any domains.  Therefore, we cannot
use blacklist to disable the conflated model keypress event only on it.

This patch checks whether current or parent document is Confluence with JS
module, called KeyPressEventModelCheckerChild.  For kicking this module,
nsHTMLDocument dispatches an custom event, CheckKeyPressEventModel, when it
becomes editable only first time.  Finally, if it's a Confluence instance, the
module let PresShell know that we need to use split model keypress event in it.

Differential Revision: https://phabricator.services.mozilla.com/D17907
This commit is contained in:
Masayuki Nakano
2019-02-05 11:35:43 +00:00
parent 8ef944ab85
commit 5133af6274
12 changed files with 274 additions and 2 deletions

View File

@@ -7811,7 +7811,7 @@ nsresult PresShell::EventHandler::DispatchEventToDOM(
nsContentUtils::IsURIInPrefList(
uri,
"dom.keyboardevent.keypress.hack.dispatch_non_printable_keys");
mPresShell->mForceUseLegacyKeyCodeAndCharCodeValues =
mPresShell->mForceUseLegacyKeyCodeAndCharCodeValues |=
nsContentUtils::IsURIInPrefList(uri,
"dom.keyboardevent.keypress.hack."
"use_legacy_keycode_and_charcode");