6 <title>Test for style struct copy constructors
</title>
7 <script src=
"/tests/SimpleTest/SimpleTest.js"></script>
8 <script type=
"text/javascript" src=
"property_database.js"></script>
9 <style type=
"text/css" id=
"stylesheet"></style>
10 <link rel=
"stylesheet" type=
"text/css" href=
"/tests/SimpleTest/test.css" />
13 <p id=
"display"><span id=
"one"></span><span id=
"two"></span><span id=
"parent"><span id=
"child"></span></span></p>
14 <div id=
"content" style=
"display: none">
16 <div id=
"testnode"><span id=
"element"></span></div>
21 <script class=
"testbody" type=
"text/javascript">
23 /** Test for style struct copy constructors **/
26 * XXX Why doesn't putting a bug in the nsStyleFont copy-constructor for
27 * font-weight (initializing to normal) trigger a failure of this test?
28 * It works for leaving -moz-image-region uninitialized (both halves),
29 * overwriting text-decoration (only the first half, since it's not
30 * inherited), and leaving visibility uninitialized (only the second
31 * half; passes the first half ok).
34 var gElementOne = document.getElementById(
"one");
35 var gElementTwo = document.getElementById(
"two");
36 var gElementParent = document.getElementById(
"parent");
37 var gElementChild = document.getElementById(
"child");
38 var gStyleSheet = document.getElementById(
"stylesheet").sheet;
39 var gRule1 = gStyleSheet.cssRules[gStyleSheet.insertRule(
"#one, #two, #parent {}", gStyleSheet.cssRules.length)];
40 var gRule2 = gStyleSheet.cssRules[gStyleSheet.insertRule(
"#two, #child {}", gStyleSheet.cssRules.length)];
42 /** Test using aStartStruct **/
44 for (var prop in gCSSProperties) {
45 var info = gCSSProperties[prop];
46 if (!(
"subproperties" in info)) {
47 gRule1.style.setProperty(prop, info.other_values[
0],
"");
48 gRule2.style.setProperty(prop, info.other_values[
0],
"");
52 for (var prop in gCSSProperties) {
53 var info = gCSSProperties[prop];
54 if (!(
"subproperties" in info)) {
55 gRule2.style.removeProperty(prop);
57 var one = getComputedStyle(gElementOne,
"").getPropertyValue(prop);
58 var two = getComputedStyle(gElementTwo,
"").getPropertyValue(prop);
60 "property '" + prop +
"' was copy-constructed correctly (aStartStruct)");
62 gRule2.style.setProperty(prop, info.other_values[
0],
"");
66 /** Test using inheritance **/
68 // TODO(bug
1887221): Zoom right now doesn't apply to explicitly inherited
69 // values, so remove it to get consistent results.
70 gRule1.style.removeProperty(
"zoom");
71 gRule2.style.removeProperty(
"zoom");
73 for (var prop in gCSSProperties) {
74 var info = gCSSProperties[prop];
75 if (info.inherited && !(
"subproperties" in info)) {
76 gRule2.style.removeProperty(prop);
78 var parent = getComputedStyle(gElementParent,
"").getPropertyValue(prop);
79 var child = getComputedStyle(gElementChild,
"").getPropertyValue(prop);
82 "property '" + prop +
"' was copy-constructed correctly (inheritance)");
84 gRule2.style.setProperty(prop, info.other_values[
0],
"");