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 /** | 5 /** |
6 * @fileoverview User pod row implementation. | 6 * @fileoverview User pod row implementation. |
7 */ | 7 */ |
8 | 8 |
9 cr.define('login', function() { | 9 cr.define('login', function() { |
10 /** | 10 /** |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 this.resetTabOrder(); | 462 this.resetTabOrder(); |
463 }, | 463 }, |
464 | 464 |
465 /** | 465 /** |
466 * Handles a click event on action area button. | 466 * Handles a click event on action area button. |
467 * @param {Event} e Click event. | 467 * @param {Event} e Click event. |
468 */ | 468 */ |
469 handleActionAreaButtonClick_: function(e) { | 469 handleActionAreaButtonClick_: function(e) { |
470 if (this.parentNode.disabled) | 470 if (this.parentNode.disabled) |
471 return; | 471 return; |
| 472 console.error('Action area clicked: ' + !this.isActionBoxMenuActive + |
| 473 ' at ' + e.x + ', ' + e.y); |
472 this.isActionBoxMenuActive = !this.isActionBoxMenuActive; | 474 this.isActionBoxMenuActive = !this.isActionBoxMenuActive; |
473 }, | 475 }, |
474 | 476 |
475 /** | 477 /** |
476 * Handles a keydown event on action area button. | 478 * Handles a keydown event on action area button. |
477 * @param {Event} e KeyDown event. | 479 * @param {Event} e KeyDown event. |
478 */ | 480 */ |
479 handleActionAreaButtonKeyDown_: function(e) { | 481 handleActionAreaButtonKeyDown_: function(e) { |
480 if (this.disabled) | 482 if (this.disabled) |
481 return; | 483 return; |
482 switch (e.keyIdentifier) { | 484 switch (e.keyIdentifier) { |
483 case 'Enter': | 485 case 'Enter': |
484 case 'U+0020': // Space | 486 case 'U+0020': // Space |
485 if (this.parentNode.focusedPod_ && !this.isActionBoxMenuActive) | 487 if (this.parentNode.focusedPod_ && !this.isActionBoxMenuActive) { |
| 488 console.error('Action area keyed: ' + !this.isActionBoxMenuActive + |
| 489 ' at ' + e.x + ', ' + e.y); |
486 this.isActionBoxMenuActive = true; | 490 this.isActionBoxMenuActive = true; |
| 491 } |
487 e.stopPropagation(); | 492 e.stopPropagation(); |
488 break; | 493 break; |
489 case 'Up': | 494 case 'Up': |
490 case 'Down': | 495 case 'Down': |
491 if (this.isActionBoxMenuActive) { | 496 if (this.isActionBoxMenuActive) { |
492 this.actionBoxMenuRemoveElement.tabIndex = | 497 this.actionBoxMenuRemoveElement.tabIndex = |
493 UserPodTabOrder.PAD_MENU_ITEM; | 498 UserPodTabOrder.PAD_MENU_ITEM; |
494 this.actionBoxMenuRemoveElement.focus(); | 499 this.actionBoxMenuRemoveElement.focus(); |
495 } | 500 } |
496 e.stopPropagation(); | 501 e.stopPropagation(); |
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1179 | 1184 |
1180 /** | 1185 /** |
1181 * Handler of click event. | 1186 * Handler of click event. |
1182 * @param {Event} e Click Event object. | 1187 * @param {Event} e Click Event object. |
1183 * @private | 1188 * @private |
1184 */ | 1189 */ |
1185 handleClick_: function(e) { | 1190 handleClick_: function(e) { |
1186 if (this.disabled) | 1191 if (this.disabled) |
1187 return; | 1192 return; |
1188 | 1193 |
| 1194 console.error('Document clicked at ' + e.x + ', ' + e.y + |
| 1195 ', pod: ' + findAncestorByClass(e.target, 'pod')); |
| 1196 |
1189 // Clear all menus if the click is outside pod menu and its | 1197 // Clear all menus if the click is outside pod menu and its |
1190 // button area. | 1198 // button area. |
1191 if (!findAncestorByClass(e.target, 'action-box-menu') && | 1199 if (!findAncestorByClass(e.target, 'action-box-menu') && |
1192 !findAncestorByClass(e.target, 'action-box-area')) { | 1200 !findAncestorByClass(e.target, 'action-box-area')) { |
1193 for (var i = 0, pod; pod = this.pods[i]; ++i) | 1201 for (var i = 0, pod; pod = this.pods[i]; ++i) |
1194 pod.isActionBoxMenuActive = false; | 1202 pod.isActionBoxMenuActive = false; |
1195 } | 1203 } |
1196 | 1204 |
1197 // Clears focus if not clicked on a pod and if there's more than one pod. | 1205 // Clears focus if not clicked on a pod and if there's more than one pod. |
1198 var pod = findAncestorByClass(e.target, 'pod'); | 1206 var pod = findAncestorByClass(e.target, 'pod'); |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1379 this.classList.remove('images-loading'); | 1387 this.classList.remove('images-loading'); |
1380 chrome.send('userImagesLoaded'); | 1388 chrome.send('userImagesLoaded'); |
1381 } | 1389 } |
1382 } | 1390 } |
1383 }; | 1391 }; |
1384 | 1392 |
1385 return { | 1393 return { |
1386 PodRow: PodRow | 1394 PodRow: PodRow |
1387 }; | 1395 }; |
1388 }); | 1396 }); |
OLD | NEW |