Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 <?xml version="1.0"?>
2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
4 <!--
5 * This test tests whether you can put different widgets in the same
6 * hbox without stretching them, even if you don't set align="center".
7 * I.e. prior to the fix that added this patch, having a button and a
8 * menulist in the same hbox next to each other would stretch the menulist
9 * vertically because the button had such a big vertical margin.
10 *
11 * The test works like this: Two widgets are placed in a hbox, and the second
12 * widget is visibility: hidden. In the reference (nostretch-ref.xul), the
13 * second widget is display: none. If test and reference look the same,
14 * adding the second widget hasn't affected the appearance of the first widget,
15 * and everything's fine.
16 * -->
17 <window title="Stretched controls test"
18 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
19 xmlns:html="http://www.w3.org/1999/xhtml"
20 xmlns:svg="http://www.w3.org/2000/svg"
21 orient="vertical"
22 class="reftest-wait"
23 onload="loaded()">
25 <html:style><![CDATA[
26 .regular {
27 font: -moz-dialog;
28 }
29 .small {
30 font: message-box;
31 }
32 .spacer {
33 height: 40px;
34 }
35 .foreground > :nth-child(2) {
36 visibility: hidden;
37 }
38 ]]>
39 </html:style>
41 <script type="application/javascript;version=1.8"><![CDATA[
43 function cE(elem) {
44 return document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", elem);
45 }
46 function elWithValue(elem, val) {
47 let e = cE(elem);
48 e.setAttribute(elem == "label" || elem == "textbox" ? "value" : "label", val);
49 return e;
50 }
52 function allPairs(set) {
53 let ps = [];
54 for(let i = 0; i < set.length; ++i) {
55 for (let j = 0; j < set.length; ++j) {
56 if (i != j)
57 ps.push([set[i], set[j]]);
58 }
59 }
60 return ps;
61 }
63 function createLabel(v) elWithValue("label", v)
64 function createRadio(v) elWithValue("radio", v)
65 function createCheckbox(v) elWithValue("checkbox", v)
66 function createButton(v) elWithValue("button", v)
67 function createTextField(v) elWithValue("textbox", v)
68 function createMenulist(v) {
69 let [list, popup, item] = [cE("menulist"), cE("menupopup"), elWithValue("menuitem", v)];
70 item.setAttribute("selected", "true");
71 popup.appendChild(item);
72 list.appendChild(popup);
73 return list;
74 }
75 function createEditableMenulist(v) {
76 let list = createMenulist(v);
77 list.setAttribute("editable", "true");
78 return list;
79 }
80 function loaded() {
81 let template = document.getElementById("template");
82 ["regular", "small"].forEach(function(size) {
83 let wrapper = document.querySelectorAll("#wrapper > ." + size)[0];
84 allPairs([
85 createButton, createMenulist, createTextField, createEditableMenulist,
86 ]).forEach(function(elemList) {
87 let newBox = template.cloneNode(true);
88 newBox.className = "spacer";
89 let foregroundRow = newBox.firstChild;
90 elemList.forEach(function(creator) {
91 foregroundRow.appendChild(creator("Label"));
92 });
93 wrapper.appendChild(newBox);
94 });
95 });
96 document.documentElement.className = "";
97 }
99 ]]></script>
100 <vbox id="template">
101 <hbox class="foreground"/>
102 </vbox>
103 <hbox id="wrapper">
104 <vbox class="regular" width="500"/>
105 <vbox class="small" flex="1"/>
106 </hbox>
108 <spacer flex="1"/>
110 </window>