no bug - Import translations from android-l10n r=release a=l10n CLOSED TREE
[gecko.git] / layout / base / tests / multi-range-user-select-ref.html
blob00d7d412691a3070bdbf3f7c2e7995de400b82de
1 <!DOCTYPE HTML>
2 <html class="reftest-wait"><head>
3 <meta charset="utf-8">
4 <title>Testcase #1 for bug 1129078</title>
5 <script src="/tests/SimpleTest/SimpleTest.js"></script>
6 <script src="selection-utils.js"></script>
8 <style type="text/css">
9 @font-face {
10 font-family: Ahem;
11 src: url("Ahem.ttf");
13 html,body { margin:0; padding: 0; }
14 body,pre { font-family: Ahem; font-size: 20px; }
15 </style>
16 </head>
17 <body>
19 <pre id="select">
20 2af45494-ak7e-11e4-a0c6-a7e7
21 38222880-bj6d-11e4-8064-fb7b
22 3d649ae4-ci5c-11e4-995d-17b2
23 434351bc-dh4b-11e4-9971-4fc8
24 4dc0e0b4-eg4a-11e4-8c28-5319
25 a96319c8-ad7d-11e4-b312-039c
26 </pre>
28 <pre id="log" style="border:1px solid green"></pre>
30 <script>
32 var sel = window.getSelection();
33 var e = document.querySelector('#select');
34 function setupSelectionPrev3() {
35 addChildRanges([[0,150,0,160], [0,65,0,70], [0,15,0,15]], e);
36 sel.extend(e.firstChild, 10); // to get eDirPrevious direction
38 function setupSelectionPrev2() {
39 addChildRanges([[0,150,0,160], [0,70,0,70]], e);
40 sel.extend(e.firstChild, 65); // to get eDirPrevious direction
42 function setupSelectionPrev1() {
43 addChildRanges([[0,160,0,160]], e);
44 sel.extend(e.firstChild, 150); // to get eDirPrevious direction
47 function setupSelectionNext3() {
48 addChildRanges([[0,10,0,15], [0,65,0,70], [0,150,0,160]], e);
50 function setupSelectionNext2() {
51 addChildRanges([[0,10,0,15], [0,65,0,70]], e);
53 function setupSelectionNext2b() {
54 addChildRanges([[0,15,0,80], [0,150,0,160]], e);
56 function setupSelectionNext1() {
57 addChildRanges([[0,10,0,15]], e);
59 function setupSelectionNext1b() {
60 addChildRanges([[0,15,0,170]], e);
62 function setupSelectionNext1c() {
63 addChildRanges([[0,150,0,160]], e);
66 function runTest() {
67 sel = window.getSelection();
68 sel.removeAllRanges();
69 document.body.offsetHeight;
70 var hash = window.location.hash
71 var op = hash.substring(6,8);
72 var test = hash.substring(0,6);
73 if (hash.substring(0,5) == "#prev") {
74 if (test == "#prev1") {
75 setupSelectionPrev3();
76 if (op == "SL") {
77 sel.extend(e.firstChild, 8);
78 } else if (op == "SR") {
79 sel.extend(e.firstChild, 12);
80 } else if (op == "AD") {
81 addChildRanges([[0,1,0,2]], e);
82 } else {
83 sel.extend(e.firstChild, 1);
85 } else if (test == "#prev2") {
86 setupSelectionPrev3();
87 sel.extend(e.firstChild, 14); // now eDirNext
88 sel.extend(e.firstChild, 13); // now eDirPrevious again
89 } else if (test == "#prev3") {
90 setupSelectionPrev2();
91 sel.extend(e.firstChild, 20);
92 } else if (test == "#prev4") {
93 setupSelectionPrev2();
94 sel.extend(e.firstChild, 68); // now eDirNext
95 sel.extend(e.firstChild, 67); // now eDirPrevious again
96 } else if (test == "#prev5") {
97 setupSelectionPrev1();
98 sel.extend(e.firstChild, 80);
99 } else if (test == "#prev6") {
100 setupSelectionPrev1();
101 sel.extend(e.firstChild, 153); // now eDirNext
102 sel.extend(e.firstChild, 152); // now eDirPrevious again
103 } else if (test == "#prev7") {
104 if (op == "AD") {
105 setupSelectionPrev3();
106 addChildRanges([[0,168,0,170]], e);
107 } else {
108 addChildRanges([[0,160,0,170]], e);
110 } else if (test == "#prev8") {
111 if (op == "AD") {
112 addChildRanges([[0,150,0,155], [0,68,0,70]], e);
115 } else {
116 if (test == "#next1") {
117 if (op == "SL") {
118 setupSelectionNext3();
119 sel.extend(e.firstChild, 158);
120 } else if (op == "SR") {
121 setupSelectionNext3();
122 sel.extend(e.firstChild, 162);
123 } else if (op == "AD") {
124 setupSelectionNext3();
125 addChildRanges([[0,1,0,2]], e);
126 } else {
127 setupSelectionNext1();
128 sel.extend(e.firstChild, 1);
130 } else if (test == "#next2") {
131 setupSelectionNext1();
132 sel.extend(e.firstChild, 13);
133 } else if (test == "#next3") {
134 setupSelectionNext1();
135 sel.extend(e.firstChild, 20);
136 } else if (test == "#next4") {
137 setupSelectionNext2();
138 sel.extend(e.firstChild, 67);
139 } else if (test == "#next5") {
140 setupSelectionNext2();
141 sel.extend(e.firstChild, 80);
142 } else if (test == "#next6") {
143 setupSelectionNext3();
144 sel.extend(e.firstChild, 152);
145 } else if (test == "#next7") {
146 setupSelectionNext3();
147 if (op == "AD") {
148 addChildRanges([[0,168,0,170]], e);
149 } else {
150 sel.extend(e.firstChild, 170);
152 } else if (test == "#next8") {
153 if (op == "AD") {
154 addChildRanges([[0,68,0,70], [0,150,0,155]], e);
158 document.documentElement.removeAttribute("class");
161 SimpleTest.waitForFocus(function(){setTimeout(runTest,0)});
163 </script>
165 </body>
166 </html>