layout/style/test/test_root_node_display.html

Wed, 31 Dec 2014 13:27:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 13:27:57 +0100
branch
TOR_BUG_3246
changeset 6
8bccb770b82d
permissions
-rw-r--r--

Ignore runtime configuration files generated during quality assurance.

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

mercurial