diff options
Diffstat (limited to 'layout/style/test/test_root_node_display.html')
-rw-r--r-- | layout/style/test/test_root_node_display.html | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/layout/style/test/test_root_node_display.html b/layout/style/test/test_root_node_display.html new file mode 100644 index 0000000000..54dd9c222c --- /dev/null +++ b/layout/style/test/test_root_node_display.html @@ -0,0 +1,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> |