Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / editing / selection / readonly-disabled-hittest.html
blob611b5bdb3c5d1b218248cbd9ef27942a31865f20
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../resources/js-test.js"></script>
5 <script>
6 function test() {
7 jsTestAsync = true;
8 if (window.testRunner)
9 testRunner.dumpAsText();
11 if (!window.eventSender)
12 return;
14 if (!window.eventSender.gestureLongPress) {
15 debug("gestureLongPress not implemented by this platform.");
16 debug("Manullay long press on every element in the page and check whether Paste Popup is appearing or not");
17 debug("If Paste popup is appearing for readonly or disabled input/textarea, then it's a failure.");
18 return;
21 // Normal Text
22 doLongPressOnElement("normalText");
24 // ReadOnly Text
25 doLongPressOnElement("readOnlyText");
27 // Disabled Text
28 doLongPressOnElement("disabledText");
30 // ReadOnly and Disabled Text
31 doLongPressOnElement("readOnlyDisabledText");
33 // Normal TextArea
34 doLongPressOnElement("normalTextArea");
36 // ReadOnly TextArea
37 doLongPressOnElement("readOnlyTextArea");
39 // Disabled TextArea
40 doLongPressOnElement("disabledTextArea");
42 // ReadOnly and Disabled TextArea
43 doLongPressOnElement("readOnlyDisabledTextArea");
45 finishJSTest();
48 function doLongPressOnElement(elementId) {
49 var element = document.getElementById(elementId);
50 var bounds = element.getBoundingClientRect();
51 var middleX = (bounds.left + bounds.right) / 2;
52 var middleY = (bounds.top + bounds.bottom) / 2;
53 // Touch directly in the center of the element.
54 window.eventSender.gestureLongPress(middleX, middleY);
55 var touchNode = document.elementFromPoint(middleX, middleY);
56 shouldBe(touchNode.id, elementId);
58 </script>
59 </head>
60 <body onload="test();">
61 <input id="normalText" type="text" value="Normal input">
62 <input id="readOnlyText" type="text" value="Readonly input" readonly>
63 <input id="disabledText" type="text" value="Disabled input" disabled>
64 <input id="readOnlyDisabledText" size="20" type="text" value="Readonly Disabled input"readonly disabled>
65 <textarea id="normalTextArea" cols="31">Normal textarea</textarea>
66 <textarea id="readOnlyTextArea" cols="31" readonly>Readonly textarea</textarea>
67 <textarea id="disabledTextArea" cols="31" disabled>Disabled textarea</textarea>
68 <textarea id="readOnlyDisabledTextArea" cols="31" readonly disabled>Readonly Disabled textarea</textarea>
69 </body>
70 </html>