Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(669)

Unified Diff: third_party/WebKit/Source/devtools/front_end/ui/SuggestBox.js

Issue 1820393002: DevTools: [ux regression] There is no way to clear console history. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 f1cb273a04e6bfcb8967297353f16a2bb62884a5..188772dbbc5974576d079f225e93812753abb8e0 100644
--- a/third_party/WebKit/Source/devtools/front_end/ui/SuggestBox.js
+++ b/third_party/WebKit/Source/devtools/front_end/ui/SuggestBox.js
@@ -71,6 +71,11 @@ WebInspector.SuggestBox = function(suggestBoxDelegate, maxItemsHeight)
this._asyncDetailsPromises = new Map();
}
+/**
+ * @typedef Array.<{title: string, className: (string|undefined)}>
+ */
+WebInspector.SuggestBox.Suggestions;
+
WebInspector.SuggestBox.prototype = {
/**
* @return {boolean}
@@ -240,11 +245,12 @@ WebInspector.SuggestBox.prototype = {
/**
* @param {string} prefix
* @param {string} text
+ * @param {string|undefined} className
* @param {number} index
*/
- _createItemElement: function(prefix, text, index)
+ _createItemElement: function(prefix, text, className, index)
{
- var element = createElementWithClass("div", "suggest-box-content-item source-code");
+ var element = createElementWithClass("div", "suggest-box-content-item source-code " + (className || ""));
element.tabIndex = -1;
if (prefix && prefix.length && !text.indexOf(prefix)) {
element.createChild("span", "prefix").textContent = prefix;
@@ -259,7 +265,7 @@ WebInspector.SuggestBox.prototype = {
},
/**
- * @param {!Array.<string>} items
+ * @param {!WebInspector.SuggestBox.Suggestions} items
* @param {string} userEnteredText
* @param {function(number): !Promise<{detail:string, description:string}>=} asyncDetails
*/
@@ -273,7 +279,7 @@ WebInspector.SuggestBox.prototype = {
for (var i = 0; i < items.length; ++i) {
var item = items[i];
- var currentItemElement = this._createItemElement(userEnteredText, item, i);
+ var currentItemElement = this._createItemElement(userEnteredText, item.title, item.className, i);
this._element.appendChild(currentItemElement);
}
},
@@ -338,7 +344,7 @@ WebInspector.SuggestBox.prototype = {
},
/**
- * @param {!Array.<string>} completions
+ * @param {!WebInspector.SuggestBox.Suggestions} completions
* @param {boolean} canShowForSingleItem
* @param {string} userEnteredText
*/
@@ -351,7 +357,7 @@ WebInspector.SuggestBox.prototype = {
return true;
// Do not show a single suggestion if it is the same as user-entered prefix, even if allowed to show single-item suggest boxes.
- return canShowForSingleItem && completions[0] !== userEnteredText;
+ return canShowForSingleItem && completions[0].title !== userEnteredText;
},
_ensureRowCountPerViewport: function()
@@ -366,7 +372,7 @@ WebInspector.SuggestBox.prototype = {
/**
* @param {!AnchorBox} anchorBox
- * @param {!Array.<string>} completions
+ * @param {!WebInspector.SuggestBox.Suggestions} completions
* @param {number} selectedIndex
* @param {boolean} canShowForSingleItem
* @param {string} userEnteredText

Powered by Google App Engine
This is Rietveld 408576698