OLD | NEW |
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <style> | 4 <style> |
| 5 /* We'd like to check appearance of the button in various sizes. */ |
| 6 input.always-show-button::-webkit-input-speech-button { |
| 7 opacity: 1; |
| 8 } |
5 </style> | 9 </style> |
6 </head> | 10 </head> |
7 <body> | 11 <body> |
8 <p>Test appearances of input-speech-button.</p> | 12 <p>Test appearances of input-speech-button.</p> |
9 <div id="console"></div> | 13 <div id="console"></div> |
10 | 14 |
11 <script> | 15 <script> |
12 var parent = document.createElement('div'); | 16 var parent = document.createElement('div'); |
13 document.body.appendChild(parent); | 17 document.body.appendChild(parent); |
14 parent.innerHTML = '<table><tr><td id=p1><td id=p2><td id=p3></tr></table>'; | 18 parent.innerHTML = '<table><tr><td id=p1><td id=p2><td id=p3></tr></table><input
x-webkit-speech id="focus"><input x-webkit-speech id="hover">'; |
15 var cells = ["", "", ""]; | 19 var cells = ["", "", ""]; |
16 var maxCellCount = [7, 5, 5]; | 20 var maxCellCount = [7, 5, 5]; |
17 var cellCount = 0; | 21 var cellCount = 0; |
18 var index = 0; | 22 var index = 0; |
19 for (var size = 8; size < 24; size++) { | 23 for (var size = 8; size < 24; size++) { |
20 cells[index] += '<input style="font-size:' + size + 'px" value="A quick brow
n fox jumps over the lazy dog"><br>' | 24 cells[index] += '<input style="font-size:' + size + 'px" value="A quick brow
n fox jumps over the lazy dog"><br>' |
21 + '<input style="font-size:' + size + 'px" value="A quick brown fox jump
s over the lazy dog" x-webkit-speech><br>'; | 25 + '<input style="font-size:' + size + 'px" value="A quick brown fox jump
s over the lazy dog" x-webkit-speech class="always-show-button"><br>'; |
22 if (++cellCount >= maxCellCount[index]) { | 26 if (++cellCount >= maxCellCount[index]) { |
23 ++index; | 27 ++index; |
24 cellCount = 0; | 28 cellCount = 0; |
25 } | 29 } |
26 } | 30 } |
27 for (var i = 0; i < cells.length; ++i) { | 31 for (var i = 0; i < cells.length; ++i) { |
28 var div = document.createElement('div'); | 32 var div = document.createElement('div'); |
29 div.innerHTML = cells[i]; | 33 div.innerHTML = cells[i]; |
30 document.getElementById('p' + (i + 1)).appendChild(div); | 34 document.getElementById('p' + (i + 1)).appendChild(div); |
31 } | 35 } |
32 | 36 |
| 37 document.getElementById('focus').focus(); |
| 38 var hoveredInput = document.getElementById('hover'); |
| 39 if (window.eventSender) |
| 40 eventSender.mouseMoveTo(hoveredInput.offsetLeft + hoveredInput.offsetWidth /
2, hoveredInput.offsetTop + hoveredInput.offsetHeight / 2); |
| 41 |
33 // Also check that setting the attribute from script renders similarly. | 42 // Also check that setting the attribute from script renders similarly. |
34 var inputWithAttribute = document.createElement('input'); | 43 var inputWithAttribute = document.createElement('input'); |
| 44 inputWithAttribute.className = 'always-show-button'; |
35 document.body.appendChild(inputWithAttribute); | 45 document.body.appendChild(inputWithAttribute); |
36 inputWithAttribute.setAttribute('x-webkit-speech', 'x-webkit-speech'); | 46 inputWithAttribute.setAttribute('x-webkit-speech', 'x-webkit-speech'); |
37 | 47 |
38 // Similar to above, check if removing the attribute with script renders an empt
y input field. | 48 // Similar to above, check if removing the attribute with script renders an empt
y input field. |
39 var inputWithoutAttribute = document.createElement('input'); | 49 var inputWithoutAttribute = document.createElement('input'); |
40 inputWithoutAttribute.setAttribute('x-webkit-speech', 'x-webkit-speech'); | 50 inputWithoutAttribute.setAttribute('x-webkit-speech', 'x-webkit-speech'); |
| 51 inputWithoutAttribute.className = 'always-show-button'; |
41 document.body.appendChild(inputWithoutAttribute); | 52 document.body.appendChild(inputWithoutAttribute); |
42 inputWithoutAttribute.removeAttribute('x-webkit-speech'); | 53 inputWithoutAttribute.removeAttribute('x-webkit-speech'); |
43 | 54 |
44 </script> | 55 </script> |
45 </body> | 56 </body> |
46 </html> | 57 </html> |
OLD | NEW |