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

Unified Diff: chrome/browser/resources/options/password_manager.js

Issue 1817053002: [Password Manager] Changes implementation of left elided origin on chrome://settings/passwords (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cache computed style. Skip eliding for Android credentials. 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
« no previous file with comments | « no previous file | chrome/browser/resources/options/password_manager_list.css » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..f5bfb01ee192509520a3bf034737ff02e70d7612 100644
--- a/chrome/browser/resources/options/password_manager.js
+++ b/chrome/browser/resources/options/password_manager.js
@@ -165,6 +165,30 @@ 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 computedStyle = window.getComputedStyle(entry.urlDiv);
+ var columnWidth = entry.urlDiv.offsetWidth -
+ parseInt(computedStyle.webkitMarginStart) -
+ parseInt(computedStyle.webkitPaddingStart);
+ for (var i = 0; i < entries.length; ++i) {
+ var urlLink = entries[i].urlLink;
+ if (entries[i].isAndroidUri || urlLink.offsetWidth <= columnWidth)
+ continue;
+ urlLink.textContent = '…' + urlLink.textContent.substring(1);
Evan Stade 2016/03/22 19:42:23 to maintain the tooltip, do you need urlLink.title
kolos1 2016/03/22 19:49:26 tootip is initialized with entry.url (fullorigin)
+ while (urlLink.offsetWidth > columnWidth)
+ urlLink.textContent = '…' + urlLink.textContent.substring(2);
+ }
+ },
+
+ /**
* 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 +214,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 +225,7 @@ cr.define('options', function() {
*/
setPasswordExceptionsList_: function(entries) {
this.passwordExceptionsList_.dataModel = new ArrayDataModel(entries);
+ this.updateOriginsEliding_(this.passwordExceptionsList_);
this.updateListVisibility_(this.passwordExceptionsList_);
},
« no previous file with comments | « no previous file | chrome/browser/resources/options/password_manager_list.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698