Index: third_party/WebKit/Source/devtools/front_end/ui/SuggestBox.js |
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/SuggestBox.js b/third_party/WebKit/Source/devtools/front_end/ui/SuggestBox.js |
index b6f69620a227bb71620e552c9f42645b27feb1cc..bf47f5aa99208b6b3b7ecf3b5519d332ba05a3e4 100644 |
--- a/third_party/WebKit/Source/devtools/front_end/ui/SuggestBox.js |
+++ b/third_party/WebKit/Source/devtools/front_end/ui/SuggestBox.js |
@@ -52,8 +52,9 @@ WebInspector.SuggestBoxDelegate.prototype = { |
* @constructor |
* @param {!WebInspector.SuggestBoxDelegate} suggestBoxDelegate |
* @param {number=} maxItemsHeight |
+ * @param {boolean=} captureEnter |
*/ |
-WebInspector.SuggestBox = function(suggestBoxDelegate, maxItemsHeight) |
+WebInspector.SuggestBox = function(suggestBoxDelegate, maxItemsHeight, captureEnter) |
{ |
this._suggestBoxDelegate = suggestBoxDelegate; |
this._length = 0; |
@@ -69,6 +70,8 @@ WebInspector.SuggestBox = function(suggestBoxDelegate, maxItemsHeight) |
this._asyncDetailsCallback = null; |
/** @type {!Map<number, !Promise<{detail: string, description: string}>>} */ |
this._asyncDetailsPromises = new Map(); |
+ this._userInteracted = false; |
+ this._captureEnter = captureEnter; |
} |
/** |
@@ -161,6 +164,7 @@ WebInspector.SuggestBox.prototype = { |
if (!this.visible()) |
return; |
+ this._userInteracted = false; |
this._bodyElement.removeEventListener("mousedown", this._maybeHideBound, true); |
delete this._bodyElement; |
this._container.remove(); |
@@ -222,6 +226,8 @@ WebInspector.SuggestBox.prototype = { |
if (!this._length) |
return false; |
+ this._userInteracted = true; |
+ |
if (this._selectedIndex === -1 && shift < 0) |
shift += 1; |
@@ -459,6 +465,9 @@ WebInspector.SuggestBox.prototype = { |
*/ |
enterKeyPressed: function() |
{ |
+ if (!this._userInteracted && this._captureEnter) |
+ return false; |
+ |
var hasSelectedItem = !!this._selectedElement || this._onlyCompletion; |
this.acceptSuggestion(); |