OLD | NEW |
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
2 <script src="../../resources/js-test.js"></script> | 2 <script src="../../resources/js-test.js"></script> |
3 <input id="input" type="input"> | 3 <input id="input" type="input"> |
4 <script type="text/javascript"> | 4 <script type="text/javascript"> |
5 description('Test that composition events should have a sourceCapabilities and i
ts firesTouchEvents should always be false.'); | 5 description('Test that composition events should have a sourceCapabilities and i
ts firesTouchEvents should always be false.'); |
6 | 6 |
7 function compositionHandler() { | 7 function compositionHandler() { |
8 debug(event.type); | 8 debug(event.type); |
9 shouldBeNonNull("event.sourceCapabilities"); | 9 shouldBeNonNull("event.sourceCapabilities"); |
10 shouldBeFalse("event.sourceCapabilities.firesTouchEvents"); | 10 shouldBeFalse("event.sourceCapabilities.firesTouchEvents"); |
11 } | 11 } |
12 | 12 |
13 if (window.eventSender) { | 13 if (window.eventSender) { |
14 for (var evt of ['compositionstart', 'compositionupdate', 'compositionend'])
{ | 14 for (var evt of ['compositionstart', 'compositionupdate', 'compositionend'])
{ |
15 document.addEventListener(evt, compositionHandler); | 15 document.addEventListener(evt, compositionHandler); |
16 } | 16 } |
17 | 17 |
18 var input = document.getElementById('input'); | 18 var input = document.getElementById('input'); |
19 input.focus(); | 19 input.focus(); |
20 | 20 |
| 21 // We need to force a text input update here so that later the call to |
| 22 // RenderWidget::resetInputMethod() will lead to finishComposingText(). |
| 23 // Normally this would not be needed if the focus was due to user gesture. |
| 24 // But on Mac, even with user gesture, we wait for the next compositing |
| 25 // to update text input state frame. That is why we are explicitly calling |
| 26 // this method here. |
| 27 textInputController.forceTextInputStateUpdate(); |
| 28 |
21 textInputController.setMarkedText('abcde', 1, 3); | 29 textInputController.setMarkedText('abcde', 1, 3); |
22 | 30 |
23 input.blur(); | 31 input.blur(); |
24 } else { | 32 } else { |
25 debug('This test requires eventSender.'); | 33 debug('This test requires eventSender.'); |
26 } | 34 } |
27 | 35 |
28 </script> | 36 </script> |
OLD | NEW |