From 3142f95469c26169a940297f1db6ed1fad5a25fe Mon Sep 17 00:00:00 2001 From: Moonchild Date: Mon, 17 Oct 2022 15:22:03 +0000 Subject: 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. --- extensions/spellcheck/src/mozInlineSpellChecker.cpp | 10 +++++----- 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) { nsCOMPtrkeyEvent = 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(); -- cgit v1.2.3