Bug 1178967 - Collapse autocomplete popup when pressing Home/En. r=jdescottes
authorRicky Chien <ricky060709@gmail.com>
Tue, 24 May 2016 18:33:00 +0800
changeset 338096 f5ce758ba0fdf72adcc8637be3206d524872040e
parent 338095 9afab6308cd97d470c6514ccb0e348103e034e4d
child 338097 9cfc40ea2dbd0e258ec58028d85f4b358162e64a
push id6249
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 13:59:36 +0000
treeherdermozilla-beta@bad9d4f5bf7e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdescottes
bugs1178967
milestone49.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1178967 - Collapse autocomplete popup when pressing Home/En. r=jdescottes MozReview-Commit-ID: GqF75PItgf5
devtools/client/inspector/rules/test/browser_rules_completion-existing-property_01.js
devtools/client/shared/inplace-editor.js
--- a/devtools/client/inspector/rules/test/browser_rules_completion-existing-property_01.js
+++ b/devtools/client/inspector/rules/test/browser_rules_completion-existing-property_01.js
@@ -38,16 +38,29 @@ var testData = [
   ["VK_BACK_SPACE", "dis", -1, 0],
   ["VK_BACK_SPACE", "di", -1, 0],
   ["VK_BACK_SPACE", "d", -1, 0],
   ["VK_BACK_SPACE", "", -1, 0],
   ["VK_HOME", "", -1, 0],
   ["VK_END", "", -1, 0],
   ["VK_PAGE_UP", "", -1, 0],
   ["VK_PAGE_DOWN", "", -1, 0],
+  ["d", "display", 1, 3],
+  ["VK_HOME", "display", -1, 0],
+  ["VK_END", "display", -1, 0],
+  // Press right key to ensure caret move to end of the input on Mac OS since
+  // Mac OS doesn't move caret after pressing HOME / END.
+  ["VK_RIGHT", "display", -1, 0],
+  ["VK_BACK_SPACE", "displa", -1, 0],
+  ["VK_BACK_SPACE", "displ", -1, 0],
+  ["VK_BACK_SPACE", "disp", -1, 0],
+  ["VK_BACK_SPACE", "dis", -1, 0],
+  ["VK_BACK_SPACE", "di", -1, 0],
+  ["VK_BACK_SPACE", "d", -1, 0],
+  ["VK_BACK_SPACE", "", -1, 0],
   ["f", "font-size", 19, 32],
   ["i", "filter", 3, 4],
   ["VK_LEFT", "filter", -1, 0],
   ["VK_LEFT", "filter", -1, 0],
   ["i", "fiilter", -1, 0],
   ["VK_ESCAPE", null, -1, 0],
 ];
 
--- a/devtools/client/shared/inplace-editor.js
+++ b/devtools/client/shared/inplace-editor.js
@@ -1045,17 +1045,17 @@ InplaceEditor.prototype = {
     let isPlainText = this.contentType == CONTENT_TYPES.PLAIN_TEXT;
     let isPopupOpen = this.popup && this.popup.isOpen;
 
     let increment = 0;
     if (!isPlainText && !multilineNavigation) {
       increment = this._getIncrement(event);
     }
 
-    if (isKeyIn(key, "HOME", "END", "PAGE_UP", "PAGE_DOWN")) {
+    if (isKeyIn(key, "PAGE_UP", "PAGE_DOWN")) {
       this._preventSuggestions = true;
     }
 
     let cycling = false;
     if (increment && this._incrementValue(increment)) {
       this._updateSize();
       prevent = true;
       cycling = true;
@@ -1063,17 +1063,17 @@ InplaceEditor.prototype = {
 
     if (isPopupOpen && isKeyIn(key, "UP", "DOWN", "PAGE_UP", "PAGE_DOWN")) {
       prevent = true;
       cycling = true;
       this._cycleCSSSuggestion(isKeyIn(key, "UP", "PAGE_UP"));
       this._doValidation();
     }
 
-    if (isKeyIn(key, "BACK_SPACE", "DELETE", "LEFT", "RIGHT")) {
+    if (isKeyIn(key, "BACK_SPACE", "DELETE", "LEFT", "RIGHT", "HOME", "END")) {
       if (isPopupOpen) {
         this._hideAutocompletePopup();
       }
     } else if (!cycling && !multilineNavigation &&
       !event.metaKey && !event.altKey && !event.ctrlKey) {
       this._maybeSuggestCompletion(true);
     }