REGRESSION (r95249): Right side can be truncated when printing
[WebKit-https.git] / LayoutTests / printing / pseudo-class-outside-page.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4
5 <style type="text/css" media="screen">
6     #green {
7         background-color: green;
8     }
9     #test1 {
10         width: 100px;
11         height: 100px;
12         background-color: green;
13     }
14     .exception_test {
15         color: red;
16     }
17     /* These selectors should be ignored */
18     #test1:first {
19         background-color: red;
20     }
21     #test1:left {
22         background-color: red;
23     }
24     #test1:right {
25         background-color: red;
26     }
27 </style>
28 <script>
29     if (window.layoutTestController)
30         layoutTestController.dumpAsText();
31
32     function test()
33     {
34         var expected = getComputedStyle(document.getElementById("green"), null).backgroundColor;
35         var actual = getComputedStyle(document.getElementById("test1"), null).backgroundColor;
36         var result = "PASS";
37         if (actual != expected)
38             result = "Expected " + expected + ", but comes " + actual;
39         document.getElementById("result").innerHTML = result;
40
41         var invalidSelectors = [":first", ":left", ":right", "::first", "::left", "::right",
42                                 ".login-popup:first", ".login-popup:left", ".login-popup:right", ".login-popup::first", ".login-popup::left", ".login-popup::right"];
43         for (var testId = 2; testId <= 13; testId++) {
44             var element = document.getElementById("test" + testId);
45             var invalidSelector = invalidSelectors[testId - 2];
46             try {
47                 document.querySelectorAll(invalidSelector);
48                 element.innerHTML = "Test " + testId + ": FAIL";
49             } catch (e) {
50                 element.innerHTML = "Test " + testId + ": PASS";
51                 element.style.color = "green";
52             }
53         }
54     }
55 </script>
56 </head>
57 <body onload="test()">
58
59 <p>
60 Test case for <a href="https://bugs.webkit.org/show_bug.cgi?id=38272">SHOULD NEVER BE REACHED assertion loading forbes.com</a>.
61 Paged media related pseudo-classes should be ignored outside of @page.
62
63 <p>
64 You should see a green box for Test 1, "Test n: PASS" for the rest.
65
66 <div id="green"></div>
67 <div id="test1"></div>
68 <div id="test2" class="exception_test">Test 2: Didn't run</div>
69 <div id="test3" class="exception_test">Test 3: Didn't run</div>
70 <div id="test4" class="exception_test">Test 4: Didn't run</div>
71 <div id="test5" class="exception_test">Test 5: Didn't run</div>
72 <div id="test6" class="exception_test">Test 6: Didn't run</div>
73 <div id="test7" class="exception_test">Test 7: Didn't run</div>
74 <div id="test8" class="exception_test">Test 8: Didn't run</div>
75 <div id="test9" class="exception_test">Test 9: Didn't run</div>
76 <div id="test10" class="exception_test">Test 10: Didn't run</div>
77 <div id="test11" class="exception_test">Test 11: Didn't run</div>
78 <div id="test12" class="exception_test">Test 12: Didn't run</div>
79 <div id="test13" class="exception_test">Test 13: Didn't run</div>
80 <div id="result"></div>
81
82 </body>
83 </html>