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

Unified Diff: chrome/browser/resources/file_manager/foreground/js/ui/progress_center_panel.js

Issue 93633009: Files.app: Fix the animation of progress items. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Quick Fix. Created 7 years 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: chrome/browser/resources/file_manager/foreground/js/ui/progress_center_panel.js
diff --git a/chrome/browser/resources/file_manager/foreground/js/ui/progress_center_panel.js b/chrome/browser/resources/file_manager/foreground/js/ui/progress_center_panel.js
index c66f9028ede266f2c9d188eb3ec880ba7813a19d..bcfe6d8e7477a6f2d471f2fc9f0c76026e5edefe 100644
--- a/chrome/browser/resources/file_manager/foreground/js/ui/progress_center_panel.js
+++ b/chrome/browser/resources/file_manager/foreground/js/ui/progress_center_panel.js
@@ -73,8 +73,6 @@ var ProgressCenterPanel = function(element) {
ProgressCenterPanel.updateItemElement_ = function(element, item) {
// Sets element attributes.
element.setAttribute('data-progress-id', item.id);
- element.setAttribute('data-progress-max', item.progressMax);
- element.setAttribute('data-progress-value', item.progressValue);
element.classList.toggle('error', item.state === ProgressItemState.ERROR);
element.classList.toggle('cancelable', item.cancelable);
@@ -82,8 +80,9 @@ ProgressCenterPanel.updateItemElement_ = function(element, item) {
// set) and the progress rate increases, we use transition animation.
var previousWidthRate =
parseInt(element.querySelector('.progress-track').style.width);
+ var targetWidthRate = item.progressRateInPercent;
var animation = !isNaN(previousWidthRate) &&
- previousWidthRate < item.progressRateInPercent;
+ previousWidthRate < targetWidthRate;
if (item.state === ProgressItemState.COMPLETED && animation) {
// The attribute pre-complete means that the actual operation is already
// done but the UI transition of progress bar is not complete.
@@ -94,12 +93,16 @@ ProgressCenterPanel.updateItemElement_ = function(element, item) {
// To commit the property change and to trigger the transition even if the
// change is done synchronously, assign the width value asynchronously.
- setTimeout(function() {
+ var updateTrackWidth = function() {
var track = element.querySelector('.progress-track');
track.classList.toggle('animated', animation);
- track.style.width = item.progressRateInPercent + '%';
+ track.style.width = targetWidthRate + '%';
track.hidden = false;
- }, 0);
+ };
+ if (animation)
+ setTimeout(updateTrackWidth);
+ else
+ updateTrackWidth();
};
/**
« 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