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

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

Issue 6099016: Drastically reduce the number of redraws when editing content settings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix selection bug Created 9 years, 11 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 | « chrome/browser/resources/options/content_settings.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/options/content_settings_exceptions_area.js
diff --git a/chrome/browser/resources/options/content_settings_exceptions_area.js b/chrome/browser/resources/options/content_settings_exceptions_area.js
index 5a0e788f38a2966eb16ee2d62086e4b4fdcc7470..b75709ce2ecc0f9231ba9fe3a0ea6e6b04aaf4c8 100644
--- a/chrome/browser/resources/options/content_settings_exceptions_area.js
+++ b/chrome/browser/resources/options/content_settings_exceptions_area.js
@@ -424,7 +424,7 @@ cr.define('options.contentSettings', function() {
window.setTimeout(function() {
var activeElement = doc.activeElement;
if (!exceptionList.contains(activeElement))
- exceptionList.selectionModel.clear();
+ exceptionList.selectionModel.unselectAll();
}, 50);
}
@@ -458,16 +458,21 @@ cr.define('options.contentSettings', function() {
},
/**
- * Adds an exception to the js model.
- * @param {Object} entry A dictionary of values for the exception.
+ * Sets the exceptions in the js model.
+ * @param {Object} entries A list of dictionaries of values, each dictionary
+ * represents an exception.
*/
- addException: function(entry) {
+ setExceptions: function(entries) {
+ var deleteCount = this.dataModel.length;
+
if (this.isEditable()) {
- // We have to add it before the Add New Exception row.
- this.dataModel.splice(this.dataModel.length - 1, 0, entry);
- } else {
- this.dataModel.push(entry);
+ // We don't want to remove the Add New Exception row.
+ deleteCount = deleteCount - 1;
}
+
+ var args = [0, deleteCount];
+ args.push.apply(args, entries);
+ this.dataModel.splice.apply(this.dataModel, args);
},
/**
« no previous file with comments | « chrome/browser/resources/options/content_settings.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698