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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 | 60 |
61 this._history = []; | 61 this._history = []; |
62 this._historyIterator = -1; | 62 this._historyIterator = -1; |
63 this._keyDownBound = this._keyDown.bind(this); | 63 this._keyDownBound = this._keyDown.bind(this); |
64 this._keyPressBound = this._keyPress.bind(this); | 64 this._keyPressBound = this._keyPress.bind(this); |
65 /** @type {!Object.<string, !WebInspector.PanelDescriptor>} */ | 65 /** @type {!Object.<string, !WebInspector.PanelDescriptor>} */ |
66 this._panelDescriptors = {}; | 66 this._panelDescriptors = {}; |
67 /** @type {!Object.<string, !Promise.<!WebInspector.Panel> >} */ | 67 /** @type {!Object.<string, !Promise.<!WebInspector.Panel> >} */ |
68 this._panelPromises = {}; | 68 this._panelPromises = {}; |
69 | 69 |
70 // Windows and Mac have two different definitions of '[' and ']', so accept
both of each. | |
71 this._openBracketIdentifiers = ["U+005B", "U+00DB"].keySet(); | |
72 this._closeBracketIdentifiers = ["U+005D", "U+00DD"].keySet(); | |
73 this._lastActivePanelSetting = WebInspector.settings.createSetting("lastActi
vePanel", "elements"); | 70 this._lastActivePanelSetting = WebInspector.settings.createSetting("lastActi
vePanel", "elements"); |
74 | 71 |
75 InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Event
s.ShowPanel, showPanel.bind(this)); | 72 InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Event
s.ShowPanel, showPanel.bind(this)); |
76 this._loadPanelDesciptors(); | 73 this._loadPanelDesciptors(); |
77 | 74 |
78 /** | 75 /** |
79 * @this {WebInspector.InspectorView} | 76 * @this {WebInspector.InspectorView} |
80 * @param {!WebInspector.Event} event | 77 * @param {!WebInspector.Event} event |
81 */ | 78 */ |
82 function showPanel(event) | 79 function showPanel(event) |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 this.showPanel(panelName); | 441 this.showPanel(panelName); |
445 event.consume(true); | 442 event.consume(true); |
446 } | 443 } |
447 return; | 444 return; |
448 } | 445 } |
449 } | 446 } |
450 | 447 |
451 // BUG85312: On French AZERTY keyboards, AltGr-]/[ combinations (synonym
ous to Ctrl-Alt-]/[ on Windows) are used to enter ]/[, | 448 // BUG85312: On French AZERTY keyboards, AltGr-]/[ combinations (synonym
ous to Ctrl-Alt-]/[ on Windows) are used to enter ]/[, |
452 // so for a ]/[-related keydown we delay the panel switch using a timer,
to see if there is a keypress event following this one. | 449 // so for a ]/[-related keydown we delay the panel switch using a timer,
to see if there is a keypress event following this one. |
453 // If there is, we cancel the timer and do not consider this a panel swi
tch. | 450 // If there is, we cancel the timer and do not consider this a panel swi
tch. |
454 if (!WebInspector.isWin() || (!this._openBracketIdentifiers[event.keyIde
ntifier] && !this._closeBracketIdentifiers[event.keyIdentifier])) { | 451 if (!WebInspector.isWin() || (event.key !== "[" && event.key !== "]")) { |
455 this._keyDownInternal(event); | 452 this._keyDownInternal(event); |
456 return; | 453 return; |
457 } | 454 } |
458 | 455 |
459 this._keyDownTimer = setTimeout(this._keyDownInternal.bind(this, event),
0); | 456 this._keyDownTimer = setTimeout(this._keyDownInternal.bind(this, event),
0); |
460 }, | 457 }, |
461 | 458 |
462 _keyDownInternal: function(event) | 459 _keyDownInternal: function(event) |
463 { | 460 { |
464 if (this._currentPanelLocked) | 461 if (this._currentPanelLocked) |
465 return; | 462 return; |
466 | 463 |
467 var direction = 0; | 464 var direction = 0; |
468 | 465 |
469 if (this._openBracketIdentifiers[event.keyIdentifier]) | 466 if (event.key === "[") |
470 direction = -1; | 467 direction = -1; |
471 | 468 |
472 if (this._closeBracketIdentifiers[event.keyIdentifier]) | 469 if (event.key === "]") |
473 direction = 1; | 470 direction = 1; |
474 | 471 |
475 if (!direction) | 472 if (!direction) |
476 return; | 473 return; |
477 | 474 |
478 if (!event.shiftKey && !event.altKey) { | 475 if (!event.shiftKey && !event.altKey) { |
479 if (!WebInspector.Dialog.hasInstance()) | 476 if (!WebInspector.Dialog.hasInstance()) |
480 this._changePanelInDirection(direction); | 477 this._changePanelInDirection(direction); |
481 event.consume(true); | 478 event.consume(true); |
482 return; | 479 return; |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
601 */ | 598 */ |
602 handleAction: function(context, actionId) | 599 handleAction: function(context, actionId) |
603 { | 600 { |
604 if (WebInspector.inspectorView.drawerVisible()) | 601 if (WebInspector.inspectorView.drawerVisible()) |
605 WebInspector.inspectorView.closeDrawer(); | 602 WebInspector.inspectorView.closeDrawer(); |
606 else | 603 else |
607 WebInspector.inspectorView.showDrawer(); | 604 WebInspector.inspectorView.showDrawer(); |
608 return true; | 605 return true; |
609 } | 606 } |
610 } | 607 } |
OLD | NEW |