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

Unified Diff: ui/file_manager/file_manager/foreground/js/directory_tree.js

Issue 458103002: Avoid handling change event when focusing tree item is sufficient. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/file_manager/file_manager/foreground/js/directory_tree.js
diff --git a/ui/file_manager/file_manager/foreground/js/directory_tree.js b/ui/file_manager/file_manager/foreground/js/directory_tree.js
index aa87168bfdaa34a16119ec825d9c18e96237698a..0f4c8627f0851dc55eb2ee180759aa3612efab97 100644
--- a/ui/file_manager/file_manager/foreground/js/directory_tree.js
+++ b/ui/file_manager/file_manager/foreground/js/directory_tree.js
@@ -545,7 +545,8 @@ VolumeItem.prototype.selectByEntry = function(entry) {
this.searchAndSelectByEntry(entry);
return;
}
- if (util.isSameEntry(entry, this.entry))
+ if (util.isSameEntry(this.entry, entry) ||
+ util.isDescendantEntry(this.entry, entry))
this.selected = true;
};
@@ -933,12 +934,18 @@ DirectoryTree.prototype.searchAndSelectByEntry = function(entry) {
continue;
if (util.isSameEntry(item.entry, entry)) {
+ this.dontHandleChangeEvent_ = true;
item.selectByEntry(entry);
+ this.dontHandleChangeEvent_ = false;
return true;
}
}
// 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;
};
/**
@@ -967,7 +974,7 @@ DirectoryTree.prototype.decorate = function(
// Add a handler for directory change.
this.addEventListener('change', function() {
- if (this.selectedItem)
+ if (this.selectedItem && !this.dontHandleChangeEvent_)
this.selectedItem.activate();
}.bind(this));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698