1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 package org.htmlunit.javascript.host.event;
16
17 import static org.htmlunit.BrowserVersionFeatures.JS_EVENT_KEYBOARD_CTOR_WHICH;
18 import static org.htmlunit.BrowserVersionFeatures.KEYBOARD_EVENT_OEM_KEY_CODES;
19 import static org.htmlunit.javascript.configuration.SupportedBrowser.FF;
20 import static org.htmlunit.javascript.configuration.SupportedBrowser.FF_ESR;
21
22 import java.util.HashMap;
23 import java.util.Map;
24
25 import org.htmlunit.Page;
26 import org.htmlunit.corejs.javascript.Context;
27 import org.htmlunit.corejs.javascript.Function;
28 import org.htmlunit.corejs.javascript.Scriptable;
29 import org.htmlunit.corejs.javascript.ScriptableObject;
30 import org.htmlunit.corejs.javascript.VarScope;
31 import org.htmlunit.html.DomNode;
32 import org.htmlunit.javascript.JavaScriptEngine;
33 import org.htmlunit.javascript.configuration.JsxClass;
34 import org.htmlunit.javascript.configuration.JsxConstant;
35 import org.htmlunit.javascript.configuration.JsxConstructor;
36 import org.htmlunit.javascript.configuration.JsxFunction;
37 import org.htmlunit.javascript.configuration.JsxGetter;
38
39
40
41
42
43
44
45
46
47
48
49 @JsxClass
50 public class KeyboardEvent extends UIEvent {
51
52
53 @JsxConstant
54 public static final int DOM_KEY_LOCATION_STANDARD = 0;
55
56
57 @JsxConstant
58 public static final int DOM_KEY_LOCATION_LEFT = 1;
59
60
61 @JsxConstant
62 public static final int DOM_KEY_LOCATION_RIGHT = 2;
63
64
65 @JsxConstant
66 public static final int DOM_KEY_LOCATION_NUMPAD = 3;
67
68
69 @JsxConstant({FF, FF_ESR})
70 public static final int DOM_VK_CANCEL = 3;
71
72
73 @JsxConstant({FF, FF_ESR})
74 public static final int DOM_VK_HELP = 6;
75
76
77 @JsxConstant({FF, FF_ESR})
78 public static final int DOM_VK_BACK_SPACE = 8;
79
80
81 @JsxConstant({FF, FF_ESR})
82 public static final int DOM_VK_TAB = 9;
83
84
85 @JsxConstant({FF, FF_ESR})
86 public static final int DOM_VK_CLEAR = 12;
87
88
89 @JsxConstant({FF, FF_ESR})
90 public static final int DOM_VK_RETURN = 13;
91
92
93 @JsxConstant({FF, FF_ESR})
94 public static final int DOM_VK_SHIFT = 16;
95
96
97 @JsxConstant({FF, FF_ESR})
98 public static final int DOM_VK_CONTROL = 17;
99
100
101 @JsxConstant({FF, FF_ESR})
102 public static final int DOM_VK_ALT = 18;
103
104
105 @JsxConstant({FF, FF_ESR})
106 public static final int DOM_VK_PAUSE = 19;
107
108
109 @JsxConstant({FF, FF_ESR})
110 public static final int DOM_VK_CAPS_LOCK = 20;
111
112
113 @JsxConstant({FF, FF_ESR})
114 public static final int DOM_VK_HANGUL = 21;
115
116
117 @JsxConstant({FF, FF_ESR})
118 public static final int DOM_VK_KANA = 21;
119
120
121 @JsxConstant({FF, FF_ESR})
122 public static final int DOM_VK_EISU = 22;
123
124
125 @JsxConstant({FF, FF_ESR})
126 public static final int DOM_VK_FINAL = 24;
127
128
129 @JsxConstant({FF, FF_ESR})
130 public static final int DOM_VK_JUNJA = 23;
131
132
133 @JsxConstant({FF, FF_ESR})
134 public static final int DOM_VK_HANJA = 25;
135
136
137 @JsxConstant({FF, FF_ESR})
138 public static final int DOM_VK_KANJI = 25;
139
140
141 @JsxConstant({FF, FF_ESR})
142 public static final int DOM_VK_ESCAPE = 27;
143
144
145 @JsxConstant({FF, FF_ESR})
146 public static final int DOM_VK_CONVERT = 28;
147
148
149 @JsxConstant({FF, FF_ESR})
150 public static final int DOM_VK_NONCONVERT = 29;
151
152
153 @JsxConstant({FF, FF_ESR})
154 public static final int DOM_VK_ACCEPT = 30;
155
156
157 @JsxConstant({FF, FF_ESR})
158 public static final int DOM_VK_MODECHANGE = 31;
159
160
161 @JsxConstant({FF, FF_ESR})
162 public static final int DOM_VK_SPACE = 32;
163
164
165 @JsxConstant({FF, FF_ESR})
166 public static final int DOM_VK_PAGE_UP = 33;
167
168
169 @JsxConstant({FF, FF_ESR})
170 public static final int DOM_VK_PAGE_DOWN = 34;
171
172
173 @JsxConstant({FF, FF_ESR})
174 public static final int DOM_VK_END = 35;
175
176
177 @JsxConstant({FF, FF_ESR})
178 public static final int DOM_VK_HOME = 36;
179
180
181 @JsxConstant({FF, FF_ESR})
182 public static final int DOM_VK_LEFT = 37;
183
184
185 @JsxConstant({FF, FF_ESR})
186 public static final int DOM_VK_UP = 38;
187
188
189 @JsxConstant({FF, FF_ESR})
190 public static final int DOM_VK_RIGHT = 39;
191
192
193 @JsxConstant({FF, FF_ESR})
194 public static final int DOM_VK_SELECT = 41;
195
196
197 @JsxConstant({FF, FF_ESR})
198 public static final int DOM_VK_DOWN = 40;
199
200
201 @JsxConstant({FF, FF_ESR})
202 public static final int DOM_VK_PRINT = 42;
203
204
205 @JsxConstant({FF, FF_ESR})
206 public static final int DOM_VK_EXECUTE = 43;
207
208
209 @JsxConstant({FF, FF_ESR})
210 public static final int DOM_VK_PRINTSCREEN = 44;
211
212
213 @JsxConstant({FF, FF_ESR})
214 public static final int DOM_VK_INSERT = 45;
215
216
217 @JsxConstant({FF, FF_ESR})
218 public static final int DOM_VK_DELETE = 46;
219
220
221 @JsxConstant({FF, FF_ESR})
222 public static final int DOM_VK_0 = 48;
223
224
225 @JsxConstant({FF, FF_ESR})
226 public static final int DOM_VK_1 = 49;
227
228
229 @JsxConstant({FF, FF_ESR})
230 public static final int DOM_VK_2 = 50;
231
232
233 @JsxConstant({FF, FF_ESR})
234 public static final int DOM_VK_3 = 51;
235
236
237 @JsxConstant({FF, FF_ESR})
238 public static final int DOM_VK_4 = 52;
239
240
241 @JsxConstant({FF, FF_ESR})
242 public static final int DOM_VK_5 = 53;
243
244
245 @JsxConstant({FF, FF_ESR})
246 public static final int DOM_VK_6 = 54;
247
248
249 @JsxConstant({FF, FF_ESR})
250 public static final int DOM_VK_7 = 55;
251
252
253 @JsxConstant({FF, FF_ESR})
254 public static final int DOM_VK_8 = 56;
255
256
257 @JsxConstant({FF, FF_ESR})
258 public static final int DOM_VK_9 = 57;
259
260
261 @JsxConstant({FF, FF_ESR})
262 public static final int DOM_VK_COLON = 58;
263
264
265 @JsxConstant({FF, FF_ESR})
266 public static final int DOM_VK_SEMICOLON = 59;
267
268
269 @JsxConstant({FF, FF_ESR})
270 public static final int DOM_VK_LESS_THAN = 60;
271
272
273 @JsxConstant({FF, FF_ESR})
274 public static final int DOM_VK_EQUALS = 61;
275
276
277 @JsxConstant({FF, FF_ESR})
278 public static final int DOM_VK_GREATER_THAN = 62;
279
280
281 @JsxConstant({FF, FF_ESR})
282 public static final int DOM_VK_QUESTION_MARK = 63;
283
284
285 @JsxConstant({FF, FF_ESR})
286 public static final int DOM_VK_AT = 64;
287
288
289 @JsxConstant({FF, FF_ESR})
290 public static final int DOM_VK_A = 65;
291
292
293 @JsxConstant({FF, FF_ESR})
294 public static final int DOM_VK_B = 66;
295
296
297 @JsxConstant({FF, FF_ESR})
298 public static final int DOM_VK_C = 67;
299
300
301 @JsxConstant({FF, FF_ESR})
302 public static final int DOM_VK_D = 68;
303
304
305 @JsxConstant({FF, FF_ESR})
306 public static final int DOM_VK_E = 69;
307
308
309 @JsxConstant({FF, FF_ESR})
310 public static final int DOM_VK_F = 70;
311
312
313 @JsxConstant({FF, FF_ESR})
314 public static final int DOM_VK_G = 71;
315
316
317 @JsxConstant({FF, FF_ESR})
318 public static final int DOM_VK_H = 72;
319
320
321 @JsxConstant({FF, FF_ESR})
322 public static final int DOM_VK_I = 73;
323
324
325 @JsxConstant({FF, FF_ESR})
326 public static final int DOM_VK_J = 74;
327
328
329 @JsxConstant({FF, FF_ESR})
330 public static final int DOM_VK_K = 75;
331
332
333 @JsxConstant({FF, FF_ESR})
334 public static final int DOM_VK_L = 76;
335
336
337 @JsxConstant({FF, FF_ESR})
338 public static final int DOM_VK_M = 77;
339
340
341 @JsxConstant({FF, FF_ESR})
342 public static final int DOM_VK_N = 78;
343
344
345 @JsxConstant({FF, FF_ESR})
346 public static final int DOM_VK_O = 79;
347
348
349 @JsxConstant({FF, FF_ESR})
350 public static final int DOM_VK_P = 80;
351
352
353 @JsxConstant({FF, FF_ESR})
354 public static final int DOM_VK_Q = 81;
355
356
357 @JsxConstant({FF, FF_ESR})
358 public static final int DOM_VK_R = 82;
359
360
361 @JsxConstant({FF, FF_ESR})
362 public static final int DOM_VK_S = 83;
363
364
365 @JsxConstant({FF, FF_ESR})
366 public static final int DOM_VK_T = 84;
367
368
369 @JsxConstant({FF, FF_ESR})
370 public static final int DOM_VK_U = 85;
371
372
373 @JsxConstant({FF, FF_ESR})
374 public static final int DOM_VK_V = 86;
375
376
377 @JsxConstant({FF, FF_ESR})
378 public static final int DOM_VK_W = 87;
379
380
381 @JsxConstant({FF, FF_ESR})
382 public static final int DOM_VK_X = 88;
383
384
385 @JsxConstant({FF, FF_ESR})
386 public static final int DOM_VK_Y = 89;
387
388
389 @JsxConstant({FF, FF_ESR})
390 public static final int DOM_VK_Z = 90;
391
392
393 @JsxConstant({FF, FF_ESR})
394 public static final int DOM_VK_WIN = 91;
395
396
397 @JsxConstant({FF, FF_ESR})
398 public static final int DOM_VK_CONTEXT_MENU = 93;
399
400
401 @JsxConstant({FF, FF_ESR})
402 public static final int DOM_VK_SLEEP = 95;
403
404
405 @JsxConstant({FF, FF_ESR})
406 public static final int DOM_VK_NUMPAD0 = 96;
407
408
409 @JsxConstant({FF, FF_ESR})
410 public static final int DOM_VK_NUMPAD1 = 97;
411
412
413 @JsxConstant({FF, FF_ESR})
414 public static final int DOM_VK_NUMPAD2 = 98;
415
416
417 @JsxConstant({FF, FF_ESR})
418 public static final int DOM_VK_NUMPAD3 = 99;
419
420
421 @JsxConstant({FF, FF_ESR})
422 public static final int DOM_VK_NUMPAD4 = 100;
423
424
425 @JsxConstant({FF, FF_ESR})
426 public static final int DOM_VK_NUMPAD5 = 101;
427
428
429 @JsxConstant({FF, FF_ESR})
430 public static final int DOM_VK_NUMPAD6 = 102;
431
432
433 @JsxConstant({FF, FF_ESR})
434 public static final int DOM_VK_NUMPAD7 = 103;
435
436
437 @JsxConstant({FF, FF_ESR})
438 public static final int DOM_VK_NUMPAD8 = 104;
439
440
441 @JsxConstant({FF, FF_ESR})
442 public static final int DOM_VK_NUMPAD9 = 105;
443
444
445 @JsxConstant({FF, FF_ESR})
446 public static final int DOM_VK_MULTIPLY = 106;
447
448
449 @JsxConstant({FF, FF_ESR})
450 public static final int DOM_VK_ADD = 107;
451
452
453 @JsxConstant({FF, FF_ESR})
454 public static final int DOM_VK_SEPARATOR = 108;
455
456
457 @JsxConstant({FF, FF_ESR})
458 public static final int DOM_VK_SUBTRACT = 109;
459
460
461 @JsxConstant({FF, FF_ESR})
462 public static final int DOM_VK_DECIMAL = 110;
463
464
465 @JsxConstant({FF, FF_ESR})
466 public static final int DOM_VK_DIVIDE = 111;
467
468
469 @JsxConstant({FF, FF_ESR})
470 public static final int DOM_VK_F1 = 112;
471
472
473 @JsxConstant({FF, FF_ESR})
474 public static final int DOM_VK_F2 = 113;
475
476
477 @JsxConstant({FF, FF_ESR})
478 public static final int DOM_VK_F3 = 114;
479
480
481 @JsxConstant({FF, FF_ESR})
482 public static final int DOM_VK_F4 = 115;
483
484
485 @JsxConstant({FF, FF_ESR})
486 public static final int DOM_VK_F5 = 116;
487
488
489 @JsxConstant({FF, FF_ESR})
490 public static final int DOM_VK_F6 = 117;
491
492
493 @JsxConstant({FF, FF_ESR})
494 public static final int DOM_VK_F7 = 118;
495
496
497 @JsxConstant({FF, FF_ESR})
498 public static final int DOM_VK_F8 = 119;
499
500
501 @JsxConstant({FF, FF_ESR})
502 public static final int DOM_VK_F9 = 120;
503
504
505 @JsxConstant({FF, FF_ESR})
506 public static final int DOM_VK_F10 = 121;
507
508
509 @JsxConstant({FF, FF_ESR})
510 public static final int DOM_VK_F11 = 122;
511
512
513 @JsxConstant({FF, FF_ESR})
514 public static final int DOM_VK_F12 = 123;
515
516
517 @JsxConstant({FF, FF_ESR})
518 public static final int DOM_VK_F13 = 124;
519
520
521 @JsxConstant({FF, FF_ESR})
522 public static final int DOM_VK_F14 = 125;
523
524
525 @JsxConstant({FF, FF_ESR})
526 public static final int DOM_VK_F15 = 126;
527
528
529 @JsxConstant({FF, FF_ESR})
530 public static final int DOM_VK_F16 = 127;
531
532
533 @JsxConstant({FF, FF_ESR})
534 public static final int DOM_VK_F17 = 128;
535
536
537 @JsxConstant({FF, FF_ESR})
538 public static final int DOM_VK_F18 = 129;
539
540
541 @JsxConstant({FF, FF_ESR})
542 public static final int DOM_VK_F19 = 130;
543
544
545 @JsxConstant({FF, FF_ESR})
546 public static final int DOM_VK_F20 = 131;
547
548
549 @JsxConstant({FF, FF_ESR})
550 public static final int DOM_VK_F21 = 132;
551
552
553 @JsxConstant({FF, FF_ESR})
554 public static final int DOM_VK_F22 = 133;
555
556
557 @JsxConstant({FF, FF_ESR})
558 public static final int DOM_VK_F23 = 134;
559
560
561 @JsxConstant({FF, FF_ESR})
562 public static final int DOM_VK_F24 = 135;
563
564
565 @JsxConstant({FF, FF_ESR})
566 public static final int DOM_VK_NUM_LOCK = 144;
567
568
569 @JsxConstant({FF, FF_ESR})
570 public static final int DOM_VK_SCROLL_LOCK = 145;
571
572
573 @JsxConstant({FF, FF_ESR})
574 public static final int DOM_VK_WIN_OEM_FJ_JISHO = 146;
575
576
577 @JsxConstant({FF, FF_ESR})
578 public static final int DOM_VK_WIN_OEM_FJ_MASSHOU = 147;
579
580
581 @JsxConstant({FF, FF_ESR})
582 public static final int DOM_VK_WIN_OEM_FJ_TOUROKU = 148;
583
584
585 @JsxConstant({FF, FF_ESR})
586 public static final int DOM_VK_WIN_OEM_FJ_LOYA = 149;
587
588
589 @JsxConstant({FF, FF_ESR})
590 public static final int DOM_VK_WIN_OEM_FJ_ROYA = 150;
591
592
593 @JsxConstant({FF, FF_ESR})
594 public static final int DOM_VK_CIRCUMFLEX = 160;
595
596
597 @JsxConstant({FF, FF_ESR})
598 public static final int DOM_VK_EXCLAMATION = 161;
599
600
601 @JsxConstant({FF, FF_ESR})
602 public static final int DOM_VK_DOUBLE_QUOTE = 162;
603
604
605 @JsxConstant({FF, FF_ESR})
606 public static final int DOM_VK_HASH = 163;
607
608
609 @JsxConstant({FF, FF_ESR})
610 public static final int DOM_VK_DOLLAR = 164;
611
612
613 @JsxConstant({FF, FF_ESR})
614 public static final int DOM_VK_PERCENT = 165;
615
616
617 @JsxConstant({FF, FF_ESR})
618 public static final int DOM_VK_AMPERSAND = 166;
619
620
621 @JsxConstant({FF, FF_ESR})
622 public static final int DOM_VK_UNDERSCORE = 167;
623
624
625 @JsxConstant({FF, FF_ESR})
626 public static final int DOM_VK_OPEN_PAREN = 168;
627
628
629 @JsxConstant({FF, FF_ESR})
630 public static final int DOM_VK_CLOSE_PAREN = 169;
631
632
633 @JsxConstant({FF, FF_ESR})
634 public static final int DOM_VK_ASTERISK = 170;
635
636
637 @JsxConstant({FF, FF_ESR})
638 public static final int DOM_VK_PLUS = 171;
639
640
641 @JsxConstant({FF, FF_ESR})
642 public static final int DOM_VK_PIPE = 172;
643
644
645 @JsxConstant({FF, FF_ESR})
646 public static final int DOM_VK_HYPHEN_MINUS = 173;
647
648
649 @JsxConstant({FF, FF_ESR})
650 public static final int DOM_VK_OPEN_CURLY_BRACKET = 174;
651
652
653 @JsxConstant({FF, FF_ESR})
654 public static final int DOM_VK_CLOSE_CURLY_BRACKET = 175;
655
656
657 @JsxConstant({FF, FF_ESR})
658 public static final int DOM_VK_TILDE = 176;
659
660
661 @JsxConstant({FF, FF_ESR})
662 public static final int DOM_VK_VOLUME_MUTE = 181;
663
664
665 @JsxConstant({FF, FF_ESR})
666 public static final int DOM_VK_VOLUME_DOWN = 182;
667
668
669 @JsxConstant({FF, FF_ESR})
670 public static final int DOM_VK_VOLUME_UP = 183;
671
672
673 @JsxConstant({FF, FF_ESR})
674 public static final int DOM_VK_COMMA = 188;
675
676
677 @JsxConstant({FF, FF_ESR})
678 public static final int DOM_VK_PERIOD = 190;
679
680
681 @JsxConstant({FF, FF_ESR})
682 public static final int DOM_VK_SLASH = 191;
683
684
685 @JsxConstant({FF, FF_ESR})
686 public static final int DOM_VK_BACK_QUOTE = 192;
687
688
689 @JsxConstant({FF, FF_ESR})
690 public static final int DOM_VK_OPEN_BRACKET = 219;
691
692
693 @JsxConstant({FF, FF_ESR})
694 public static final int DOM_VK_BACK_SLASH = 220;
695
696
697 @JsxConstant({FF, FF_ESR})
698 public static final int DOM_VK_CLOSE_BRACKET = 221;
699
700
701 @JsxConstant({FF, FF_ESR})
702 public static final int DOM_VK_QUOTE = 222;
703
704
705 @JsxConstant({FF, FF_ESR})
706 public static final int DOM_VK_META = 224;
707
708
709 @JsxConstant({FF, FF_ESR})
710 public static final int DOM_VK_ALTGR = 225;
711
712
713 @JsxConstant({FF, FF_ESR})
714 public static final int DOM_VK_WIN_ICO_HELP = 227;
715
716
717 @JsxConstant({FF, FF_ESR})
718 public static final int DOM_VK_WIN_ICO_00 = 228;
719
720
721 @JsxConstant({FF, FF_ESR})
722 public static final int DOM_VK_PROCESSKEY = 229;
723
724
725 @JsxConstant({FF, FF_ESR})
726 public static final int DOM_VK_WIN_ICO_CLEAR = 230;
727
728
729 @JsxConstant({FF, FF_ESR})
730 public static final int DOM_VK_WIN_OEM_RESET = 233;
731
732
733 @JsxConstant({FF, FF_ESR})
734 public static final int DOM_VK_WIN_OEM_JUMP = 234;
735
736
737 @JsxConstant({FF, FF_ESR})
738 public static final int DOM_VK_WIN_OEM_PA1 = 235;
739
740
741 @JsxConstant({FF, FF_ESR})
742 public static final int DOM_VK_WIN_OEM_PA2 = 236;
743
744
745 @JsxConstant({FF, FF_ESR})
746 public static final int DOM_VK_WIN_OEM_PA3 = 237;
747
748
749 @JsxConstant({FF, FF_ESR})
750 public static final int DOM_VK_WIN_OEM_WSCTRL = 238;
751
752
753 @JsxConstant({FF, FF_ESR})
754 public static final int DOM_VK_WIN_OEM_CUSEL = 239;
755
756
757 @JsxConstant({FF, FF_ESR})
758 public static final int DOM_VK_WIN_OEM_ATTN = 240;
759
760
761 @JsxConstant({FF, FF_ESR})
762 public static final int DOM_VK_WIN_OEM_FINISH = 241;
763
764
765 @JsxConstant({FF, FF_ESR})
766 public static final int DOM_VK_WIN_OEM_COPY = 242;
767
768
769 @JsxConstant({FF, FF_ESR})
770 public static final int DOM_VK_WIN_OEM_AUTO = 243;
771
772
773 @JsxConstant({FF, FF_ESR})
774 public static final int DOM_VK_WIN_OEM_ENLW = 244;
775
776
777 @JsxConstant({FF, FF_ESR})
778 public static final int DOM_VK_WIN_OEM_BACKTAB = 245;
779
780
781 @JsxConstant({FF, FF_ESR})
782 public static final int DOM_VK_ATTN = 246;
783
784
785 @JsxConstant({FF, FF_ESR})
786 public static final int DOM_VK_CRSEL = 247;
787
788
789 @JsxConstant({FF, FF_ESR})
790 public static final int DOM_VK_EXSEL = 248;
791
792
793 @JsxConstant({FF, FF_ESR})
794 public static final int DOM_VK_EREOF = 249;
795
796
797 @JsxConstant({FF, FF_ESR})
798 public static final int DOM_VK_PLAY = 250;
799
800
801 @JsxConstant({FF, FF_ESR})
802 public static final int DOM_VK_ZOOM = 251;
803
804
805 @JsxConstant({FF, FF_ESR})
806 public static final int DOM_VK_PA1 = 253;
807
808
809 @JsxConstant({FF, FF_ESR})
810 public static final int DOM_VK_WIN_OEM_CLEAR = 254;
811
812
813 private static final int OEM_KEY_CODE_SEMICOLON = 186;
814
815
816 private static final int OEM_KEY_CODE_EQUALS = 187;
817
818
819 private static final int OEM_KEY_CODE_HYPHEN_MINUS = 189;
820
821
822
823
824
825
826
827 private static final Map<Character, Integer> KEX_CODE_MAP = new HashMap<>();
828 static {
829 KEX_CODE_MAP.put('`', DOM_VK_BACK_QUOTE);
830 KEX_CODE_MAP.put('~', DOM_VK_BACK_QUOTE);
831 KEX_CODE_MAP.put('!', DOM_VK_1);
832 KEX_CODE_MAP.put('@', DOM_VK_2);
833 KEX_CODE_MAP.put('#', DOM_VK_3);
834 KEX_CODE_MAP.put('$', DOM_VK_4);
835 KEX_CODE_MAP.put('%', DOM_VK_5);
836 KEX_CODE_MAP.put('^', DOM_VK_6);
837 KEX_CODE_MAP.put('&', DOM_VK_7);
838 KEX_CODE_MAP.put('*', DOM_VK_8);
839 KEX_CODE_MAP.put('(', DOM_VK_9);
840 KEX_CODE_MAP.put(')', DOM_VK_0);
841
842 KEX_CODE_MAP.put('-', DOM_VK_HYPHEN_MINUS);
843 KEX_CODE_MAP.put('_', DOM_VK_HYPHEN_MINUS);
844
845 KEX_CODE_MAP.put('+', DOM_VK_EQUALS);
846 KEX_CODE_MAP.put('[', DOM_VK_OPEN_BRACKET);
847 KEX_CODE_MAP.put('{', DOM_VK_OPEN_BRACKET);
848 KEX_CODE_MAP.put(']', DOM_VK_CLOSE_BRACKET);
849 KEX_CODE_MAP.put('}', DOM_VK_CLOSE_BRACKET);
850
851 KEX_CODE_MAP.put(':', DOM_VK_SEMICOLON);
852 KEX_CODE_MAP.put('\'', DOM_VK_QUOTE);
853 KEX_CODE_MAP.put('"', DOM_VK_QUOTE);
854 KEX_CODE_MAP.put(',', DOM_VK_COMMA);
855 KEX_CODE_MAP.put('<', DOM_VK_COMMA);
856 KEX_CODE_MAP.put('.', DOM_VK_PERIOD);
857 KEX_CODE_MAP.put('>', DOM_VK_PERIOD);
858 KEX_CODE_MAP.put('/', DOM_VK_SLASH);
859 KEX_CODE_MAP.put('?', DOM_VK_SLASH);
860 KEX_CODE_MAP.put('\\', DOM_VK_BACK_SLASH);
861 KEX_CODE_MAP.put('|', DOM_VK_BACK_SLASH);
862 }
863
864
865
866
867
868
869
870
871
872
873 private record KeyInfo(String key, String shiftedKey, String code, int location) {
874 }
875
876
877
878
879
880
881
882
883 private static final Map<Integer, KeyInfo> KEY_CODE_INFO_MAP = new HashMap<>();
884
885
886
887
888
889 private static final Map<Character, String> CHAR_CODE_MAP = new HashMap<>();
890
891 static {
892 addKey(DOM_VK_CANCEL, "Cancel", "");
893 addKey(DOM_VK_HELP, "Help", "Help");
894 addKey(DOM_VK_BACK_SPACE, "Backspace", "Backspace");
895 addKey(DOM_VK_TAB, "Tab", "Tab");
896 addKey(DOM_VK_CLEAR, "Clear", "NumpadClear");
897 addKey(DOM_VK_RETURN, "Enter", "Enter");
898 addKey(DOM_VK_SHIFT, "Shift", "ShiftLeft", DOM_KEY_LOCATION_LEFT);
899 addKey(DOM_VK_CONTROL, "Control", "ControlLeft", DOM_KEY_LOCATION_LEFT);
900 addKey(DOM_VK_ALT, "Alt", "AltLeft", DOM_KEY_LOCATION_LEFT);
901 addKey(DOM_VK_PAUSE, "Pause", "Pause");
902 addKey(DOM_VK_CAPS_LOCK, "CapsLock", "CapsLock");
903 addKey(DOM_VK_ESCAPE, "Escape", "Escape");
904 addKey(DOM_VK_CONVERT, "Convert", "Convert");
905 addKey(DOM_VK_NONCONVERT, "NonConvert", "NonConvert");
906 addKey(DOM_VK_SPACE, " ", "Space");
907 addKey(DOM_VK_PAGE_UP, "PageUp", "PageUp");
908 addKey(DOM_VK_PAGE_DOWN, "PageDown", "PageDown");
909 addKey(DOM_VK_END, "End", "End");
910 addKey(DOM_VK_HOME, "Home", "Home");
911 addKey(DOM_VK_LEFT, "ArrowLeft", "ArrowLeft");
912 addKey(DOM_VK_UP, "ArrowUp", "ArrowUp");
913 addKey(DOM_VK_RIGHT, "ArrowRight", "ArrowRight");
914 addKey(DOM_VK_DOWN, "ArrowDown", "ArrowDown");
915 addKey(DOM_VK_SELECT, "Select", "Select");
916 addKey(DOM_VK_PRINT, "Print", "");
917 addKey(DOM_VK_EXECUTE, "Execute", "");
918 addKey(DOM_VK_PRINTSCREEN, "PrintScreen", "PrintScreen");
919 addKey(DOM_VK_INSERT, "Insert", "Insert");
920 addKey(DOM_VK_DELETE, "Delete", "Delete");
921 addKey(DOM_VK_WIN, "Meta", "MetaLeft", DOM_KEY_LOCATION_LEFT);
922 addKey(DOM_VK_CONTEXT_MENU, "ContextMenu", "ContextMenu");
923 addKey(DOM_VK_SLEEP, "Standby", "Sleep");
924
925 for (int i = 0; i <= 9; i++) {
926 addKey(DOM_VK_NUMPAD0 + i, Integer.toString(i), "Numpad" + i, DOM_KEY_LOCATION_NUMPAD);
927 }
928 addKey(DOM_VK_MULTIPLY, "*", "NumpadMultiply", DOM_KEY_LOCATION_NUMPAD);
929 addKey(DOM_VK_ADD, "+", "NumpadAdd", DOM_KEY_LOCATION_NUMPAD);
930 addKey(DOM_VK_SEPARATOR, ",", "NumpadComma", DOM_KEY_LOCATION_NUMPAD);
931 addKey(DOM_VK_SUBTRACT, "-", "NumpadSubtract", DOM_KEY_LOCATION_NUMPAD);
932 addKey(DOM_VK_DECIMAL, ".", "NumpadDecimal", DOM_KEY_LOCATION_NUMPAD);
933 addKey(DOM_VK_DIVIDE, "/", "NumpadDivide", DOM_KEY_LOCATION_NUMPAD);
934
935 for (int i = 1; i <= 24; i++) {
936 addKey(DOM_VK_F1 + i - 1, "F" + i, "F" + i);
937 }
938
939 addKey(DOM_VK_NUM_LOCK, "NumLock", "NumLock");
940 addKey(DOM_VK_SCROLL_LOCK, "ScrollLock", "ScrollLock");
941 addKey(DOM_VK_VOLUME_MUTE, "AudioVolumeMute", "AudioVolumeMute");
942 addKey(DOM_VK_VOLUME_DOWN, "AudioVolumeDown", "AudioVolumeDown");
943 addKey(DOM_VK_VOLUME_UP, "AudioVolumeUp", "AudioVolumeUp");
944 addKey(DOM_VK_META, "Meta", "MetaLeft", DOM_KEY_LOCATION_LEFT);
945 addKey(DOM_VK_ALTGR, "AltGraph", "AltRight", DOM_KEY_LOCATION_RIGHT);
946 addKey(DOM_VK_PROCESSKEY, "Process", "");
947 addKey(DOM_VK_ATTN, "Attn", "");
948 addKey(DOM_VK_CRSEL, "CrSel", "");
949 addKey(DOM_VK_EXSEL, "ExSel", "");
950 addKey(DOM_VK_EREOF, "EraseEof", "");
951 addKey(DOM_VK_PLAY, "Play", "");
952 addKey(DOM_VK_ZOOM, "ZoomToggle", "");
953
954
955 addPunctuation(DOM_VK_SEMICOLON, ';', ':', "Semicolon");
956 addPunctuation(DOM_VK_EQUALS, '=', '+', "Equal");
957 addPunctuation(DOM_VK_HYPHEN_MINUS, '-', '_', "Minus");
958 addPunctuation(OEM_KEY_CODE_SEMICOLON, ';', ':', "Semicolon");
959 addPunctuation(OEM_KEY_CODE_EQUALS, '=', '+', "Equal");
960 addPunctuation(OEM_KEY_CODE_HYPHEN_MINUS, '-', '_', "Minus");
961 addPunctuation(DOM_VK_COMMA, ',', '<', "Comma");
962 addPunctuation(DOM_VK_PERIOD, '.', '>', "Period");
963 addPunctuation(DOM_VK_SLASH, '/', '?', "Slash");
964 addPunctuation(DOM_VK_BACK_QUOTE, '`', '~', "Backquote");
965 addPunctuation(DOM_VK_OPEN_BRACKET, '[', '{', "BracketLeft");
966 addPunctuation(DOM_VK_BACK_SLASH, '\\', '|', "Backslash");
967 addPunctuation(DOM_VK_CLOSE_BRACKET, ']', '}', "BracketRight");
968 addPunctuation(DOM_VK_QUOTE, '\'', '"', "Quote");
969
970 final String shiftedDigits = ")!@#$%^&*(";
971 for (int i = 0; i <= 9; i++) {
972 CHAR_CODE_MAP.put((char) ('0' + i), "Digit" + i);
973 CHAR_CODE_MAP.put(shiftedDigits.charAt(i), "Digit" + i);
974 }
975 CHAR_CODE_MAP.put(' ', "Space");
976 CHAR_CODE_MAP.put('\n', "Enter");
977 CHAR_CODE_MAP.put('\r', "Enter");
978 CHAR_CODE_MAP.put('\t', "Tab");
979 CHAR_CODE_MAP.put('\b', "Backspace");
980 }
981
982 private static void addKey(final int keyCode, final String key, final String code) {
983 addKey(keyCode, key, code, DOM_KEY_LOCATION_STANDARD);
984 }
985
986 private static void addKey(final int keyCode, final String key, final String code, final int location) {
987 KEY_CODE_INFO_MAP.put(keyCode, new KeyInfo(key, key, code, location));
988 }
989
990 private static void addPunctuation(final int keyCode, final char key, final char shiftedKey, final String code) {
991 KEY_CODE_INFO_MAP.put(keyCode,
992 new KeyInfo(String.valueOf(key), String.valueOf(shiftedKey), code, DOM_KEY_LOCATION_STANDARD));
993 CHAR_CODE_MAP.put(key, code);
994 CHAR_CODE_MAP.put(shiftedKey, code);
995 }
996
997
998
999
1000
1001
1002 private String key_ = "";
1003
1004
1005 private String code_ = "";
1006
1007
1008 private int location_;
1009
1010
1011 private boolean metaKey_;
1012
1013
1014 private boolean repeat_;
1015
1016
1017 private boolean isComposing_;
1018
1019
1020
1021
1022
1023
1024 private int charCode_;
1025
1026
1027 private int which_;
1028
1029
1030
1031
1032 public KeyboardEvent() {
1033 super();
1034 }
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046 public KeyboardEvent(final DomNode domNode, final String type, final char character,
1047 final boolean shiftKey, final boolean ctrlKey, final boolean altKey) {
1048 this(domNode, type, character, shiftKey, ctrlKey, altKey, false);
1049 }
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062 public KeyboardEvent(final DomNode domNode, final String type, final char character,
1063 final boolean shiftKey, final boolean ctrlKey, final boolean altKey, final boolean metaKey) {
1064 super(domNode, type);
1065
1066 setShiftKey(shiftKey);
1067 setCtrlKey(ctrlKey);
1068 setAltKey(altKey);
1069 setMetaKey(metaKey);
1070
1071 if ('\n' == character) {
1072 setKeyCode(DOM_VK_RETURN);
1073 charCode_ = DOM_VK_RETURN;
1074 which_ = DOM_VK_RETURN;
1075 key_ = "Enter";
1076 code_ = "Enter";
1077 return;
1078 }
1079
1080 final int keyCode;
1081 if (Event.TYPE_KEY_PRESS.equals(getType())) {
1082 keyCode = Integer.valueOf(character);
1083 }
1084 else {
1085 keyCode = Integer.valueOf(charToKeyCode(character, hasOemKeyCodes(domNode)));
1086 }
1087 setKeyCode(keyCode);
1088 if (Event.TYPE_KEY_PRESS.equals(getType())) {
1089 charCode_ = character;
1090 }
1091 which_ = charCode_ == 0 ? keyCode : Integer.valueOf(charCode_);
1092
1093 key_ = determineKey(character, shiftKey);
1094 code_ = determineCode(character);
1095 }
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107 public KeyboardEvent(final DomNode domNode, final String type, final int keyCode,
1108 final boolean shiftKey, final boolean ctrlKey, final boolean altKey) {
1109 this(domNode, type, keyCode, -1, shiftKey, ctrlKey, altKey, false);
1110 }
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125 public KeyboardEvent(final DomNode domNode, final String type, final int keyCode, final int location,
1126 final boolean shiftKey, final boolean ctrlKey, final boolean altKey, final boolean metaKey) {
1127 super(domNode, type);
1128
1129 if (isAmbiguousKeyCode(keyCode)) {
1130 throw new IllegalArgumentException("Please use the 'char' constructor instead of int");
1131 }
1132
1133
1134 final int browserKeyCode = keyCode == DOM_VK_META ? DOM_VK_WIN : keyCode;
1135 final int charCode = getCharCode(keyCode);
1136 if (Event.TYPE_KEY_PRESS.equals(getType())) {
1137
1138 setKeyCode(charCode == 0 ? browserKeyCode : charCode);
1139 charCode_ = charCode;
1140 which_ = charCode;
1141 }
1142 else {
1143 setKeyCode(browserKeyCode);
1144 which_ = browserKeyCode;
1145 }
1146 setShiftKey(shiftKey);
1147 setCtrlKey(ctrlKey);
1148 setAltKey(altKey);
1149
1150 final KeyInfo info = KEY_CODE_INFO_MAP.get(keyCode);
1151 if (info == null) {
1152 key_ = "Unidentified";
1153 code_ = "";
1154 }
1155 else {
1156 key_ = shiftKey ? info.shiftedKey() : info.key();
1157 code_ = info.code();
1158 location_ = info.location();
1159 }
1160 setMetaKey(metaKey);
1161
1162 if (location >= 0 && location != location_) {
1163 location_ = location;
1164
1165 if (location == DOM_KEY_LOCATION_RIGHT && code_.endsWith("Left")) {
1166 code_ = code_.substring(0, code_.length() - "Left".length()) + "Right";
1167 }
1168 else if (location == DOM_KEY_LOCATION_LEFT && code_.endsWith("Right")) {
1169 code_ = code_.substring(0, code_.length() - "Right".length()) + "Left";
1170 }
1171 }
1172 }
1173
1174
1175
1176
1177
1178
1179
1180
1181 public static boolean isShiftNeeded(final char ch, final boolean shiftKey) {
1182 return "~!@#$%^&*()_+{}:\"<>?|".indexOf(ch) != -1
1183 || (!shiftKey && ch >= 'A' && ch <= 'Z');
1184 }
1185
1186
1187
1188
1189
1190
1191 private static boolean isAmbiguousKeyCode(final int keyCode) {
1192 return (keyCode >= DOM_VK_0 && keyCode <= DOM_VK_9) || (keyCode >= DOM_VK_A && keyCode <= DOM_VK_Z);
1193 }
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203 private static int charToKeyCode(final char c, final boolean oemKeyCodes) {
1204 if (c >= 'a' && c <= 'z') {
1205 return 'A' + c - 'a';
1206 }
1207
1208 if (oemKeyCodes) {
1209 final int oemKeyCode = switch (c) {
1210 case ';', ':' -> OEM_KEY_CODE_SEMICOLON;
1211 case '=', '+' -> OEM_KEY_CODE_EQUALS;
1212 case '-', '_' -> OEM_KEY_CODE_HYPHEN_MINUS;
1213 default -> 0;
1214 };
1215 if (oemKeyCode != 0) {
1216 return oemKeyCode;
1217 }
1218 }
1219
1220 final Integer i = KEX_CODE_MAP.get(c);
1221 if (i != null) {
1222 return i;
1223 }
1224 return c;
1225 }
1226
1227
1228
1229
1230
1231
1232
1233
1234 private static boolean hasOemKeyCodes(final DomNode domNode) {
1235 if (domNode == null) {
1236 return false;
1237 }
1238 final Page page = domNode.getPage();
1239 return page != null
1240 && page.getEnclosingWindow().getWebClient().getBrowserVersion()
1241 .hasFeature(KEYBOARD_EVENT_OEM_KEY_CODES);
1242 }
1243
1244
1245
1246
1247
1248
1249
1250
1251 public static int getCharCode(final int keyCode) {
1252 if (keyCode == DOM_VK_RETURN) {
1253 return DOM_VK_RETURN;
1254 }
1255 final KeyInfo info = KEY_CODE_INFO_MAP.get(keyCode);
1256 if (info != null && info.key().length() == 1) {
1257 return info.key().charAt(0);
1258 }
1259 return 0;
1260 }
1261
1262
1263
1264
1265
1266
1267
1268
1269 public static boolean isCharacterKey(final int keyCode) {
1270 return getCharCode(keyCode) != 0;
1271 }
1272
1273
1274
1275
1276
1277
1278
1279
1280 private static String determineKey(final char character, final boolean shiftKey) {
1281 return switch (character) {
1282 case '\n', '\r' -> "Enter";
1283 case '\t' -> "Tab";
1284 case '\b' -> "Backspace";
1285 default -> {
1286 if (shiftKey && character >= 'a' && character <= 'z') {
1287 yield String.valueOf(Character.toUpperCase(character));
1288 }
1289 yield String.valueOf(character);
1290 }
1291 };
1292 }
1293
1294
1295
1296
1297
1298
1299
1300
1301 private static String determineCode(final char character) {
1302 if (character >= 'a' && character <= 'z') {
1303 return "Key" + Character.toUpperCase(character);
1304 }
1305 if (character >= 'A' && character <= 'Z') {
1306 return "Key" + character;
1307 }
1308
1309 final String code = CHAR_CODE_MAP.get(character);
1310 if (code == null) {
1311 return "";
1312 }
1313 return code;
1314 }
1315
1316
1317
1318
1319
1320
1321
1322 @JsxConstructor
1323 @Override
1324 public void jsConstructor(final String type, final ScriptableObject details) {
1325 super.jsConstructor(type, details);
1326
1327 if (details != null && !JavaScriptEngine.isUndefined(details)) {
1328
1329 final Object key = details.get("key", details);
1330 if (!isMissingOrUndefined(key)) {
1331 setKey(JavaScriptEngine.toString(key));
1332 }
1333
1334 final Object code = details.get("code", details);
1335 if (!isMissingOrUndefined(code)) {
1336 setCode(JavaScriptEngine.toString(code));
1337 }
1338
1339 final Object location = details.get("location", details);
1340 if (!isMissingOrUndefined(location)) {
1341 setLocation(JavaScriptEngine.toInt32(location));
1342 }
1343
1344 final Object ctrlKey = details.get("ctrlKey", details);
1345 if (!isMissingOrUndefined(ctrlKey)) {
1346 setCtrlKey(JavaScriptEngine.toBoolean(ctrlKey));
1347 }
1348
1349 final Object shiftKey = details.get("shiftKey", details);
1350 if (!isMissingOrUndefined(shiftKey)) {
1351 setShiftKey(JavaScriptEngine.toBoolean(shiftKey));
1352 }
1353
1354 final Object altKey = details.get("altKey", details);
1355 if (!isMissingOrUndefined(altKey)) {
1356 setAltKey(JavaScriptEngine.toBoolean(altKey));
1357 }
1358
1359 final Object metaKey = details.get("metaKey", details);
1360 if (!isMissingOrUndefined(metaKey)) {
1361 setMetaKey(JavaScriptEngine.toBoolean(metaKey));
1362 }
1363
1364 final Object repeat = details.get("repeat", details);
1365 if (!isMissingOrUndefined(repeat)) {
1366 setRepeat(JavaScriptEngine.toBoolean(repeat));
1367 }
1368
1369 final Object isComposing = details.get("isComposing", details);
1370 if (!isMissingOrUndefined(isComposing)) {
1371 setIsComposing(JavaScriptEngine.toBoolean(isComposing));
1372 }
1373
1374 final Object charCode = details.get("charCode", details);
1375 if (!isMissingOrUndefined(charCode)) {
1376 setCharCode(JavaScriptEngine.toInt32(charCode));
1377 }
1378
1379 final Object keyCode = details.get("keyCode", details);
1380 if (!isMissingOrUndefined(keyCode)) {
1381 setKeyCode(JavaScriptEngine.toInt32(keyCode));
1382 }
1383
1384 if (getBrowserVersion().hasFeature(JS_EVENT_KEYBOARD_CTOR_WHICH)) {
1385 final Object which = details.get("which", details);
1386 if (!isMissingOrUndefined(which)) {
1387 setWhich(JavaScriptEngine.toInt32(which));
1388 }
1389 }
1390 }
1391 }
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407 @JsxFunction
1408 public void initKeyboardEvent(
1409 final String type,
1410 final boolean bubbles,
1411 final boolean cancelable,
1412 final Object view,
1413 final String key,
1414 final int location,
1415 final boolean ctrlKey,
1416 final boolean altKey,
1417 final boolean shiftKey,
1418 final boolean metaKey) {
1419
1420 initUIEvent(type, bubbles, cancelable, view, 0);
1421 setKey(key);
1422 setLocation(location);
1423 setCtrlKey(ctrlKey);
1424 setAltKey(altKey);
1425 setShiftKey(shiftKey);
1426 setKeyCode(0);
1427 setMetaKey(metaKey);
1428 charCode_ = 0;
1429 }
1430
1431
1432
1433
1434
1435
1436 @JsxGetter
1437 public int getCharCode() {
1438 return charCode_;
1439 }
1440
1441
1442
1443
1444
1445
1446 protected void setCharCode(final int charCode) {
1447 charCode_ = charCode;
1448 }
1449
1450
1451
1452
1453
1454
1455 @Override
1456 public int getWhich() {
1457 return which_;
1458 }
1459
1460
1461
1462
1463
1464
1465 protected void setWhich(final int which) {
1466 which_ = which;
1467 }
1468
1469
1470
1471
1472 @Override
1473 @JsxGetter
1474 public int getKeyCode() {
1475 return super.getKeyCode();
1476 }
1477
1478
1479
1480
1481 @Override
1482 @JsxGetter
1483 public boolean isShiftKey() {
1484 return super.isShiftKey();
1485 }
1486
1487
1488
1489
1490 @Override
1491 @JsxGetter
1492 public boolean isCtrlKey() {
1493 return super.isCtrlKey();
1494 }
1495
1496
1497
1498
1499 @Override
1500 @JsxGetter
1501 public boolean isAltKey() {
1502 return super.isAltKey();
1503 }
1504
1505
1506
1507
1508
1509
1510 @JsxGetter
1511 public String getKey() {
1512 return key_;
1513 }
1514
1515
1516
1517
1518
1519
1520 protected void setKey(final String key) {
1521 key_ = key;
1522 }
1523
1524
1525
1526
1527
1528
1529 @JsxGetter
1530 public String getCode() {
1531 return code_;
1532 }
1533
1534
1535
1536
1537
1538
1539 protected void setCode(final String code) {
1540 code_ = code;
1541 }
1542
1543
1544
1545
1546
1547
1548 @JsxGetter
1549 public boolean isMetaKey() {
1550 return metaKey_;
1551 }
1552
1553
1554
1555
1556
1557
1558 protected void setMetaKey(final boolean metaKey) {
1559 metaKey_ = metaKey;
1560 }
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574 @JsxFunction
1575 public static boolean getModifierState(final Context context, final VarScope scope,
1576 final Scriptable thisObj, final Object[] args, final Function function) {
1577 if (!(thisObj instanceof KeyboardEvent event)) {
1578 throw JavaScriptEngine.typeError("Illegal invocation");
1579 }
1580 return getModifierState("KeyboardEvent", args,
1581 event.isShiftKey(), event.isCtrlKey(), event.isAltKey(), event.isMetaKey());
1582 }
1583
1584
1585
1586
1587
1588
1589 @JsxGetter
1590 public int getLocation() {
1591 return location_;
1592 }
1593
1594
1595
1596
1597
1598
1599 protected void setLocation(final int location) {
1600 location_ = location;
1601 }
1602
1603
1604
1605
1606
1607
1608 @JsxGetter
1609 public boolean isRepeat() {
1610 return repeat_;
1611 }
1612
1613
1614
1615
1616
1617
1618 protected void setRepeat(final boolean repeat) {
1619 repeat_ = repeat;
1620 }
1621
1622
1623
1624
1625
1626
1627 @JsxGetter
1628 public boolean getIsComposing() {
1629 return isComposing_;
1630 }
1631
1632
1633
1634
1635
1636
1637 protected void setIsComposing(final boolean isComposing) {
1638 isComposing_ = isComposing;
1639 }
1640 }