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

Unified Diff: ui/file_manager/gallery/js/image_editor/image_editor.js

Issue 1994563002: Remove the use of KeyEvent.keyIdentifier. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
Index: ui/file_manager/gallery/js/image_editor/image_editor.js
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 78860293941f940c984654a9a9b8a4923f706863..9db0b9aaa2483838fbd7ffd5cf00855c8a1439cd 100644
--- a/ui/file_manager/gallery/js/image_editor/image_editor.js
+++ b/ui/file_manager/gallery/js/image_editor/image_editor.js
@@ -748,47 +748,47 @@ ImageEditor.prototype.enterModeByName_ = function(name) {
* @return {boolean} True if handled.
*/
ImageEditor.prototype.onKeyDown = function(event) {
- switch (util.getKeyModifiers(event) + event.keyIdentifier) {
- case 'U+001B': // Escape
+ switch (util.getKeyModifiers(event) + event.key) {
+ case 'Escape':
case 'Enter':
if (this.getMode()) {
- this.leaveModeInternal_(event.keyIdentifier === 'Enter',
+ this.leaveModeInternal_(event.key === 'Enter',
false /* not to switch mode */);
return true;
}
break;
- case 'Ctrl-U+005A': // Ctrl+Z
+ case 'Ctrl-z': // Ctrl+Z
if (this.commandQueue_.canUndo()) {
this.undo();
return true;
}
break;
- case 'Ctrl-U+0059': // Ctrl+Y
+ case 'Ctrl-y': // Ctrl+Y
if (this.commandQueue_.canRedo()) {
this.redo();
return true;
}
break;
- case 'U+0041': // 'a'
+ case 'a':
this.enterModeByName_('autofix');
return true;
- case 'U+0042': // 'b'
+ case 'b':
this.enterModeByName_('exposure');
return true;
- case 'U+0043': // 'c'
+ case 'c':
this.enterModeByName_('crop');
return true;
- case 'U+004C': // 'l'
+ case 'l':
this.enterModeByName_('rotate_left');
return true;
- case 'U+0052': // 'r'
+ case 'r':
this.enterModeByName_('rotate_right');
return true;
}
@@ -1273,7 +1273,7 @@ ImageEditor.Toolbar.createButton_ = function(
button.addEventListener('keydown', function(event) {
// Stop propagation of Enter key event to prevent it from being captured by
// image editor.
- if (event.keyIdentifier === 'Enter')
+ if (event.key === 'Enter')
event.stopPropagation();
});
@@ -1343,7 +1343,7 @@ ImageEditor.Toolbar.prototype.addRange = function(
// Swallow the left and right keys, so they are not handled by other
// listeners.
range.addEventListener('keydown', function(e) {
- if (e.keyIdentifier === 'Left' || e.keyIdentifier === 'Right')
+ if (e.key === 'ArrowLeft' || e.key === 'ArrowRight')
e.stopPropagation();
});

Powered by Google App Engine
This is Rietveld 408576698