Thu, 15 Jan 2015 21:03:48 +0100
Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=74880
5 -->
6 <head>
7 <title>Test for Bug 74880</title>
8 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
10 <style type="text/css">
12 /* so that computed values for other border properties work right */
13 #display { border-style: solid; }
15 </style>
16 </head>
17 <body>
18 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=74880">Mozilla Bug 74880</a>
19 <div style="margin: 1px 2px 3px 4px; border-width: 5px 6px 7px 8px; border-style: dotted dashed solid double; border-color: blue fuchsia green orange; padding: 9px 10px 11px 12px">
20 <p id="display"></p>
21 </div>
22 <div id="content" style="display: none">
24 </div>
25 <pre id="test">
26 <script class="testbody" type="text/javascript">
28 /** Test for Bug 74880 **/
30 var gProps = [
31 [ "margin-left", "margin-right", "-moz-margin-start", "-moz-margin-end" ],
32 [ "padding-left", "padding-right", "-moz-padding-start", "-moz-padding-end" ],
33 [ "border-left-color", "border-right-color", "-moz-border-start-color", "-moz-border-end-color" ],
34 [ "border-left-style", "border-right-style", "-moz-border-start-style", "-moz-border-end-style" ],
35 [ "border-left-width", "border-right-width", "-moz-border-start-width", "-moz-border-end-width" ],
36 ];
38 var gLengthValues = [ "inherit", "initial", "2px", "1em" ];
39 var gColorValues = [ "inherit", "initial", "currentColor", "green" ];
40 var gStyleValues = [ "inherit", "initial", "double", "dashed" ];
42 if (SpecialPowers.getBoolPref("layout.css.unset-value.enabled")) {
43 gLengthValues.push("unset");
44 gColorValues.push("unset");
45 gStyleValues.push("unset");
46 }
48 function values_for(set) {
49 var values;
50 if (set[0].match(/style$/))
51 values = gStyleValues;
52 else if (set[0].match(/color$/))
53 values = gColorValues;
54 else
55 values = gLengthValues;
56 return values;
57 }
59 var e = document.getElementById("display");
60 var s = e.style;
61 var c = window.getComputedStyle(e, "");
63 for (var set of gProps) {
64 var values = values_for(set);
65 for (var val of values) {
66 function check(dir, plogical, pvisual) {
67 var v0 = c.getPropertyValue(pvisual);
68 s.setProperty("direction", dir, "");
69 s.setProperty(pvisual, val, "");
70 var v1 = c.getPropertyValue(pvisual);
71 if (val != "initial" && val != "unset" && val != "currentColor")
72 isnot(v1, v0, "setProperty set the property " + pvisual + ": " + val);
73 s.removeProperty(pvisual);
74 is(c.getPropertyValue(pvisual), v0, "removeProperty worked for " + pvisual);
75 s.setProperty(plogical, val, "")
76 var v2 = c.getPropertyValue(pvisual);
77 is(v2, v1, "the logical property " + plogical + ": " + val + " showed up in the right place");
78 s.removeProperty(plogical);
79 is(c.getPropertyValue(pvisual), v0, "removeProperty worked for " + plogical);
81 s.removeProperty("direction");
82 }
84 check("ltr", set[2], set[0]);
85 check("ltr", set[3], set[1]);
86 check("rtl", set[2], set[1]);
87 check("rtl", set[3], set[0]);
88 }
90 function check_cascading(dir, plogical, pvisual) {
91 var dirstr = "direction: " + dir + ";";
92 e.setAttribute("style", dirstr + pvisual + ":" + values[2]);
93 var v2 = c.getPropertyValue(pvisual);
94 e.setAttribute("style", dirstr + pvisual + ":" + values[3]);
95 var v3 = c.getPropertyValue(pvisual);
96 isnot(v2, v3, "values should produce different computed values");
98 var desc = ["cascading for", pvisual, "and", plogical, "with direction", dir].join(" ");
99 e.setAttribute("style", dirstr + pvisual + ":" + values[3] + ";" +
100 plogical + ":" + values[2]);
101 is(c.getPropertyValue(pvisual), v2, desc);
102 e.setAttribute("style", dirstr + plogical + ":" + values[3] + ";" +
103 pvisual + ":" + values[2]);
104 is(c.getPropertyValue(pvisual), v2, desc);
105 e.setAttribute("style", dirstr + pvisual + ":" + values[2] + ";" +
106 plogical + ":" + values[3]);
107 is(c.getPropertyValue(pvisual), v3, desc);
108 e.setAttribute("style", dirstr + plogical + ":" + values[2] + ";" +
109 pvisual + ":" + values[3]);
110 is(c.getPropertyValue(pvisual), v3, desc);
111 e.removeAttribute("style");
112 }
114 check_cascading("ltr", set[2], set[0]);
115 check_cascading("ltr", set[3], set[1]);
116 check_cascading("rtl", set[2], set[1]);
117 check_cascading("rtl", set[3], set[0]);
118 }
121 </script>
122 </pre>
123 </body>
124 </html>