OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 /* eslint-disable indent */ | 5 /* eslint-disable indent */ |
6 (function(window) { | 6 (function(window) { |
7 | 7 |
8 // DevToolsAPI ---------------------------------------------------------------- | 8 // DevToolsAPI ---------------------------------------------------------------- |
9 | 9 |
10 /** | 10 /** |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
222 /** | 222 /** |
223 * @param {number} requestId | 223 * @param {number} requestId |
224 * @param {string} fileSystemPath | 224 * @param {string} fileSystemPath |
225 */ | 225 */ |
226 indexingDone: function(requestId, fileSystemPath) | 226 indexingDone: function(requestId, fileSystemPath) |
227 { | 227 { |
228 this._dispatchOnInspectorFrontendAPI("indexingDone", [requestId, fileSys temPath]); | 228 this._dispatchOnInspectorFrontendAPI("indexingDone", [requestId, fileSys temPath]); |
229 }, | 229 }, |
230 | 230 |
231 /** | 231 /** |
232 * @param {{type: string, keyIdentifier: string, keyCode: number, modifiers: number}} event | 232 * @param {{type: string, key: string, code: string, keyIdentifier: string, keyCode: number, modifiers: number}} event |
dgozman
2016/06/16 06:55:00
Perhaps we can use the same keyCodeToKeyIdentifier
dtapuska
2016/06/16 07:36:11
Done.
| |
233 */ | 233 */ |
234 keyEventUnhandled: function(event) | 234 keyEventUnhandled: function(event) |
235 { | 235 { |
236 this._dispatchOnInspectorFrontendAPI("keyEventUnhandled", [event]); | 236 this._dispatchOnInspectorFrontendAPI("keyEventUnhandled", [event]); |
237 }, | 237 }, |
238 | 238 |
239 /** | 239 /** |
240 * @param {boolean} hard | 240 * @param {boolean} hard |
241 */ | 241 */ |
242 reloadInspectedPage: function(hard) | 242 reloadInspectedPage: function(hard) |
(...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1001 /** | 1001 /** |
1002 * @suppressGlobalPropertiesCheck | 1002 * @suppressGlobalPropertiesCheck |
1003 */ | 1003 */ |
1004 function installBackwardsCompatibility() | 1004 function installBackwardsCompatibility() |
1005 { | 1005 { |
1006 sanitizeRemoteFrontendUrl(); | 1006 sanitizeRemoteFrontendUrl(); |
1007 | 1007 |
1008 if (window.location.search.indexOf("remoteFrontend") === -1) | 1008 if (window.location.search.indexOf("remoteFrontend") === -1) |
1009 return; | 1009 return; |
1010 | 1010 |
1011 var staticKeyIdentifiers = new Map([ | |
1012 [0x12, "Alt"], | |
1013 [0x11, "Control"], | |
1014 [0x10, "Shift"], | |
1015 [0x14, "CapsLock"], | |
1016 [0x5b, "Win"], | |
1017 [0x5c, "Win"], | |
1018 [0x0c, "Clear"], | |
1019 [0x28, "Down"], | |
1020 [0x23, "End"], | |
1021 [0x0a, "Enter"], | |
1022 [0x0d, "Enter"], | |
1023 [0x2b, "Execute"], | |
1024 [0x70, "F1"], | |
1025 [0x71, "F2"], | |
1026 [0x72, "F3"], | |
1027 [0x73, "F4"], | |
1028 [0x74, "F5"], | |
1029 [0x75, "F6"], | |
1030 [0x76, "F7"], | |
1031 [0x77, "F8"], | |
1032 [0x78, "F9"], | |
1033 [0x79, "F10"], | |
1034 [0x7a, "F11"], | |
1035 [0x7b, "F12"], | |
1036 [0x7c, "F13"], | |
1037 [0x7d, "F14"], | |
1038 [0x7e, "F15"], | |
1039 [0x7f, "F16"], | |
1040 [0x80, "F17"], | |
1041 [0x81, "F18"], | |
1042 [0x82, "F19"], | |
1043 [0x83, "F20"], | |
1044 [0x84, "F21"], | |
1045 [0x85, "F22"], | |
1046 [0x86, "F23"], | |
1047 [0x87, "F24"], | |
1048 [0x2f, "Help"], | |
1049 [0x24, "Home"], | |
1050 [0x2d, "Insert"], | |
1051 [0x25, "Left"], | |
1052 [0x22, "PageDown"], | |
1053 [0x21, "PageUp"], | |
1054 [0x13, "Pause"], | |
1055 [0x2c, "PrintScreen"], | |
1056 [0x27, "Right"], | |
1057 [0x91, "Scroll"], | |
1058 [0x29, "Select"], | |
1059 [0x26, "Up"], | |
1060 [0x2e, "U+007F"], // Standard says that DEL becomes U+007F. | |
1061 [0xb0, "MediaNextTrack"], | |
1062 [0xb1, "MediaPreviousTrack"], | |
1063 [0xb2, "MediaStop"], | |
1064 [0xb3, "MediaPlayPause"], | |
1065 [0xad, "VolumeMute"], | |
1066 [0xae, "VolumeDown"], | |
1067 [0xaf, "VolumeUp"], | |
1068 ]); | |
1069 | |
1070 function keyCodeToKeyIdentifier(keyCode) | |
1071 { | |
1072 var result = staticKeyIdentifiers.get(keyCode); | |
1073 if (result !== undefined) | |
1074 return result; | |
1075 result = "U+"; | |
1076 var hexString = keyCode.toString(16).toUpperCase(); | |
1077 for (var i = hexString.length; i < 4; ++i) | |
1078 result += "0"; | |
1079 result += hexString; | |
1080 return result; | |
1081 } | |
1082 | |
1083 // Support for legacy (<M53) frontends. | |
1084 if (!window.KeyboardEvent.prototype.hasOwnProperty("keyIdentifier")) { | |
1085 Object.defineProperty(window.KeyboardEvent.prototype, "keyIdentifier", { | |
1086 get: function() | |
1087 { | |
1088 return keyCodeToKeyIdentifier(this.keyCode); | |
1089 } | |
1090 }); | |
1091 } | |
1092 | |
1011 // Support for legacy (<M50) frontends. | 1093 // Support for legacy (<M50) frontends. |
1012 installObjectObserve(); | 1094 installObjectObserve(); |
1013 | 1095 |
1014 /** | 1096 /** |
1015 * @this {CSSStyleDeclaration} | 1097 * @this {CSSStyleDeclaration} |
1016 */ | 1098 */ |
1017 function getValue(property) | 1099 function getValue(property) |
1018 { | 1100 { |
1019 // Note that |property| comes from another context, so we can't use === here. | 1101 // Note that |property| comes from another context, so we can't use === here. |
1020 // eslint-disable-next-line eqeqeq | 1102 // eslint-disable-next-line eqeqeq |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1071 | 1153 |
1072 if (!DOMTokenList.prototype.__originalDOMTokenListToggle) { | 1154 if (!DOMTokenList.prototype.__originalDOMTokenListToggle) { |
1073 DOMTokenList.prototype.__originalDOMTokenListToggle = DOMTokenList.prototype .toggle; | 1155 DOMTokenList.prototype.__originalDOMTokenListToggle = DOMTokenList.prototype .toggle; |
1074 DOMTokenList.prototype.toggle = function(token, force) | 1156 DOMTokenList.prototype.toggle = function(token, force) |
1075 { | 1157 { |
1076 if (arguments.length === 1) | 1158 if (arguments.length === 1) |
1077 force = !this.contains(token); | 1159 force = !this.contains(token); |
1078 return this.__originalDOMTokenListToggle(token, !!force); | 1160 return this.__originalDOMTokenListToggle(token, !!force); |
1079 } | 1161 } |
1080 } | 1162 } |
OLD | NEW |