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

Unified Diff: chrome/browser/resources/md_history/history_item.js

Issue 2112803002: MD History: Trim long item titles to reduce effect on performance (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add test Created 4 years, 6 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: chrome/browser/resources/md_history/history_item.js
diff --git a/chrome/browser/resources/md_history/history_item.js b/chrome/browser/resources/md_history/history_item.js
index 78aa976b52b71fca43e68ef52f297bfdc70e63e1..2497a6f525fd7c79a08d6ceae3de6d0a1055d335 100644
--- a/chrome/browser/resources/md_history/history_item.js
+++ b/chrome/browser/resources/md_history/history_item.js
@@ -81,6 +81,18 @@ cr.define('md_history', function() {
var resultId = numberOfItems == 1 ? 'searchResult' : 'searchResults';
return loadTimeData.getStringF('foundSearchResults', numberOfItems,
loadTimeData.getString(resultId), search);
+ },
+
+ /**
+ * Crop long item titles to reduce their effect on layout performance. See
+ * crbug.com/621347.
+ * @param {string} title
+ * @return {string}
+ */
+ cropItemTitle_: function(title) {
+ return (title.length > TITLE_MAX_LENGTH) ?
+ title.substr(0, TITLE_MAX_LENGTH) :
+ title;
}
});
« no previous file with comments | « chrome/browser/resources/md_history/history_item.html ('k') | chrome/test/data/webui/md_history/history_item_test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698