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 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
627 * @param {*} entry | 627 * @param {*} entry |
628 * @suppressGlobalPropertiesCheck | 628 * @suppressGlobalPropertiesCheck |
629 */ | 629 */ |
630 function handleEventEntry(entry) | 630 function handleEventEntry(entry) |
631 { | 631 { |
632 if (!entry.ctrlKey && !entry.altKey && !entry.metaKey && !/^F\d+$/.t
est(entry.key) && entry.key !== "Escape") | 632 if (!entry.ctrlKey && !entry.altKey && !entry.metaKey && !/^F\d+$/.t
est(entry.key) && entry.key !== "Escape") |
633 return; | 633 return; |
634 // Fool around closure compiler -- it has its own notion of both Key
boardEvent constructor | 634 // Fool around closure compiler -- it has its own notion of both Key
boardEvent constructor |
635 // and initKeyboardEvent methods and overriding these in externs.js
does not have effect. | 635 // and initKeyboardEvent methods and overriding these in externs.js
does not have effect. |
636 var event = new window.KeyboardEvent(entry.eventType, { | 636 var event = new window.KeyboardEvent(entry.eventType, { |
637 keyIdentifier: entry.keyIdentifier, | |
638 key: entry.key, | 637 key: entry.key, |
639 code: entry.code, | 638 code: entry.code, |
640 keyCode: entry.keyCode, | 639 keyCode: entry.keyCode, |
641 location: entry.location, | 640 location: entry.location, |
642 ctrlKey: entry.ctrlKey, | 641 ctrlKey: entry.ctrlKey, |
643 altKey: entry.altKey, | 642 altKey: entry.altKey, |
644 shiftKey: entry.shiftKey, | 643 shiftKey: entry.shiftKey, |
645 metaKey: entry.metaKey | 644 metaKey: entry.metaKey |
646 }); | 645 }); |
647 event.__keyCode = keyCodeForEntry(entry); | 646 event.__keyCode = keyCodeForEntry(entry); |
648 document.dispatchEvent(event); | 647 document.dispatchEvent(event); |
649 } | 648 } |
650 | 649 |
651 function keyCodeForEntry(entry) | 650 function keyCodeForEntry(entry) |
652 { | 651 { |
653 var keyCode = entry.keyCode; | 652 var keyCode = entry.keyCode; |
654 if (!keyCode) { | 653 if (!keyCode) { |
655 // This is required only for synthetic events (e.g. dispatched i
n tests). | 654 // This is required only for synthetic events (e.g. dispatched i
n tests). |
656 var match = entry.keyIdentifier.match(/^U\+([\dA-Fa-f]+)$/); | 655 if (entry.key === "Escape") |
657 if (match) | 656 keyCode = 27; |
658 keyCode = parseInt(match[1], 16); | |
659 } | 657 } |
660 return keyCode || 0; | 658 return keyCode || 0; |
661 } | 659 } |
662 }, | 660 }, |
663 | 661 |
664 _dispatchCallback: function(requestId, port, result) | 662 _dispatchCallback: function(requestId, port, result) |
665 { | 663 { |
666 if (requestId) | 664 if (requestId) |
667 port.postMessage({ command: "callback", requestId: requestId, result
: result }); | 665 port.postMessage({ command: "callback", requestId: requestId, result
: result }); |
668 }, | 666 }, |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1073 /** | 1071 /** |
1074 * @typedef {{code: string, description: string, details: !Array.<*>}} | 1072 * @typedef {{code: string, description: string, details: !Array.<*>}} |
1075 */ | 1073 */ |
1076 WebInspector.ExtensionStatus.Record; | 1074 WebInspector.ExtensionStatus.Record; |
1077 | 1075 |
1078 WebInspector.extensionAPI = {}; | 1076 WebInspector.extensionAPI = {}; |
1079 defineCommonExtensionSymbols(WebInspector.extensionAPI); | 1077 defineCommonExtensionSymbols(WebInspector.extensionAPI); |
1080 | 1078 |
1081 /** @type {!WebInspector.ExtensionServer} */ | 1079 /** @type {!WebInspector.ExtensionServer} */ |
1082 WebInspector.extensionServer; | 1080 WebInspector.extensionServer; |
OLD | NEW |