| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <title>Test CSS4 media query "pointer" and "hover" features.</title> | 3 <title>Test CSS4 media query "pointer" and "hover" features.</title> |
| 4 <style type="text/css"> | 4 <style type="text/css"> |
| 5 | 5 |
| 6 </style> | 6 </style> |
| 7 <script type="text/javascript" charset="utf-8"> | 7 <script type="text/javascript" charset="utf-8"> |
| 8 if (window.testRunner) | 8 if (window.testRunner) |
| 9 testRunner.dumpAsText(); | 9 testRunner.dumpAsText(); |
| 10 | 10 |
| 11 function log(m) { | 11 function log(m) { |
| 12 document.getElementById('results').innerHTML += m + '<br>'; | 12 document.getElementById('results').innerHTML += m + '<br>'; |
| 13 } | 13 } |
| 14 | 14 |
| 15 function testQueries() | 15 function testQueries() |
| 16 { | 16 { |
| 17 var queries = [ | 17 var queries = [ |
| 18 "(pointer)", | 18 "(pointer)", |
| 19 "(Pointer)", | 19 "(Pointer)", |
| 20 "(pointer:none)", | 20 "(pointer:none)", |
| 21 "(pointer:NoNe)", |
| 21 "(pointer:coarse)", | 22 "(pointer:coarse)", |
| 22 "(pointer:coARse)", | 23 "(pointer:coARse)", |
| 23 "(pointer:bogusvalue)", | 24 "(pointer:bogusvalue)", |
| 24 "(pointer:fine)", | 25 "(pointer:fine)", |
| 26 "(pointer:FiNe)", |
| 25 "(hover)", | 27 "(hover)", |
| 26 "(hover:0)", | 28 "(hover:0)", |
| 27 "(hover:1)", | 29 "(hover:1)", |
| 28 "(hover:bogusvalue)" ]; | 30 "(hover:bogusvalue)" ]; |
| 29 for (var index=0; index < queries.length; index++) { | 31 for (var index=0; index < queries.length; index++) { |
| 30 log("Query "" + queries[index] + "": " + | 32 log("Query "" + queries[index] + "": " + |
| 31 window.matchMedia(queries[index]).matches); | 33 window.matchMedia(queries[index]).matches); |
| 32 } | 34 } |
| 33 } | 35 } |
| 34 | 36 |
| 35 function runTests() | 37 function runTests() |
| 36 { | 38 { |
| 37 log("------------- default configuration -------------"); | 39 log("------------- default configuration -------------"); |
| 38 testQueries(); | 40 testQueries(); |
| 39 | 41 |
| 40 if (window.internals) { | 42 if (window.internals) { |
| 41 internals.settings.setDeviceSupportsTouch(true); | 43 internals.settings.setPrimaryPointerDevices('touch'); |
| 42 | 44 |
| 43 log("------------- with touch screen -------------"); | 45 log("------------- with touch screen -------------"); |
| 44 testQueries(); | 46 testQueries(); |
| 47 |
| 48 internals.settings.setPrimaryPointerDevices('mouse'); |
| 49 |
| 50 log("------------- with mouse -------------"); |
| 51 testQueries(); |
| 52 |
| 53 internals.settings.setPrimaryPointerDevices('none'); |
| 54 |
| 55 log("------------- with no pointer -------------"); |
| 56 testQueries(); |
| 57 |
| 58 internals.settings.setPrimaryPointerDevices('unknown'); |
| 59 |
| 60 log("------------- with unknown -------------"); |
| 61 testQueries(); |
| 62 |
| 63 internals.settings.setPrimaryPointerDevices('mouse,touch'); |
| 64 |
| 65 log("------------- with mouse and touch -------------"); |
| 66 testQueries(); |
| 45 } | 67 } |
| 46 } | 68 } |
| 47 | 69 |
| 48 </script> | 70 </script> |
| 49 </head> | 71 </head> |
| 50 <body onload="runTests()"> | 72 <body onload="runTests()"> |
| 51 <p>Test the <a href="http://dev.w3.org/csswg/css4-mediaqueries/#pointer">(po
inter)</a> and | 73 <p>Test the <a href="http://dev.w3.org/csswg/css4-mediaqueries/#pointer">(po
inter)</a> and |
| 52 <a href="http://dev.w3.org/csswg/css4-mediaqueries/#hover">(hover)</a> media
features. | 74 <a href="http://dev.w3.org/csswg/css4-mediaqueries/#hover">(hover)</a> media
features. |
| 53 See <a href="https://bugs.webkit.org/show_bug.cgi?id=87403">Bug 87403</a> fo
r details.</p> | 75 See <a href="https://bugs.webkit.org/show_bug.cgi?id=87403">Bug 87403</a> fo
r details.</p> |
| 54 | 76 |
| 55 <div id="results"> | 77 <div id="results"> |
| 56 </div> | 78 </div> |
| 57 </body> | 79 </body> |
| 58 </html> | 80 </html> |
| OLD | NEW |