|
1 <?xml version="1.0"?> |
|
2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?> |
|
3 |
|
4 <window title="Stretched controls test reference" |
|
5 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" |
|
6 xmlns:html="http://www.w3.org/1999/xhtml" |
|
7 xmlns:svg="http://www.w3.org/2000/svg" |
|
8 orient="vertical" |
|
9 class="reftest-wait" |
|
10 onload="loaded()"> |
|
11 |
|
12 <html:style><![CDATA[ |
|
13 .regular { |
|
14 font: -moz-dialog; |
|
15 } |
|
16 .small { |
|
17 font: message-box; |
|
18 } |
|
19 .spacer { |
|
20 height: 40px; |
|
21 } |
|
22 .foreground > :nth-child(2) { |
|
23 display: none; /* <----- This is the only difference from nostretch.xul */ |
|
24 } |
|
25 ]]> |
|
26 </html:style> |
|
27 |
|
28 <script type="application/javascript;version=1.8"><![CDATA[ |
|
29 |
|
30 function cE(elem) { |
|
31 return document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", elem); |
|
32 } |
|
33 function elWithValue(elem, val) { |
|
34 let e = cE(elem); |
|
35 e.setAttribute(elem == "label" || elem == "textbox" ? "value" : "label", val); |
|
36 return e; |
|
37 } |
|
38 |
|
39 function allPairs(set) { |
|
40 let ps = []; |
|
41 for(let i = 0; i < set.length; ++i) { |
|
42 for (let j = 0; j < set.length; ++j) { |
|
43 if (i != j) |
|
44 ps.push([set[i], set[j]]); |
|
45 } |
|
46 } |
|
47 return ps; |
|
48 } |
|
49 |
|
50 function createLabel(v) elWithValue("label", v) |
|
51 function createRadio(v) elWithValue("radio", v) |
|
52 function createCheckbox(v) elWithValue("checkbox", v) |
|
53 function createButton(v) elWithValue("button", v) |
|
54 function createTextField(v) elWithValue("textbox", v) |
|
55 function createMenulist(v) { |
|
56 let [list, popup, item] = [cE("menulist"), cE("menupopup"), elWithValue("menuitem", v)]; |
|
57 item.setAttribute("selected", "true"); |
|
58 popup.appendChild(item); |
|
59 list.appendChild(popup); |
|
60 return list; |
|
61 } |
|
62 function createEditableMenulist(v) { |
|
63 let list = createMenulist(v); |
|
64 list.setAttribute("editable", "true"); |
|
65 return list; |
|
66 } |
|
67 function loaded() { |
|
68 let template = document.getElementById("template"); |
|
69 ["regular", "small"].forEach(function(size) { |
|
70 let wrapper = document.querySelectorAll("#wrapper > ." + size)[0]; |
|
71 allPairs([ |
|
72 createButton, createMenulist, createTextField, createEditableMenulist, |
|
73 ]).forEach(function(elemList) { |
|
74 let newBox = template.cloneNode(true); |
|
75 newBox.className = "spacer"; |
|
76 let foregroundRow = newBox.firstChild; |
|
77 elemList.forEach(function(creator) { |
|
78 foregroundRow.appendChild(creator("Label")); |
|
79 }); |
|
80 wrapper.appendChild(newBox); |
|
81 }); |
|
82 }); |
|
83 document.documentElement.className = ""; |
|
84 } |
|
85 |
|
86 ]]></script> |
|
87 <vbox id="template"> |
|
88 <hbox class="foreground"/> |
|
89 </vbox> |
|
90 <hbox id="wrapper"> |
|
91 <vbox class="regular" width="500"/> |
|
92 <vbox class="small" flex="1"/> |
|
93 </hbox> |
|
94 |
|
95 <spacer flex="1"/> |
|
96 |
|
97 </window> |