Chromium Code Reviews| Index: chrome/browser/resources/options/password_manager.js |
| diff --git a/chrome/browser/resources/options/password_manager.js b/chrome/browser/resources/options/password_manager.js |
| index 3e501727ff7b904a63df1d7a3843d10c35f21985..5dc463c9fb6d92f2b26cef2942d5c95c4db034ee 100644 |
| --- a/chrome/browser/resources/options/password_manager.js |
| +++ b/chrome/browser/resources/options/password_manager.js |
| @@ -165,6 +165,29 @@ cr.define('options', function() { |
| }, |
| /** |
| + * Updates eliding of origins. If there is no enough space to show the full |
| + * origin, the origin is elided from the left with ellipsis. |
| + * @param {!cr.ui.List} list The list to update eliding. |
| + */ |
| + updateOriginsEliding_: function(list) { |
| + var entries = list.getElementsByClassName('deletable-item'); |
| + if (entries.length == 0) |
| + return; |
| + var entry = entries[0]; |
| + var columnWidth = entry.urlDiv.offsetWidth - |
| + parseInt(window.getComputedStyle(entry.urlDiv).webkitMarginStart) - |
| + parseInt(window.getComputedStyle(entry.urlDiv).webkitPaddingStart); |
|
Evan Stade
2016/03/21 21:59:02
nit: store getComputedStyle in a var?
kolos1
2016/03/22 19:10:24
Done.
|
| + for (var i = 0; i < entries.length; ++i) { |
| + var urlLink = entries[i].urlLink; |
| + if (urlLink.offsetWidth <= columnWidth) |
| + continue; |
| + urlLink.textContent = '…' + urlLink.textContent.substring(1); |
| + while (urlLink.offsetWidth > columnWidth) |
| + urlLink.textContent = '…' + urlLink.textContent.substring(2); |
|
Evan Stade
2016/03/21 21:59:02
I kinda liked the idea of skipping ahead to the ne
kolos1
2016/03/22 19:10:24
I asked UI team about this. They recommend to show
|
| + } |
| + }, |
| + |
| + /** |
| * Updates the data model for the saved passwords list with the values from |
| * |entries|. |
| * @param {!Array} entries The list of saved password data. |
| @@ -190,6 +213,7 @@ cr.define('options', function() { |
| entries = entries.filter(filter); |
| } |
| this.savedPasswordsList_.dataModel = new ArrayDataModel(entries); |
| + this.updateOriginsEliding_(this.savedPasswordsList_); |
| this.updateListVisibility_(this.savedPasswordsList_); |
| }, |
| @@ -200,6 +224,7 @@ cr.define('options', function() { |
| */ |
| setPasswordExceptionsList_: function(entries) { |
| this.passwordExceptionsList_.dataModel = new ArrayDataModel(entries); |
| + this.updateOriginsEliding_(this.passwordExceptionsList_); |
| this.updateListVisibility_(this.passwordExceptionsList_); |
| }, |