Commit 03da338e authored by einbinder's avatar einbinder Committed by Commit bot

DevTools: Take subtitle into account when finding largest suggestion

BUG=none

Review-Url: https://codereview.chromium.org/2616743004
Cr-Commit-Position: refs/heads/master@{#441837}
parent 815e3536
...@@ -134,12 +134,20 @@ UI.SuggestBox = class { ...@@ -134,12 +134,20 @@ UI.SuggestBox = class {
if (!items.length) if (!items.length)
return; return;
// If there are no scrollbars, set the width to the width of the largest row. // If there are no scrollbars, set the width to the width of the largest row.
var maxItem = items[0]; var maxItem;
for (var i = 1; i < items.length; i++) { var maxLength = -Infinity;
if (items[i].title.length > maxItem.title.length) for (var i = 0; i < items.length; i++) {
var length = items[i].title.length + (items[i].subtitle || '').length;
if (length > maxLength) {
maxLength = length;
maxItem = items[i]; maxItem = items[i];
}
} }
this._element.style.width = UI.measurePreferredSize(this.createElementForItem(maxItem), this._element).width + 'px'; this._element.style.width =
UI.measurePreferredSize(
this.createElementForItem(/** @type {!UI.SuggestBox.Suggestion} */ (maxItem)), this._element)
.width +
'px';
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment