Bug 1627520 - Use keydown instead of keypress for autocomplete event listeners. r=mak,Gijs

This is so that we can avoid needing mozSystemGroup (to get keypress for
non-printable keys), which in turn prevents racing with the native key event
listeners, see the second patch in bug 1624657.

This turned out to be a bit tricky, because we need to guarantee the ordering of
the search one-offs handling in the searchbar with the usual autocomplete-input
handling. We could try to move this to the popup subclass but this is already a
bigger patch than what I'd like.

We can also revert the customElements.js change I did in bug 1624657, as the bug
is no longer relevant.

Differential Revision: https://phabricator.services.mozilla.com/D69743
This commit is contained in:
Emilio Cobos Álvarez
2020-04-14 20:48:26 +00:00
parent 62a0b5c197
commit 6869665d58
8 changed files with 66 additions and 141 deletions

View File

@@ -427,13 +427,9 @@ nsAutoCompleteController::HandleKeyNavigation(uint32_t aKey, bool* _retval) {
// the cursor to home/end on some systems
*_retval = true;
bool reverse = aKey == dom::KeyboardEvent_Binding::DOM_VK_UP ||
aKey == dom::KeyboardEvent_Binding::DOM_VK_PAGE_UP
? true
: false;
aKey == dom::KeyboardEvent_Binding::DOM_VK_PAGE_UP;
bool page = aKey == dom::KeyboardEvent_Binding::DOM_VK_PAGE_UP ||
aKey == dom::KeyboardEvent_Binding::DOM_VK_PAGE_DOWN
? true
: false;
aKey == dom::KeyboardEvent_Binding::DOM_VK_PAGE_DOWN;
// Fill in the value of the textbox with whatever is selected in the popup
// if the completeSelectedIndex attribute is set. We check this before