Index: chrome/browser/resources/options/autofill_options_list.js |
diff --git a/chrome/browser/resources/options/autofill_options_list.js b/chrome/browser/resources/options/autofill_options_list.js |
index e45eb49d2d6351624f621f4821cc37b93f576c41..fd7ca77a5d23528cc23c1e3df979d1d1efcb6c89 100644 |
--- a/chrome/browser/resources/options/autofill_options_list.js |
+++ b/chrome/browser/resources/options/autofill_options_list.js |
@@ -208,17 +208,23 @@ cr.define('options.autofillOptions', function() { |
if (this.isPlaceholder) { |
// It is important that updateIndex is done before validateAndSave. |
// Otherwise we can not be sure about AddRow index. |
- this.list.dataModel.updateIndex(i); |
+ this.list.executeWithChangeEventsDisabled(function() { |
Dan Beam
2015/01/22 05:38:48
i guess this pattern is ok, but:
this.list.setC
bondd
2015/01/22 20:23:57
Acknowledged.
On the plus side it makes it 100% im
|
+ this.list.dataModel.updateIndex(i); |
+ }.bind(this)); |
this.list.validateAndSave(i, 0, value); |
} else { |
this.list.validateAndSave(i, 1, value); |
} |
} else { |
// Reject empty values and duplicates. |
- if (!this.isPlaceholder) |
- this.list.dataModel.splice(i, 1); |
- else |
+ if (!this.isPlaceholder) { |
+ this.list.executeWithChangeEventsDisabled(function() { |
+ this.list.dataModel.splice(i, 1); |
+ }.bind(this)); |
+ this.list.setSelectedIndexWithoutFocusing(i); |
+ } else { |
this.clearValue_(); |
+ } |
} |
}, |
}; |
@@ -442,7 +448,10 @@ cr.define('options.autofillOptions', function() { |
* @param {string} value The value of the item to insert. |
*/ |
validateAndSave: function(index, remove, value) { |
- this.dataModel.splice(index, remove, value); |
+ this.executeWithChangeEventsDisabled(function() { |
+ this.dataModel.splice(index, remove, value); |
+ }.bind(this)); |
+ this.setSelectedIndexWithoutFocusing(index); |
}, |
}; |
@@ -513,8 +522,6 @@ cr.define('options.autofillOptions', function() { |
while (this.validationPromiseResolvers_.length) { |
this.validationPromiseResolvers_.pop()(); |
} |
- // List has been repopulated. Focus the placeholder. |
- this.focusPlaceholder(); |
} |
}, |