Commit 44860f01 authored by fukino@chromium.org's avatar fukino@chromium.org

Avoid handling change event when focusing tree item is sufficient.

BUG=402319
TEST=manually and run browser_tests gtest_filter=*FileManager*

Review URL: https://codereview.chromium.org/458103002

Cr-Commit-Position: refs/heads/master@{#288985}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@288985 0039d316-1c4b-4281-b951-d872f2087c98
parent 5a5af34a
...@@ -550,7 +550,8 @@ VolumeItem.prototype.selectByEntry = function(entry) { ...@@ -550,7 +550,8 @@ VolumeItem.prototype.selectByEntry = function(entry) {
this.searchAndSelectByEntry(entry); this.searchAndSelectByEntry(entry);
return; return;
} }
if (util.isSameEntry(entry, this.entry)) if (util.isSameEntry(this.entry, entry) ||
util.isDescendantEntry(this.entry, entry))
this.selected = true; this.selected = true;
}; };
...@@ -938,12 +939,18 @@ DirectoryTree.prototype.searchAndSelectByEntry = function(entry) { ...@@ -938,12 +939,18 @@ DirectoryTree.prototype.searchAndSelectByEntry = function(entry) {
continue; continue;
if (util.isSameEntry(item.entry, entry)) { if (util.isSameEntry(item.entry, entry)) {
this.dontHandleChangeEvent_ = true;
item.selectByEntry(entry); item.selectByEntry(entry);
this.dontHandleChangeEvent_ = false;
return true; return true;
} }
} }
// Otherwise, search whole tree. // Otherwise, search whole tree.
return DirectoryItemTreeBaseMethods.searchAndSelectByEntry.call(this, entry); this.dontHandleChangeEvent_ = true;
var found = DirectoryItemTreeBaseMethods.searchAndSelectByEntry.call(
this, entry);
this.dontHandleChangeEvent_ = false;
return found;
}; };
/** /**
...@@ -972,7 +979,7 @@ DirectoryTree.prototype.decorate = function( ...@@ -972,7 +979,7 @@ DirectoryTree.prototype.decorate = function(
// Add a handler for directory change. // Add a handler for directory change.
this.addEventListener('change', function() { this.addEventListener('change', function() {
if (this.selectedItem) if (this.selectedItem && !this.dontHandleChangeEvent_)
this.selectedItem.activate(); this.selectedItem.activate();
}.bind(this)); }.bind(this));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment