diff options
author | Moonchild <moonchild@palemoon.org> | 2022-10-17 15:22:03 +0000 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2022-10-17 15:22:03 +0000 |
commit | 3142f95469c26169a940297f1db6ed1fad5a25fe (patch) | |
tree | 4380ba5fec39b2b57d350dcbb96fc24f8035dd44 | |
parent | 74b3ce90d73f576a36888c06e413b99b61687b80 (diff) | |
download | uxp-3142f95469c26169a940297f1db6ed1fad5a25fe.tar.gz |
Issue #2019 - Follow-up: Adjust content spellchecker to use keydown
Since keypress is no longer triggered on all keypresses in content,
the spellchecker would potentially not be triggered when it should be.
This changes the trigger to keydown, instead.
No behavioral changes otherwise.
-rw-r--r-- | extensions/spellcheck/src/mozInlineSpellChecker.cpp | 10 | ||||
-rw-r--r-- | extensions/spellcheck/src/mozInlineSpellChecker.h | 2 |
2 files changed, 6 insertions, 6 deletions
diff --git a/extensions/spellcheck/src/mozInlineSpellChecker.cpp b/extensions/spellcheck/src/mozInlineSpellChecker.cpp index 6ca17885da..37898c818e 100644 --- a/extensions/spellcheck/src/mozInlineSpellChecker.cpp +++ b/extensions/spellcheck/src/mozInlineSpellChecker.cpp @@ -714,7 +714,7 @@ mozInlineSpellChecker::RegisterEventListeners() true, false); piTarget->AddEventListener(NS_LITERAL_STRING("click"), this, false, false); - piTarget->AddEventListener(NS_LITERAL_STRING("keypress"), this, + piTarget->AddEventListener(NS_LITERAL_STRING("keydown"), this, false, false); return NS_OK; } @@ -738,7 +738,7 @@ mozInlineSpellChecker::UnregisterEventListeners() piTarget->RemoveEventListener(NS_LITERAL_STRING("blur"), this, true); piTarget->RemoveEventListener(NS_LITERAL_STRING("click"), this, false); - piTarget->RemoveEventListener(NS_LITERAL_STRING("keypress"), this, false); + piTarget->RemoveEventListener(NS_LITERAL_STRING("keydown"), this, false); return NS_OK; } @@ -1916,8 +1916,8 @@ NS_IMETHODIMP mozInlineSpellChecker::HandleEvent(nsIDOMEvent* aEvent) if (eventType.EqualsLiteral("click")) { return MouseClick(aEvent); } - if (eventType.EqualsLiteral("keypress")) { - return KeyPress(aEvent); + if (eventType.EqualsLiteral("keydown")) { + return KeyDown(aEvent); } return NS_OK; @@ -1943,7 +1943,7 @@ nsresult mozInlineSpellChecker::MouseClick(nsIDOMEvent *aMouseEvent) return NS_OK; } -nsresult mozInlineSpellChecker::KeyPress(nsIDOMEvent* aKeyEvent) +nsresult mozInlineSpellChecker::KeyDown(nsIDOMEvent* aKeyEvent) { nsCOMPtr<nsIDOMKeyEvent>keyEvent = do_QueryInterface(aKeyEvent); NS_ENSURE_TRUE(keyEvent, NS_OK); diff --git a/extensions/spellcheck/src/mozInlineSpellChecker.h b/extensions/spellcheck/src/mozInlineSpellChecker.h index 52261f22be..251b5f6f27 100644 --- a/extensions/spellcheck/src/mozInlineSpellChecker.h +++ b/extensions/spellcheck/src/mozInlineSpellChecker.h @@ -197,7 +197,7 @@ public: nsresult Blur(nsIDOMEvent* aEvent); nsresult MouseClick(nsIDOMEvent* aMouseEvent); - nsresult KeyPress(nsIDOMEvent* aKeyEvent); + nsresult KeyDown(nsIDOMEvent* aKeyEvent); mozInlineSpellChecker(); |