From 9b5274c23b002239da578d800d01a6e1ee298dd8 Mon Sep 17 00:00:00 2001 From: Magnus Melin Date: Fri, 27 Jun 2014 21:17:43 +0300 Subject: [PATCH] Bug 1012398 - Completion doesn't take capitalization from address book entry. Also fixes bug 1009469. r=Enn --- toolkit/content/tests/chrome/test_autocomplete4.xul | 10 ++++++++++ toolkit/content/widgets/autocomplete.xml | 2 ++ 2 files changed, 12 insertions(+) diff --git a/toolkit/content/tests/chrome/test_autocomplete4.xul b/toolkit/content/tests/chrome/test_autocomplete4.xul index cbd2adf7cab4..db520331807b 100644 --- a/toolkit/content/tests/chrome/test_autocomplete4.xul +++ b/toolkit/content/tests/chrome/test_autocomplete4.xul @@ -13,6 +13,7 @@ @@ -143,6 +144,13 @@ const tests = [ result: "Result", start: 6, end: 6 }, + { desc: "TAB key should confirm suggestion when forcecomplete is set", + key: "VK_TAB", + removeSelection: false, + forceComplete: true, + result: "Result", + start: 6, end: 6 + }, ]; function nextTest() { @@ -181,6 +189,8 @@ function searchComplete() { is(autocomplete.value, "result", "Test '" + currentTest.desc + "': autocomplete.value should equal 'result'"); + autocomplete.setAttribute("forcecomplete", currentTest.forceComplete ? true : false); + if (autocomplete.selectionStart == 2) { // Finished inserting "re" string. if (currentTest.removeSelection) { // remove current selection diff --git a/toolkit/content/widgets/autocomplete.xml b/toolkit/content/widgets/autocomplete.xml index d12c55b92487..c88b6d30a802 100644 --- a/toolkit/content/widgets/autocomplete.xml +++ b/toolkit/content/widgets/autocomplete.xml @@ -464,6 +464,8 @@ cancel = this.mController.handleKeyNavigation(aEvent.shiftKey ? KeyEvent.DOM_VK_UP : KeyEvent.DOM_VK_DOWN); + else if (this.forceComplete && this.mController.matchCount >= 1) + this.mController.handleTab(); break; case KeyEvent.DOM_VK_UP: case KeyEvent.DOM_VK_DOWN: