Bug 1839315: part 4) Link from `SheetLoadData::mWasAlternate` to spec. r=emilio DONTBUILD
[gecko.git] / layout / style / test / test_root_node_display.html
blob54dd9c222c83899a5bf7ea767de5becdf5f8a715
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=969460
5 -->
6 <head>
7 <meta charset="utf-8">
8 <title>Test for Bug 969460</title>
9 <script src="/tests/SimpleTest/SimpleTest.js"></script>
10 <script type="text/javascript" src="property_database.js"></script>
11 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
12 </head>
13 <body>
14 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=969460">Mozilla Bug 969460</a>
15 <p id="display"></p>
16 <div id="content" style="display: none">
17 <div id="float" style="float: left"></div>
18 </div>
19 <pre id="test">
20 <script type="application/javascript">
22 /** Test for Bug 969460: Test that "display" on the root node is computed
23 using the same conversion that we use for display on floated elements **/
25 function test_display_value(val)
27 var floatElem = document.getElementById("float");
28 floatElem.style.display = val;
29 var floatConversion = window.getComputedStyle(floatElem).display;
30 floatElem.style.display = "";
32 var rootNode = document.documentElement;
33 rootNode.style.display = val;
34 rootNode.offsetHeight; // (Flush layout, to be sure layout can handle 'val')
35 var rootConversion = window.getComputedStyle(rootNode).display;
36 rootNode.style.display = "";
38 // Special case: "display:list-item" does not get modified by 'float',
39 // but the spec allows us to convert it to 'block' on the root node
40 // (and we do convert it, so that we don't have to support documents whose
41 // root node is a list-item).
42 if (val == "list-item") {
43 is(floatConversion, val, "'float' shouldn't affect 'display:list-item'");
44 is(rootConversion, "block",
45 "We traditionally convert '" + val + "' on the root node to " +
46 "'display:block' (though if that changes, it's not technically a bug, " +
47 "as long as we support it properly).");
48 } else if (val == "inline list-item" ||
49 val == "inline flow-root list-item") {
50 is(floatConversion, "list-item", "'float' should blockify '" + val + "'");
51 is(rootConversion, "block",
52 "We traditionally convert '" + val + "' on the root node to " +
53 "'display:block' (though if that changes, it's not technically a bug, " +
54 "as long as we support it properly).");
55 } else if (val == "contents") {
56 is(floatConversion, val, "'float' shouldn't affect 'display:contents'");
57 is(rootConversion, "block",
58 "'display:contents' on the root node computes to block-level per" +
59 "http://dev.w3.org/csswg/css-display/#transformations");
60 } else {
61 is(rootConversion, floatConversion,
62 "root node should make 'display:" + val + "' compute to the same " +
63 "value that it computes to on a floated element");
67 var displayInfo = gCSSProperties.display;
68 displayInfo.initial_values.forEach(test_display_value);
69 displayInfo.other_values.forEach(test_display_value);
71 </script>
72 </pre>
73 </body>
74 </html>