| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All Rights Reserved. | 2 * Copyright (C) 2011 Google Inc. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 { | 293 { |
| 294 var menuItemElement = this._highlightedMenuItemElement ? this._highlight
edMenuItemElement.nextSibling : this._contextMenuElement.firstChild; | 294 var menuItemElement = this._highlightedMenuItemElement ? this._highlight
edMenuItemElement.nextSibling : this._contextMenuElement.firstChild; |
| 295 while (menuItemElement && (menuItemElement._isSeparator || menuItemEleme
nt._isCustom)) | 295 while (menuItemElement && (menuItemElement._isSeparator || menuItemEleme
nt._isCustom)) |
| 296 menuItemElement = menuItemElement.nextSibling; | 296 menuItemElement = menuItemElement.nextSibling; |
| 297 if (menuItemElement) | 297 if (menuItemElement) |
| 298 this._highlightMenuItem(menuItemElement, false); | 298 this._highlightMenuItem(menuItemElement, false); |
| 299 }, | 299 }, |
| 300 | 300 |
| 301 _menuKeyDown: function(event) | 301 _menuKeyDown: function(event) |
| 302 { | 302 { |
| 303 switch (event.keyIdentifier) { | 303 switch (event.key) { |
| 304 case "Up": | 304 case "ArrowUp": |
| 305 this._highlightPrevious(); break; | 305 this._highlightPrevious(); break; |
| 306 case "Down": | 306 case "ArrowDown": |
| 307 this._highlightNext(); break; | 307 this._highlightNext(); break; |
| 308 case "Left": | 308 case "ArrowLeft": |
| 309 if (this._parentMenu) { | 309 if (this._parentMenu) { |
| 310 this._highlightMenuItem(null, false); | 310 this._highlightMenuItem(null, false); |
| 311 this._parentMenu._hideSubMenu(); | 311 this._parentMenu._hideSubMenu(); |
| 312 } | 312 } |
| 313 break; | 313 break; |
| 314 case "Right": | 314 case "ArrowRight": |
| 315 if (!this._highlightedMenuItemElement) | 315 if (!this._highlightedMenuItemElement) |
| 316 break; | 316 break; |
| 317 if (this._highlightedMenuItemElement._subItems) { | 317 if (this._highlightedMenuItemElement._subItems) { |
| 318 this._showSubMenu(this._highlightedMenuItemElement); | 318 this._showSubMenu(this._highlightedMenuItemElement); |
| 319 this._subMenu._focus(); | 319 this._subMenu._focus(); |
| 320 this._subMenu._highlightNext(); | 320 this._subMenu._highlightNext(); |
| 321 } | 321 } |
| 322 break; | 322 break; |
| 323 case "U+001B": // Escape | 323 case "Escape": |
| 324 this._discardMenu(false, event); break; | 324 this._discardMenu(false, event); break; |
| 325 case "Enter": | 325 case "Enter": |
| 326 if (!isEnterKey(event)) | 326 if (!isEnterKey(event)) |
| 327 break; | 327 break; |
| 328 // Fall through | 328 // Fall through |
| 329 case "U+0020": // Space | 329 case " ": // Space |
| 330 if (this._highlightedMenuItemElement) | 330 if (this._highlightedMenuItemElement) |
| 331 this._triggerAction(this._highlightedMenuItemElement, event); | 331 this._triggerAction(this._highlightedMenuItemElement, event); |
| 332 if (this._highlightedMenuItemElement._subItems) { | 332 if (this._highlightedMenuItemElement._subItems) { |
| 333 this._subMenu._focus(); | 333 this._subMenu._focus(); |
| 334 this._subMenu._highlightNext(); | 334 this._subMenu._highlightNext(); |
| 335 } | 335 } |
| 336 break; | 336 break; |
| 337 } | 337 } |
| 338 event.consume(true); | 338 event.consume(true); |
| 339 }, | 339 }, |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 | 389 |
| 390 _discardSubMenus: function() | 390 _discardSubMenus: function() |
| 391 { | 391 { |
| 392 if (this._subMenu) | 392 if (this._subMenu) |
| 393 this._subMenu._discardSubMenus(); | 393 this._subMenu._discardSubMenus(); |
| 394 this.element.remove(); | 394 this.element.remove(); |
| 395 if (this._parentMenu) | 395 if (this._parentMenu) |
| 396 delete this._parentMenu._subMenu; | 396 delete this._parentMenu._subMenu; |
| 397 } | 397 } |
| 398 } | 398 } |
| OLD | NEW |