OLD | NEW |
1 <!DOCTYPE HTML> | 1 <!DOCTYPE HTML> |
2 <script src="../../resources/testharness.js"></script> | 2 <script src="../../resources/testharness.js"></script> |
3 <script src="../../resources/testharnessreport.js"></script> | 3 <script src="../../resources/testharnessreport.js"></script> |
4 <div id="log"></div> | 4 <div id="log"></div> |
5 <div id="container"> | 5 <div id="container"> |
6 <p id="description"> | 6 <p id="description"> |
7 This tests that changing the container's position from fixed or relative to
absolute is safe,<br> | 7 This tests that changing the container's position from fixed or relative to
absolute is safe,<br> |
8 when child container with fixed position is present.<br> | 8 when child container with fixed position is present.<br> |
9 PASS, if no crash or assert in debug. | 9 PASS, if no crash or assert in debug. |
10 </p> | 10 </p> |
11 </div> | 11 </div> |
12 <script> | 12 <script> |
13 var valueList = ["static", "relative", "absolute", "fixed"] | 13 var valueList = ["static", "relative", "absolute", "fixed"] |
| 14 var tests = []; |
14 for (var outerValue of valueList) { | 15 for (var outerValue of valueList) { |
15 for (var innerValue of valueList) { | 16 for (var innerValue of valueList) { |
16 for (var afterValue of valueList) { | 17 for (var afterValue of valueList) { |
17 var tests = []; | |
18 var outerElement, innerElement, midElement; | 18 var outerElement, innerElement, midElement; |
19 if (outerValue !== afterValue) { | 19 if (outerValue !== afterValue) { |
20 outerElement = document.createElement("div"); | 20 outerElement = document.createElement("div"); |
21 innerElement = document.createElement("div"); | 21 innerElement = document.createElement("div"); |
22 outerElement.style.position = outerValue; | 22 outerElement.style.position = outerValue; |
23 innerElement.style.position = innerValue; | 23 innerElement.style.position = innerValue; |
24 outerElement.appendChild(innerElement); | 24 outerElement.appendChild(innerElement); |
25 container.appendChild(outerElement); | 25 container.appendChild(outerElement); |
26 tests.push(["position:" + outerValue + " with a " + innerValue +
" child to " + afterValue, function () { | 26 tests.push(["position:" + outerValue + " with a " + innerValue +
" child to " + afterValue, function () { |
27 outerElement.style.position = afterValue; | 27 outerElement.style.position = afterValue; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 outerElement.style.position = outerValue; | 109 outerElement.style.position = outerValue; |
110 outerElement.style.transform = "rotate(3deg)"; | 110 outerElement.style.transform = "rotate(3deg)"; |
111 innerElement.style.position = innerValue; | 111 innerElement.style.position = innerValue; |
112 outerElement.appendChild(innerElement); | 112 outerElement.appendChild(innerElement); |
113 container.appendChild(outerElement); | 113 container.appendChild(outerElement); |
114 tests.push(["Remove transform from position:" + outerValue + " and trans
form with a " + innerValue + " child", function () { | 114 tests.push(["Remove transform from position:" + outerValue + " and trans
form with a " + innerValue + " child", function () { |
115 outerElement.style.transform = "none"; | 115 outerElement.style.transform = "none"; |
116 innerElement.style.width = "50%"; | 116 innerElement.style.width = "50%"; |
117 }]); | 117 }]); |
118 | 118 |
119 document.body.offsetHeight; | |
120 for (var t of tests) { | |
121 test(function () { | |
122 t[1](); | |
123 // No assert() are needed, we just check layout hits no ASSERT n
or crash. | |
124 document.body.offsetHeight; | |
125 }, t[0]); | |
126 } | |
127 } | 119 } |
128 } | 120 } |
| 121 |
| 122 document.body.offsetHeight; |
| 123 for (var t of tests) { |
| 124 test(function () { |
| 125 t[1](); |
| 126 // No assert() are needed, we just check layout hits no ASSERT nor crash
. |
| 127 document.body.offsetHeight; |
| 128 }, t[0]); |
| 129 } |
129 </script> | 130 </script> |
OLD | NEW |