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