Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(346)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/devtools.js

Issue 2033403005: Eradicate keyIndentifier from devtools/* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add keyIdentifier getter/setter if keyIdentifier is not defined Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
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 function keyCodeToKeyIdentifier(keyCode) {
caseq 2016/06/10 18:59:11 { => next line
dtapuska 2016/06/10 20:25:43 Done.
1012 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.
1013 case 0x12:
1014 return "Alt";
1015 case 0x11:
1016 return "Control";
1017 case 0x10:
1018 return "Shift";
1019 case 0x14:
1020 return "CapsLock";
1021 case 0x5b:
1022 case 0x5c:
1023 return "Win";
1024 case 0x0c:
1025 return "Clear";
1026 case 0x28:
1027 return "Down";
1028 case 0x23:
1029 return "End";
1030 case 0x0a: // Carriage return
1031 case 0x0d:
1032 return "Enter";
1033 case 0x2b:
1034 return "Execute";
1035 case 0x70:
1036 return "F1";
1037 case 0x71:
1038 return "F2";
1039 case 0x72:
1040 return "F3";
1041 case 0x73:
1042 return "F4";
1043 case 0x74:
1044 return "F5";
1045 case 0x75:
1046 return "F6";
1047 case 0x76:
1048 return "F7";
1049 case 0x77:
1050 return "F8";
1051 case 0x78:
1052 return "F9";
1053 case 0x79:
1054 return "F10";
1055 case 0x7a:
1056 return "F11";
1057 case 0x7b:
1058 return "F12";
1059 case 0x7c:
1060 return "F13";
1061 case 0x7d:
1062 return "F14";
1063 case 0x7e:
1064 return "F15";
1065 case 0x7f:
1066 return "F16";
1067 case 0x80:
1068 return "F17";
1069 case 0x81:
1070 return "F18";
1071 case 0x82:
1072 return "F19";
1073 case 0x83:
1074 return "F20";
1075 case 0x84:
1076 return "F21";
1077 case 0x85:
1078 return "F22";
1079 case 0x86:
1080 return "F23";
1081 case 0x87:
1082 return "F24";
1083 case 0x2f:
1084 return "Help";
1085 case 0x24:
1086 return "Home";
1087 case 0x2d:
1088 return "Insert";
1089 case 0x25:
1090 return "Left";
1091 case 0x22:
1092 return "PageDown";
1093 case 0x21:
1094 return "PageUp";
1095 case 0x13:
1096 return "Pause";
1097 case 0x2c:
1098 return "PrintScreen";
1099 case 0x27:
1100 return "Right";
1101 case 0x91:
1102 return "Scroll";
1103 case 0x29:
1104 return "Select";
1105 case 0x26:
1106 return "Up";
1107 case 0x2e:
1108 return "U+007F"; // Standard says that DEL becomes U+007F.
1109 case 0xb0:
1110 return "MediaNextTrack";
1111 case 0xb1:
1112 return "MediaPreviousTrack";
1113 case 0xb2:
1114 return "MediaStop";
1115 case 0xb3:
1116 return "MediaPlayPause";
1117 case 0xad:
1118 return "VolumeMute";
1119 case 0xae:
1120 return "VolumeDown";
1121 case 0xaf:
1122 return "VolumeUp";
1123 default:
1124 var hexString = keyCode.toString(16).toUpperCase();
1125 var result = "U+";
1126 for (var i = hexString.length; i < 4; ++i)
1127 result += "0";
1128 result += hexString;
1129 return result;
1130 }
1131 }
1132
1133
1134 // Support for legacy (<M53) frontends.
1135 if (!window.KeyboardEvent.prototype.hasOwnProperty("keyIdentifier")) {
1136 Object.defineProperty(window.KeyboardEvent.prototype, "keyIdentifier", {
1137 get: function() {
caseq 2016/06/10 18:59:11 { => next line
dtapuska 2016/06/10 20:25:43 Done.
1138 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
1139 this.__keyIdentifier = keyCodeToKeyIdentifier(this.keyCode);
1140 return this.__keyIdentifier;
1141 },
1142 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.
1143 this.__keyIdentifier = value;
1144 }
1145 });
1146 }
1147
1011 // Support for legacy (<M50) frontends. 1148 // Support for legacy (<M50) frontends.
1012 installObjectObserve(); 1149 installObjectObserve();
1013 1150
1014 /** 1151 /**
1015 * @this {CSSStyleDeclaration} 1152 * @this {CSSStyleDeclaration}
1016 */ 1153 */
1017 function getValue(property) 1154 function getValue(property)
1018 { 1155 {
1019 // Note that |property| comes from another context, so we can't use === here. 1156 // Note that |property| comes from another context, so we can't use === here.
1020 // eslint-disable-next-line eqeqeq 1157 // eslint-disable-next-line eqeqeq
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1071 1208
1072 if (!DOMTokenList.prototype.__originalDOMTokenListToggle) { 1209 if (!DOMTokenList.prototype.__originalDOMTokenListToggle) {
1073 DOMTokenList.prototype.__originalDOMTokenListToggle = DOMTokenList.prototype .toggle; 1210 DOMTokenList.prototype.__originalDOMTokenListToggle = DOMTokenList.prototype .toggle;
1074 DOMTokenList.prototype.toggle = function(token, force) 1211 DOMTokenList.prototype.toggle = function(token, force)
1075 { 1212 {
1076 if (arguments.length === 1) 1213 if (arguments.length === 1)
1077 force = !this.contains(token); 1214 force = !this.contains(token);
1078 return this.__originalDOMTokenListToggle(token, !!force); 1215 return this.__originalDOMTokenListToggle(token, !!force);
1079 } 1216 }
1080 } 1217 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698