Bug 460926 A11y hierachy is broken on Ubuntu 8.10 (GNOME 2.24), r=Evan.Yan sr=roc
[wine-gecko.git] / layout / style / test / test_style_struct_copy_constructors.html
blob7f40f11fb7eac67bde5fc2e97b91878b2d741a4a
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 -->
5 <head>
6 <title>Test for style struct copy constructors</title>
7 <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
8 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
9 <script type="text/javascript" src="property_database.js"></script>
10 <style type="text/css" id="stylesheet"></style>
11 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
12 </head>
13 <body>
14 <p id="display"><span id="one"></span><span id="two"></span><span id="parent"><span id="child"></span></span></p>
15 <div id="content" style="display: none">
17 <div id="testnode"><span id="element"></span></div>
20 </div>
21 <pre id="test">
22 <script class="testbody" type="text/javascript">
24 /** Test for style struct copy constructors **/
26 /**
27 * XXX Why doesn't putting a bug in the nsStyleFont copy-constructor for
28 * font-weight (initializing to normal) trigger a failure of this test?
29 * It works for leaving -moz-image-region uninitialized (both halves),
30 * overwriting text-decoration (only the first half, since it's not
31 * inherited), and leaving visibility uninitialized (only the second
32 * half; passes the first half ok).
35 var gElementOne = document.getElementById("one");
36 var gElementTwo = document.getElementById("two");
37 var gElementParent = document.getElementById("parent");
38 var gElementChild = document.getElementById("child");
39 var gStyleSheet = document.getElementById("stylesheet").sheet;
40 var gRule1 = gStyleSheet.cssRules[gStyleSheet.insertRule("#one, #two, #parent {}", gStyleSheet.cssRules.length)];
41 var gRule2 = gStyleSheet.cssRules[gStyleSheet.insertRule("#two, #child {}", gStyleSheet.cssRules.length)];
43 /** Test using aStartStruct **/
45 for (var prop in gCSSProperties) {
46 var info = gCSSProperties[prop];
47 if (!("subproperties" in info)) {
48 gRule1.style.setProperty(prop, info.other_values[0], "");
49 gRule2.style.setProperty(prop, info.other_values[0], "");
53 for (var prop in gCSSProperties) {
54 var info = gCSSProperties[prop];
55 if (!("subproperties" in info)) {
56 gRule2.style.removeProperty(prop);
58 var one = getComputedStyle(gElementOne, "").getPropertyValue(prop);
59 var two = getComputedStyle(gElementTwo, "").getPropertyValue(prop);
60 is(two, one,
61 "property '" + prop + "' was copy-constructed correctly (aStartStruct)");
63 gRule2.style.setProperty(prop, info.other_values[0], "");
67 /** Test using inheritance **/
68 for (var prop in gCSSProperties) {
69 var info = gCSSProperties[prop];
70 if (info.inherited && !("subproperties" in info)) {
71 gRule2.style.removeProperty(prop);
73 var parent = getComputedStyle(gElementParent, "").getPropertyValue(prop);
74 var child = getComputedStyle(gElementChild, "").getPropertyValue(prop);
76 is(child, parent,
77 "property '" + prop + "' was copy-constructed correctly (inheritance)");
79 gRule2.style.setProperty(prop, info.other_values[0], "");
83 for (var prop in gCSSProperties) {
84 var info = gCSSProperties[prop];
85 if (!("subproperties" in info)) {
86 gRule1.style.removeProperty(prop);
87 gRule2.style.removeProperty(prop);
91 </script>
92 </pre>
93 </body>
94 </html>