Changeset 233149 in webkit
- Timestamp:
- Jun 25, 2018 9:22:08 AM (6 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r233133 r233149 1 2018-06-23 Brian Burg <bburg@apple.com> 2 3 [Mac] Web Automation: include correct key code with synthesized NSEvents used for keystrokes 4 https://bugs.webkit.org/show_bug.cgi?id=186937 5 6 Reviewed by Timothy Hatcher. 7 8 In some cases, a missing keyCode for an ASCII letter/number can cause synthesized 9 NSEvents to not be converted into a key equivalent action like copy: or paste:. 10 11 * UIProcess/Automation/mac/WebAutomationSessionMac.mm: 12 Drive by, always initialize keyCode. 13 14 (WebKit::WebAutomationSession::platformSimulateKeyboardInteraction): 15 (WebKit::keyCodeForCharKey): Compute the keyCode as defined by HLTB headers. 16 This only needs to be computed for characters with physical keys, excluding the 17 number pad and some traditional virtual keys that do not usually have glyphs. 18 1 19 2018-06-24 Michael Catanzaro <mcatanzaro@igalia.com> 2 20 -
trunk/Source/WebKit/UIProcess/Automation/mac/WebAutomationSessionMac.mm
r233131 r233149 224 224 return false; 225 225 } 226 } 227 228 static int keyCodeForCharKey(CharKey key) 229 { 230 switch (key) { 231 case 'q': 232 case 'Q': 233 return kVK_ANSI_Q; 234 case 'w': 235 case 'W': 236 return kVK_ANSI_W; 237 case 'e': 238 case 'E': 239 return kVK_ANSI_E; 240 case 'r': 241 case 'R': 242 return kVK_ANSI_R; 243 case 't': 244 case 'T': 245 return kVK_ANSI_T; 246 case 'y': 247 case 'Y': 248 return kVK_ANSI_Y; 249 case 'u': 250 case 'U': 251 return kVK_ANSI_U; 252 case 'i': 253 case 'I': 254 return kVK_ANSI_I; 255 case 'o': 256 case 'O': 257 return kVK_ANSI_O; 258 case 'p': 259 case 'P': 260 return kVK_ANSI_P; 261 case 'a': 262 case 'A': 263 return kVK_ANSI_A; 264 case 's': 265 case 'S': 266 return kVK_ANSI_S; 267 case 'd': 268 case 'D': 269 return kVK_ANSI_D; 270 case 'f': 271 case 'F': 272 return kVK_ANSI_F; 273 case 'g': 274 case 'G': 275 return kVK_ANSI_G; 276 case 'h': 277 case 'H': 278 return kVK_ANSI_H; 279 case 'j': 280 case 'J': 281 return kVK_ANSI_J; 282 case 'k': 283 case 'K': 284 return kVK_ANSI_K; 285 case 'l': 286 case 'L': 287 return kVK_ANSI_L; 288 case 'z': 289 case 'Z': 290 return kVK_ANSI_Z; 291 case 'x': 292 case 'X': 293 return kVK_ANSI_X; 294 case 'c': 295 case 'C': 296 return kVK_ANSI_C; 297 case 'v': 298 case 'V': 299 return kVK_ANSI_V; 300 case 'b': 301 case 'B': 302 return kVK_ANSI_B; 303 case 'n': 304 case 'N': 305 return kVK_ANSI_N; 306 case 'm': 307 case 'M': 308 return kVK_ANSI_M; 309 case '1': 310 return kVK_ANSI_1; 311 case '2': 312 return kVK_ANSI_2; 313 case '3': 314 return kVK_ANSI_3; 315 case '4': 316 return kVK_ANSI_4; 317 case '5': 318 return kVK_ANSI_5; 319 case '6': 320 return kVK_ANSI_6; 321 case '7': 322 return kVK_ANSI_7; 323 case '8': 324 return kVK_ANSI_8; 325 case '9': 326 return kVK_ANSI_9; 327 case '0': 328 return kVK_ANSI_0; 329 case '=': 330 case '+': 331 return kVK_ANSI_Equal; 332 case '-': 333 case '_': 334 return kVK_ANSI_Minus; 335 case '[': 336 case '{': 337 return kVK_ANSI_LeftBracket; 338 case ']': 339 case '}': 340 return kVK_ANSI_RightBracket; 341 case '\'': 342 case '"': 343 return kVK_ANSI_Quote; 344 case ';': 345 case ':': 346 return kVK_ANSI_Semicolon; 347 case '\\': 348 case '|': 349 return kVK_ANSI_Backslash; 350 case ',': 351 case '<': 352 return kVK_ANSI_Comma; 353 case '.': 354 case '>': 355 return kVK_ANSI_Period; 356 case '/': 357 case '?': 358 return kVK_ANSI_Slash; 359 case '`': 360 case '~': 361 return kVK_ANSI_Grave; 362 } 363 364 return 0; 226 365 } 227 366 … … 433 572 bool isStickyModifier = false; 434 573 NSEventModifierFlags changedModifiers = 0; 435 int keyCode ;574 int keyCode = 0; 436 575 std::optional<unichar> charCode; 437 576 std::optional<unichar> charCodeIgnoringModifiers; … … 446 585 }, 447 586 [&] (CharKey charKey) { 587 keyCode = keyCodeForCharKey(charKey); 448 588 charCode = (unichar)charKey; 449 589 charCodeIgnoringModifiers = (unichar)charKey;
Note: See TracChangeset
for help on using the changeset viewer.