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