1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/layout/style/test/test_root_node_display.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,62 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<!-- 1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=969460 1.8 +--> 1.9 +<head> 1.10 + <meta charset="utf-8"> 1.11 + <title>Test for Bug 969460</title> 1.12 + <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.13 + <script type="text/javascript" src="property_database.js"></script> 1.14 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 1.15 +</head> 1.16 +<body> 1.17 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=969460">Mozilla Bug 969460</a> 1.18 +<p id="display"></p> 1.19 +<div id="content" style="display: none"> 1.20 + <div id="float" style="float: left"></div> 1.21 +</div> 1.22 +<pre id="test"> 1.23 +<script type="application/javascript"> 1.24 + 1.25 +/** Test for Bug 969460: Test that "display" on the root node is computed 1.26 + using the same conversion that we use for display on floated elements **/ 1.27 + 1.28 +function test_display_value(val) 1.29 +{ 1.30 + var floatElem = document.getElementById("float"); 1.31 + floatElem.style.display = val; 1.32 + var floatConversion = window.getComputedStyle(floatElem, null).display; 1.33 + floatElem.style.display = ""; 1.34 + 1.35 + var rootNode = document.documentElement; 1.36 + rootNode.style.display = val; 1.37 + rootNode.offsetHeight; // (Flush layout, to be sure layout can handle 'val') 1.38 + var rootConversion = window.getComputedStyle(rootNode, null).display; 1.39 + rootNode.style.display = ""; 1.40 + 1.41 + // Special case: "display:list-item" does not get modified by 'float', 1.42 + // but the spec allows us to convert it to 'block' on the root node 1.43 + // (and we do convert it, so that we don't have to support documents whose 1.44 + // root node is a list-item). 1.45 + if (val == "list-item") { 1.46 + is(floatConversion, val, "'float' shouldn't affect 'display:list-item'"); 1.47 + is(rootConversion, "block", 1.48 + "We traditionally convert 'display:list-item' on the root node to " + 1.49 + "'display:block' (though if that changes, it's not technically a bug, " + 1.50 + "as long as we support it properly)."); 1.51 + } else { 1.52 + is(rootConversion, floatConversion, 1.53 + "root node should make 'display:" + val + "' compute to the same " + 1.54 + "value that it computes to on a floated element"); 1.55 + } 1.56 +} 1.57 + 1.58 +var displayInfo = gCSSProperties["display"]; 1.59 +displayInfo.initial_values.forEach(test_display_value); 1.60 +displayInfo.other_values.forEach(test_display_value); 1.61 + 1.62 +</script> 1.63 +</pre> 1.64 +</body> 1.65 +</html>