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

Unified Diff: chrome/browser/resources/file_manager/js/navigation_list.js

Issue 22405006: Add fade-in and fade-out animation on creating/deleting an item in NavList in Files.app (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix potensial test failure and minor css Created 7 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 | « chrome/browser/resources/file_manager/css/file_manager.css ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/file_manager/js/navigation_list.js
diff --git a/chrome/browser/resources/file_manager/js/navigation_list.js b/chrome/browser/resources/file_manager/js/navigation_list.js
index 16bd17bda2533b876a04a7a02b3eb5f9961be7f9..7d6e6280dd5434d87a262d7eb0dde128c5fd722e 100644
--- a/chrome/browser/resources/file_manager/js/navigation_list.js
+++ b/chrome/browser/resources/file_manager/js/navigation_list.js
@@ -283,6 +283,28 @@ NavigationList.prototype.decorate = function(directoryModel) {
};
/**
+ * This overrides Node.removeChild().
+ * Instead of just removing the given child, this method adds a fade-out
+ * animation and removes the child after animation completes.
+ *
+ * @param {NavigationListItem} item List item to be removed.
+ * @override
+ */
+NavigationList.prototype.removeChild = function(item) {
+ var removeElement = function(e) {
+ // Must keep the animation name 'fadeOut' in sync with the css.
+ if (e.animationName == 'fadeOut')
+ // Checks if the element is still alive on the DOM tree.
+ if (item.parentElement && item.parentElement == this)
+ Node.prototype.removeChild.call(this, item);
+ }.bind(this);
+
+ item.addEventListener('webkitAnimationEnd', removeElement, false);
+ // Must keep the class name 'fadeout' in sync with the css.
+ item.classList.add('fadeout');
+};
+
+/**
* Creates an element of a navigation list. This method is called from
* cr.ui.List internally.
* @param {string} path Path of the directory to be rendered.
« no previous file with comments | « chrome/browser/resources/file_manager/css/file_manager.css ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698