1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
4 <script src="../js/resources/js-test-pre.js"></script>
6 if (window.layoutTestController) {
7 window.layoutTestController.waitUntilDone();
16 var headElement = document.getElementById("myhead");
17 var linkElement = document.createElement("link");
18 linkElement.rel = "stylesheet";
21 if (screen.width > screen.height) {
22 // For a landscape screen, a ratio of 100/1 should always be greater than the screen (e.g., 16/9)
26 // For a portrait screen, a ratio of 1/1 will always be greater than the screen (e.g., 9/16)
27 // For a square screen, a ratio of 1/1 will always be equal to the screen (e.g., 9/9)
31 linkElement.media = "screen and (max-device-aspect-ratio: " + width + "/" + height + ")";
32 linkElement.href = "resources/device-aspect-ratio.css";
33 headElement.appendChild(linkElement);
34 description("This text is green if the max-device-aspect-ratio media query works properly.");
35 setTimeout("waitForStylesheetLoad()", timeout);
38 function waitForStylesheetLoad()
42 if (document.defaultView.getComputedStyle(document.getElementById('description'), null).color == "rgb(0, 128, 0)") {
43 shouldBe("document.defaultView.getComputedStyle(document.getElementById('description'), null).color", "'rgb(0, 128, 0)'");
44 isSuccessfullyParsed();
45 if (window.layoutTestController) {
46 window.layoutTestController.notifyDone();
51 if (count > maxCount) {
52 testFailed("Stylesheet did not load in " + (maxCount * timeout / 1000) + " second(s).");
56 setTimeout("waitForStylesheetLoad()", timeout);
60 <body onload="doTest()">