diff options
author | ryoh <ryoh@chromium.org> | 2016-02-24 22:13:21 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-02-25 06:14:41 +0000 |
commit | 5e316c498704555e37f3c5be4055f1dff71b9f54 (patch) | |
tree | 413a804b8303ec5686f266e8a730e9b2776f39ec /ui/file_manager | |
parent | a8ce1a277da50a98e9ad654e60382ced50d8fdea (diff) | |
download | chromium_src-5e316c498704555e37f3c5be4055f1dff71b9f54.zip chromium_src-5e316c498704555e37f3c5be4055f1dff71b9f54.tar.gz chromium_src-5e316c498704555e37f3c5be4055f1dff71b9f54.tar.bz2 |
Calculate whether each edit mode is available or not when we enter the edit mode.
Currently, they are calculated when the image is loaded.
It's not reasonable! Users do not always edit it.
We should calculate it when it is really needed.
That is to say, when the users click the "edit" button.
Another reason:
If you calculate the histgram (that is needed for InstantAutofix),
and the image decode process is not done,
the UI thread will be blocked.
Because canvas.getImageData is a synchronous method!
http://www.w3schools.com/tags/canvas_getimagedata.asp
I think we can avoid it by defferding evaluating the histgram.
BUG=585001
Review URL: https://codereview.chromium.org/1731753002
Cr-Commit-Position: refs/heads/master@{#377521}
Diffstat (limited to 'ui/file_manager')
-rw-r--r-- | ui/file_manager/gallery/js/image_editor/image_editor.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/ui/file_manager/gallery/js/image_editor/image_editor.js b/ui/file_manager/gallery/js/image_editor/image_editor.js index 9f8679a..9040fe6 100644 --- a/ui/file_manager/gallery/js/image_editor/image_editor.js +++ b/ui/file_manager/gallery/js/image_editor/image_editor.js @@ -49,7 +49,6 @@ function ImageEditor( this.viewport_ = viewport; this.imageView_ = imageView; - this.imageView_.addContentCallback(this.onContentUpdate_.bind(this)); this.buffer_ = new ImageBuffer(); this.buffer_.addOverlay(this.imageView_); @@ -191,7 +190,7 @@ ImageEditor.prototype.recordToolUse = function(name) { * Content update handler. * @private */ -ImageEditor.prototype.onContentUpdate_ = function() { +ImageEditor.prototype.calculateModeApplicativity_ = function() { for (var i = 0; i != this.modes_.length; i++) { var mode = this.modes_[i]; ImageUtil.setAttribute(assert(mode.button_), 'disabled', @@ -646,6 +645,7 @@ ImageEditor.prototype.setUpMode_ = function(mode) { this.modeToolbar_.clear(); this.currentMode_.createTools(this.modeToolbar_); this.modeToolbar_.show(true); + this.calculateModeApplicativity_(); }; /** |