diff options
author | kaznacheev@chromium.org <kaznacheev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-12 10:56:28 +0000 |
---|---|---|
committer | kaznacheev@chromium.org <kaznacheev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-12 10:56:28 +0000 |
commit | b06fb4b5381baac0a8b35f84fd4d653a9ebf1f19 (patch) | |
tree | ad5af20952ddf8ad3df5e9b7f7205b4a35feb383 | |
parent | 1b5a377e604692f6e1c8aea4c78129a98a34d8cb (diff) | |
download | chromium_src-b06fb4b5381baac0a8b35f84fd4d653a9ebf1f19.zip chromium_src-b06fb4b5381baac0a8b35f84fd4d653a9ebf1f19.tar.gz chromium_src-b06fb4b5381baac0a8b35f84fd4d653a9ebf1f19.tar.bz2 |
Merge 115883 - Fixed navigation after editing in the Photo Editor
BUG=chromium-os:24462
TEST=
Review URL: http://codereview.chromium.org/9046004
TBR=kaznacheev@chromium.org
Review URL: http://codereview.chromium.org/9185045
git-svn-id: svn://svn.chromium.org/chrome/branches/963/src@117416 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/resources/file_manager/js/image_editor/commands.js | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/chrome/browser/resources/file_manager/js/image_editor/commands.js b/chrome/browser/resources/file_manager/js/image_editor/commands.js index 3a4bfed..c8fa398 100644 --- a/chrome/browser/resources/file_manager/js/image_editor/commands.js +++ b/chrome/browser/resources/file_manager/js/image_editor/commands.js @@ -19,7 +19,7 @@ function CommandQueue(document, canvas) { this.busy_ = false; - this.UIContext_ = null; + this.UIContext_ = {}; } /** @@ -42,11 +42,15 @@ CommandQueue.prototype.attachUI = function(imageView, prompt, lock) { * Detach the UI. Further image modifications will not be displayed. */ CommandQueue.prototype.detachUI = function() { - // Instead of nulling out this.UIContext_ we null out its fields so that - // the commands currently being executed see this change. + // The current this.UIContext_ object might be used by the command currently + // being executed. Null out its fields so that the command continues silently. this.UIContext_.imageView = null; this.UIContext_.prompt = null; this.UIContext_.lock = null; + + // Now replace the object to guarantee that we do not interfere with the + // current command. + this.UIContext_ = {}; }; /** @@ -76,7 +80,7 @@ CommandQueue.prototype.setBusy_ = function(on) { } } - if (this.UIContext_) + if (this.UIContext_.lock) this.UIContext_.lock(on); if (on) { @@ -241,7 +245,7 @@ Command.Rotate.prototype.execute = function( (this.rotate90_ & 1) ? srcCanvas.width : srcCanvas.height); ImageUtil.drawImageTransformed( result, srcCanvas, 1, 1, this.rotate90_ * Math.PI / 2); - if (uiContext && uiContext.imageView) { + if (uiContext.imageView) { uiContext.imageView.replaceAndAnimate(result, null, this.rotate90_); } setTimeout(callback.bind(null, result), 0); @@ -271,9 +275,8 @@ Command.Crop.prototype.execute = function( var result = this.createCanvas_( document, srcCanvas, this.imageRect_.width, this.imageRect_.height); Rect.drawImage(result.getContext("2d"), srcCanvas, null, this.imageRect_); - if (uiContext && uiContext.imageView) { - uiContext.imageView. - replaceAndAnimate(result, this.screenRect_, 0); + if (uiContext.imageView) { + uiContext.imageView.replaceAndAnimate(result, this.screenRect_, 0); } setTimeout(callback.bind(null, result), 0); }; |