Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // <include src="../../assert.js"> | 5 // <include src="../../assert.js"> |
| 6 | 6 |
| 7 cr.exportPath('cr.ui'); | 7 cr.exportPath('cr.ui'); |
| 8 | 8 |
| 9 /** | 9 /** |
| 10 * Enum for type of hide. Delayed is used when called by clicking on a | 10 * Enum for type of hide. Delayed is used when called by clicking on a |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 116 } | 116 } |
| 117 } | 117 } |
| 118 | 118 |
| 119 // Hide the focus ring on mouse click. | 119 // Hide the focus ring on mouse click. |
| 120 this.classList.add('using-mouse'); | 120 this.classList.add('using-mouse'); |
| 121 break; | 121 break; |
| 122 case 'keydown': | 122 case 'keydown': |
| 123 this.handleKeyDown(e); | 123 this.handleKeyDown(e); |
| 124 // If the menu is visible we let it handle all the keyboard events. | 124 // If the menu is visible we let it handle all the keyboard events. |
| 125 if (this.isMenuShown() && e.currentTarget == this.ownerDocument) { | 125 if (this.isMenuShown() && e.currentTarget == this.ownerDocument) { |
| 126 if (this.menu.handleKeyDown(e)) { | 126 this.menu.handleKeyDown(e); |
|
Bernhard Bauer
2015/04/20 17:06:45
Indent two spaces less (should be indented two mor
Deepak
2015/04/21 04:06:37
Done.
| |
| 127 e.preventDefault(); | 127 e.preventDefault(); |
| 128 e.stopPropagation(); | 128 e.stopPropagation(); |
| 129 } | |
| 130 } | 129 } |
| 131 | 130 |
| 132 // Show the focus ring on keypress. | 131 // Show the focus ring on keypress. |
| 133 this.classList.remove('using-mouse'); | 132 this.classList.remove('using-mouse'); |
| 134 break; | 133 break; |
| 135 case 'focus': | 134 case 'focus': |
| 136 if (e.target instanceof Node && !this.contains(e.target) && | 135 if (e.target instanceof Node && !this.contains(e.target) && |
| 137 !this.menu.contains(e.target)) { | 136 !this.menu.contains(e.target)) { |
| 138 this.hideMenu(); | 137 this.hideMenu(); |
| 139 // Show the focus ring on focus - if it's come from a mouse event, | 138 // Show the focus ring on focus - if it's come from a mouse event, |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 300 'drop-down-arrow-hover', ARROW_WIDTH, ARROW_HEIGHT, opt_hoverColor); | 299 'drop-down-arrow-hover', ARROW_WIDTH, ARROW_HEIGHT, opt_hoverColor); |
| 301 createDropDownArrowCanvas( | 300 createDropDownArrowCanvas( |
| 302 'drop-down-arrow-active', ARROW_WIDTH, ARROW_HEIGHT, opt_activeColor); | 301 'drop-down-arrow-active', ARROW_WIDTH, ARROW_HEIGHT, opt_activeColor); |
| 303 }; | 302 }; |
| 304 | 303 |
| 305 // Export | 304 // Export |
| 306 return { | 305 return { |
| 307 MenuButton: MenuButton, | 306 MenuButton: MenuButton, |
| 308 }; | 307 }; |
| 309 }); | 308 }); |
| OLD | NEW |