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

Unified Diff: ui/file_manager/gallery/js/thumbnail_mode.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/thumbnail_mode.js
diff --git a/ui/file_manager/gallery/js/thumbnail_mode.js b/ui/file_manager/gallery/js/thumbnail_mode.js
index 2038c1c41695f2152f372bc0af0ecd826cd600d8..6b0b208bf6b9e0f38112a3c9cdf2992d96406612 100644
--- a/ui/file_manager/gallery/js/thumbnail_mode.js
+++ b/ui/file_manager/gallery/js/thumbnail_mode.js
@@ -83,7 +83,7 @@ ThumbnailMode.prototype.hasActiveTool = function() { return true; };
* @return {boolean} True when an event is handled.
*/
ThumbnailMode.prototype.onKeyDown = function(event) {
- switch (event.keyIdentifier) {
+ switch (event.key) {
case 'Enter':
if (event.target.matches('li.thumbnail')) {
this.changeToSlideModeCallback_();
@@ -352,26 +352,26 @@ ThumbnailView.prototype.onScroll_ = function(event) {
/**
* Moves selection to specified direction.
- * @param {string} direction Direction. Should be 'Left', 'Right', 'Up', or
- * 'Down'.
+ * @param {string} direction Direction. Should be 'ArrowLeft', 'ArrowRight',
+ * 'ArrowUp', or 'ArrowDown'.
* @param {boolean} selectRange True to perform range selection.
* @private
*/
ThumbnailView.prototype.moveSelection_ = function(direction, selectRange) {
var step;
- if ((direction === 'Left' && !isRTL()) ||
- (direction === 'Right' && isRTL()) ||
- (direction === 'Up')) {
+ if ((direction === 'ArrowLeft' && !isRTL()) ||
+ (direction === 'ArrowRight' && isRTL()) ||
+ (direction === 'ArrowUp')) {
step = -1;
- } else if ((direction === 'Right' && !isRTL()) ||
- (direction === 'Left' && isRTL()) ||
- (direction === 'Down')) {
+ } else if ((direction === 'ArrowRight' && !isRTL()) ||
+ (direction === 'ArrowLeft' && isRTL()) ||
+ (direction === 'ArrowDown')) {
step = 1;
} else {
assertNotReached();
}
- var vertical = direction === 'Up' || direction === 'Down';
+ var vertical = direction === 'ArrowUp' || direction === 'ArrowDown';
var baseIndex = this.selectionModel_.leadIndex !== -1 ?
this.selectionModel_.leadIndex :
this.selectionModel_.selectedIndex;
@@ -623,21 +623,21 @@ ThumbnailView.prototype.onDblClick_ = function(event) {
* @private
*/
ThumbnailView.prototype.onKeydown_ = function(event) {
- var keyString = util.getKeyModifiers(event) + event.keyIdentifier;
+ var keyString = util.getKeyModifiers(event) + event.key;
switch (keyString) {
- case 'Right':
- case 'Left':
- case 'Up':
- case 'Down':
- case 'Shift-Right':
- case 'Shift-Left':
- case 'Shift-Up':
- case 'Shift-Down':
- this.moveSelection_(event.keyIdentifier, event.shiftKey);
+ case 'ArrowRight':
+ case 'ArrowLeft':
+ case 'ArrowUp':
+ case 'ArrowDown':
+ case 'Shift-ArrowRight':
+ case 'Shift-ArrowLeft':
+ case 'Shift-ArrowUp':
+ case 'Shift-ArrowDown':
+ this.moveSelection_(event.key, event.shiftKey);
event.stopPropagation();
break;
- case 'Ctrl-U+0041': // Crtl+A
+ case 'Ctrl-a': // Crtl+A
this.selectionModel_.selectAll();
event.stopPropagation();
break;

Powered by Google App Engine
This is Rietveld 408576698