| 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 dd80600a163e428f4852a95ce4214dbfd340d99a..fe847e9c1e48cef8b9d84533a152744246041969 100644
|
| --- a/chrome/browser/resources/options/autofill_options_list.js
|
| +++ b/chrome/browser/resources/options/autofill_options_list.js
|
| @@ -291,25 +291,6 @@ cr.define('options.autofillOptions', function() {
|
| AutofillValuesList.prototype = {
|
| __proto__: InlineEditableItemList.prototype,
|
|
|
| - decorate: function() {
|
| - InlineEditableItemList.prototype.decorate.call(this);
|
| -
|
| - var self = this;
|
| - function handleBlur(e) {
|
| - // When the blur event happens we do not know who is getting focus so we
|
| - // delay this a bit until we know if the new focus node is outside the
|
| - // list.
|
| - var doc = e.target.ownerDocument;
|
| - window.setTimeout(function() {
|
| - var activeElement = doc.activeElement;
|
| - if (!self.contains(activeElement))
|
| - self.selectionModel.unselectAll();
|
| - }, 50);
|
| - }
|
| -
|
| - this.addEventListener('blur', handleBlur, true);
|
| - },
|
| -
|
| /** @inheritDoc */
|
| createItem: function(entry) {
|
| if (entry != null)
|
| @@ -329,6 +310,34 @@ cr.define('options.autofillOptions', function() {
|
| },
|
|
|
| /**
|
| + * Called when the list hierarchy as a whole loses or gains focus.
|
| + * If the list was focused in response to a mouse click, call into the
|
| + * superclass's implementation. If the list was focused in response to a
|
| + * keyboard navigation, focus the first item.
|
| + * If the list loses focus, unselect all the elements.
|
| + * @param {Event} e The change event.
|
| + * @private
|
| + */
|
| + handleListFocusChange_: function(e) {
|
| + // We check to see whether there is a selected item as a proxy for
|
| + // distinguishing between mouse- and keyboard-originated focus events.
|
| + var selectedItem = this.selectedItem;
|
| + if (selectedItem)
|
| + InlineEditableItemList.prototype.handleListFocusChange_.call(this, e);
|
| +
|
| + if (!e.newValue) {
|
| + // When the list loses focus, unselect all the elements.
|
| + this.selectionModel.unselectAll();
|
| + } else {
|
| + // When the list gains focus, select the first item if nothing else is
|
| + // selected.
|
| + var firstItem = this.getListItemByIndex(0);
|
| + if (!selectedItem && firstItem && e.newValue)
|
| + firstItem.handleFocus_();
|
| + }
|
| + },
|
| +
|
| + /**
|
| * Called when a new list item should be validated; subclasses are
|
| * responsible for implementing if validation is required.
|
| * @param {number} index The index of the item that was inserted or changed.
|
|
|