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