Index: third_party/WebKit/Source/devtools/front_end/devtools.js |
diff --git a/third_party/WebKit/Source/devtools/front_end/devtools.js b/third_party/WebKit/Source/devtools/front_end/devtools.js |
index f3a91417f68c5ed57a954f58d7eafead6c55e625..6f24ec745dcc92e36151727914a74960550dbedc 100644 |
--- a/third_party/WebKit/Source/devtools/front_end/devtools.js |
+++ b/third_party/WebKit/Source/devtools/front_end/devtools.js |
@@ -229,7 +229,7 @@ DevToolsAPIImpl.prototype = { |
}, |
/** |
- * @param {{type: string, keyIdentifier: string, keyCode: number, modifiers: number}} event |
+ * @param {{type: string, key: string, code: string, keyIdentifier: string, keyCode: number, modifiers: number}} event |
*/ |
keyEventUnhandled: function(event) |
{ |
@@ -1008,6 +1008,143 @@ function installBackwardsCompatibility() |
if (window.location.search.indexOf("remoteFrontend") === -1) |
return; |
+ function keyCodeToKeyIdentifier(keyCode) { |
caseq
2016/06/10 18:59:11
{ => next line
dtapuska
2016/06/10 20:25:43
Done.
|
+ switch(keyCode) { |
caseq
2016/06/10 18:59:11
nit: consider using a map?
var keyMap = new Map([[
dtapuska
2016/06/10 20:25:43
Done.
|
+ case 0x12: |
+ return "Alt"; |
+ case 0x11: |
+ return "Control"; |
+ case 0x10: |
+ return "Shift"; |
+ case 0x14: |
+ return "CapsLock"; |
+ case 0x5b: |
+ case 0x5c: |
+ return "Win"; |
+ case 0x0c: |
+ return "Clear"; |
+ case 0x28: |
+ return "Down"; |
+ case 0x23: |
+ return "End"; |
+ case 0x0a: // Carriage return |
+ case 0x0d: |
+ return "Enter"; |
+ case 0x2b: |
+ return "Execute"; |
+ case 0x70: |
+ return "F1"; |
+ case 0x71: |
+ return "F2"; |
+ case 0x72: |
+ return "F3"; |
+ case 0x73: |
+ return "F4"; |
+ case 0x74: |
+ return "F5"; |
+ case 0x75: |
+ return "F6"; |
+ case 0x76: |
+ return "F7"; |
+ case 0x77: |
+ return "F8"; |
+ case 0x78: |
+ return "F9"; |
+ case 0x79: |
+ return "F10"; |
+ case 0x7a: |
+ return "F11"; |
+ case 0x7b: |
+ return "F12"; |
+ case 0x7c: |
+ return "F13"; |
+ case 0x7d: |
+ return "F14"; |
+ case 0x7e: |
+ return "F15"; |
+ case 0x7f: |
+ return "F16"; |
+ case 0x80: |
+ return "F17"; |
+ case 0x81: |
+ return "F18"; |
+ case 0x82: |
+ return "F19"; |
+ case 0x83: |
+ return "F20"; |
+ case 0x84: |
+ return "F21"; |
+ case 0x85: |
+ return "F22"; |
+ case 0x86: |
+ return "F23"; |
+ case 0x87: |
+ return "F24"; |
+ case 0x2f: |
+ return "Help"; |
+ case 0x24: |
+ return "Home"; |
+ case 0x2d: |
+ return "Insert"; |
+ case 0x25: |
+ return "Left"; |
+ case 0x22: |
+ return "PageDown"; |
+ case 0x21: |
+ return "PageUp"; |
+ case 0x13: |
+ return "Pause"; |
+ case 0x2c: |
+ return "PrintScreen"; |
+ case 0x27: |
+ return "Right"; |
+ case 0x91: |
+ return "Scroll"; |
+ case 0x29: |
+ return "Select"; |
+ case 0x26: |
+ return "Up"; |
+ case 0x2e: |
+ return "U+007F"; // Standard says that DEL becomes U+007F. |
+ case 0xb0: |
+ return "MediaNextTrack"; |
+ case 0xb1: |
+ return "MediaPreviousTrack"; |
+ case 0xb2: |
+ return "MediaStop"; |
+ case 0xb3: |
+ return "MediaPlayPause"; |
+ case 0xad: |
+ return "VolumeMute"; |
+ case 0xae: |
+ return "VolumeDown"; |
+ case 0xaf: |
+ return "VolumeUp"; |
+ default: |
+ var hexString = keyCode.toString(16).toUpperCase(); |
+ var result = "U+"; |
+ for (var i = hexString.length; i < 4; ++i) |
+ result += "0"; |
+ result += hexString; |
+ return result; |
+ } |
+ } |
+ |
+ |
+ // Support for legacy (<M53) frontends. |
+ if (!window.KeyboardEvent.prototype.hasOwnProperty("keyIdentifier")) { |
+ Object.defineProperty(window.KeyboardEvent.prototype, "keyIdentifier", { |
+ get: function() { |
caseq
2016/06/10 18:59:11
{ => next line
dtapuska
2016/06/10 20:25:43
Done.
|
+ if (this.__keyIdentifier === undefined) |
caseq
2016/06/10 18:59:11
use symbols perhaps? I.e. var keyIdentifier = Symb
dtapuska
2016/06/10 20:25:43
I removed this
|
+ this.__keyIdentifier = keyCodeToKeyIdentifier(this.keyCode); |
+ return this.__keyIdentifier; |
+ }, |
+ set: function(value) { |
caseq
2016/06/10 18:59:11
do we use it? looks like you can drop it.
dtapuska
2016/06/10 20:25:43
Done.
|
+ this.__keyIdentifier = value; |
+ } |
+ }); |
+ } |
+ |
// Support for legacy (<M50) frontends. |
installObjectObserve(); |