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 | <!-- This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | - License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> |
michael@0 | 5 | |
michael@0 | 6 | |
michael@0 | 7 | <bindings id="menuitemBindings" |
michael@0 | 8 | xmlns="http://www.mozilla.org/xbl" |
michael@0 | 9 | xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" |
michael@0 | 10 | xmlns:xbl="http://www.mozilla.org/xbl"> |
michael@0 | 11 | |
michael@0 | 12 | <binding id="menuitem-base" role="xul:menuitem" |
michael@0 | 13 | extends="chrome://global/content/bindings/general.xml#control-item"> |
michael@0 | 14 | <resources> |
michael@0 | 15 | <stylesheet src="chrome://global/skin/menu.css"/> |
michael@0 | 16 | </resources> |
michael@0 | 17 | <implementation implements="nsIDOMXULSelectControlItemElement, nsIDOMXULContainerItemElement"> |
michael@0 | 18 | <!-- nsIDOMXULSelectControlItemElement --> |
michael@0 | 19 | <property name="selected" readonly="true" |
michael@0 | 20 | onget="return this.getAttribute('selected') == 'true';"/> |
michael@0 | 21 | <property name="control" readonly="true"> |
michael@0 | 22 | <getter> |
michael@0 | 23 | <![CDATA[ |
michael@0 | 24 | var parent = this.parentNode; |
michael@0 | 25 | if (parent && |
michael@0 | 26 | parent.parentNode instanceof Components.interfaces.nsIDOMXULSelectControlElement) |
michael@0 | 27 | return parent.parentNode; |
michael@0 | 28 | return null; |
michael@0 | 29 | ]]> |
michael@0 | 30 | </getter> |
michael@0 | 31 | </property> |
michael@0 | 32 | |
michael@0 | 33 | <!-- nsIDOMXULContainerItemElement --> |
michael@0 | 34 | <property name="parentContainer" readonly="true"> |
michael@0 | 35 | <getter> |
michael@0 | 36 | for (var parent = this.parentNode; parent; parent = parent.parentNode) { |
michael@0 | 37 | if (parent instanceof Components.interfaces.nsIDOMXULContainerElement) |
michael@0 | 38 | return parent; |
michael@0 | 39 | } |
michael@0 | 40 | return null; |
michael@0 | 41 | </getter> |
michael@0 | 42 | </property> |
michael@0 | 43 | </implementation> |
michael@0 | 44 | </binding> |
michael@0 | 45 | |
michael@0 | 46 | <binding id="menu-base" |
michael@0 | 47 | extends="chrome://global/content/bindings/menu.xml#menuitem-base"> |
michael@0 | 48 | |
michael@0 | 49 | <implementation implements="nsIDOMXULContainerElement"> |
michael@0 | 50 | <property name="open" onget="return this.hasAttribute('open');"> |
michael@0 | 51 | <setter><![CDATA[ |
michael@0 | 52 | this.boxObject.QueryInterface(Components.interfaces.nsIMenuBoxObject) |
michael@0 | 53 | .openMenu(val); |
michael@0 | 54 | return val; |
michael@0 | 55 | ]]></setter> |
michael@0 | 56 | </property> |
michael@0 | 57 | |
michael@0 | 58 | <property name="openedWithKey" readonly="true"> |
michael@0 | 59 | <getter><![CDATA[ |
michael@0 | 60 | return this.boxObject.QueryInterface(Components.interfaces.nsIMenuBoxObject) |
michael@0 | 61 | .openedWithKey; |
michael@0 | 62 | ]]></getter> |
michael@0 | 63 | </property> |
michael@0 | 64 | |
michael@0 | 65 | <!-- nsIDOMXULContainerElement interface --> |
michael@0 | 66 | <method name="appendItem"> |
michael@0 | 67 | <parameter name="aLabel"/> |
michael@0 | 68 | <parameter name="aValue"/> |
michael@0 | 69 | <body> |
michael@0 | 70 | return this.insertItemAt(-1, aLabel, aValue); |
michael@0 | 71 | </body> |
michael@0 | 72 | </method> |
michael@0 | 73 | |
michael@0 | 74 | <method name="insertItemAt"> |
michael@0 | 75 | <parameter name="aIndex"/> |
michael@0 | 76 | <parameter name="aLabel"/> |
michael@0 | 77 | <parameter name="aValue"/> |
michael@0 | 78 | <body> |
michael@0 | 79 | const XUL_NS = |
michael@0 | 80 | "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; |
michael@0 | 81 | |
michael@0 | 82 | var menupopup = this.menupopup; |
michael@0 | 83 | if (!menupopup) { |
michael@0 | 84 | menupopup = this.ownerDocument.createElementNS(XUL_NS, "menupopup"); |
michael@0 | 85 | this.appendChild(menupopup); |
michael@0 | 86 | } |
michael@0 | 87 | |
michael@0 | 88 | var menuitem = this.ownerDocument.createElementNS(XUL_NS, "menuitem"); |
michael@0 | 89 | menuitem.setAttribute("label", aLabel); |
michael@0 | 90 | menuitem.setAttribute("value", aValue); |
michael@0 | 91 | |
michael@0 | 92 | var before = this.getItemAtIndex(aIndex); |
michael@0 | 93 | if (before) |
michael@0 | 94 | return menupopup.insertBefore(menuitem, before); |
michael@0 | 95 | return menupopup.appendChild(menuitem); |
michael@0 | 96 | </body> |
michael@0 | 97 | </method> |
michael@0 | 98 | |
michael@0 | 99 | <method name="removeItemAt"> |
michael@0 | 100 | <parameter name="aIndex"/> |
michael@0 | 101 | <body> |
michael@0 | 102 | <![CDATA[ |
michael@0 | 103 | var menupopup = this.menupopup; |
michael@0 | 104 | if (menupopup) { |
michael@0 | 105 | var item = this.getItemAtIndex(aIndex); |
michael@0 | 106 | if (item) |
michael@0 | 107 | return menupopup.removeChild(item); |
michael@0 | 108 | } |
michael@0 | 109 | return null; |
michael@0 | 110 | ]]> |
michael@0 | 111 | </body> |
michael@0 | 112 | </method> |
michael@0 | 113 | |
michael@0 | 114 | <property name="itemCount" readonly="true"> |
michael@0 | 115 | <getter> |
michael@0 | 116 | var menupopup = this.menupopup; |
michael@0 | 117 | return menupopup ? menupopup.childNodes.length : 0; |
michael@0 | 118 | </getter> |
michael@0 | 119 | </property> |
michael@0 | 120 | |
michael@0 | 121 | <method name="getIndexOfItem"> |
michael@0 | 122 | <parameter name="aItem"/> |
michael@0 | 123 | <body> |
michael@0 | 124 | <![CDATA[ |
michael@0 | 125 | var menupopup = this.menupopup; |
michael@0 | 126 | if (menupopup) { |
michael@0 | 127 | var items = menupopup.childNodes; |
michael@0 | 128 | var length = items.length; |
michael@0 | 129 | for (var index = 0; index < length; ++index) { |
michael@0 | 130 | if (items[index] == aItem) |
michael@0 | 131 | return index; |
michael@0 | 132 | } |
michael@0 | 133 | } |
michael@0 | 134 | return -1; |
michael@0 | 135 | ]]> |
michael@0 | 136 | </body> |
michael@0 | 137 | </method> |
michael@0 | 138 | |
michael@0 | 139 | <method name="getItemAtIndex"> |
michael@0 | 140 | <parameter name="aIndex"/> |
michael@0 | 141 | <body> |
michael@0 | 142 | <![CDATA[ |
michael@0 | 143 | var menupopup = this.menupopup; |
michael@0 | 144 | if (!menupopup || aIndex < 0 || aIndex >= menupopup.childNodes.length) |
michael@0 | 145 | return null; |
michael@0 | 146 | |
michael@0 | 147 | return menupopup.childNodes[aIndex]; |
michael@0 | 148 | ]]> |
michael@0 | 149 | </body> |
michael@0 | 150 | </method> |
michael@0 | 151 | |
michael@0 | 152 | <property name="menupopup" readonly="true"> |
michael@0 | 153 | <getter> |
michael@0 | 154 | <![CDATA[ |
michael@0 | 155 | const XUL_NS = |
michael@0 | 156 | "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; |
michael@0 | 157 | |
michael@0 | 158 | for (var child = this.firstChild; child; child = child.nextSibling) { |
michael@0 | 159 | if (child.namespaceURI == XUL_NS && child.localName == "menupopup") |
michael@0 | 160 | return child; |
michael@0 | 161 | } |
michael@0 | 162 | return null; |
michael@0 | 163 | ]]> |
michael@0 | 164 | </getter> |
michael@0 | 165 | </property> |
michael@0 | 166 | </implementation> |
michael@0 | 167 | </binding> |
michael@0 | 168 | |
michael@0 | 169 | <binding id="menu" |
michael@0 | 170 | extends="chrome://global/content/bindings/menu.xml#menu-base"> |
michael@0 | 171 | <content> |
michael@0 | 172 | <xul:label class="menu-text" xbl:inherits="value=label,accesskey,crop" crop="right"/> |
michael@0 | 173 | <xul:hbox class="menu-accel-container" anonid="accel"> |
michael@0 | 174 | <xul:label class="menu-accel" xbl:inherits="value=acceltext"/> |
michael@0 | 175 | </xul:hbox> |
michael@0 | 176 | <xul:hbox align="center" class="menu-right" xbl:inherits="_moz-menuactive,disabled"> |
michael@0 | 177 | <xul:image/> |
michael@0 | 178 | </xul:hbox> |
michael@0 | 179 | <children includes="menupopup"/> |
michael@0 | 180 | </content> |
michael@0 | 181 | </binding> |
michael@0 | 182 | |
michael@0 | 183 | <binding id="menuitem" extends="chrome://global/content/bindings/menu.xml#menuitem-base"> |
michael@0 | 184 | <content> |
michael@0 | 185 | <xul:label class="menu-text" xbl:inherits="value=label,accesskey,crop" crop="right"/> |
michael@0 | 186 | <xul:hbox class="menu-accel-container" anonid="accel"> |
michael@0 | 187 | <xul:label class="menu-accel" xbl:inherits="value=acceltext"/> |
michael@0 | 188 | </xul:hbox> |
michael@0 | 189 | </content> |
michael@0 | 190 | </binding> |
michael@0 | 191 | |
michael@0 | 192 | <binding id="menu-menubar" |
michael@0 | 193 | extends="chrome://global/content/bindings/menu.xml#menu-base"> |
michael@0 | 194 | <content> |
michael@0 | 195 | <xul:label class="menubar-text" xbl:inherits="value=label,accesskey,crop" crop="right"/> |
michael@0 | 196 | <children includes="menupopup"/> |
michael@0 | 197 | </content> |
michael@0 | 198 | </binding> |
michael@0 | 199 | |
michael@0 | 200 | <binding id="menu-menubar-iconic" |
michael@0 | 201 | extends="chrome://global/content/bindings/menu.xml#menu-base"> |
michael@0 | 202 | <content> |
michael@0 | 203 | <xul:image class="menubar-left" xbl:inherits="src=image"/> |
michael@0 | 204 | <xul:label class="menubar-text" xbl:inherits="value=label,accesskey,crop" crop="right"/> |
michael@0 | 205 | <children includes="menupopup"/> |
michael@0 | 206 | </content> |
michael@0 | 207 | </binding> |
michael@0 | 208 | |
michael@0 | 209 | <binding id="menuitem-iconic" extends="chrome://global/content/bindings/menu.xml#menuitem"> |
michael@0 | 210 | <content> |
michael@0 | 211 | <xul:hbox class="menu-iconic-left" align="center" pack="center" |
michael@0 | 212 | xbl:inherits="selected,_moz-menuactive,disabled,checked"> |
michael@0 | 213 | <xul:image class="menu-iconic-icon" xbl:inherits="src=image,validate,src"/> |
michael@0 | 214 | </xul:hbox> |
michael@0 | 215 | <xul:label class="menu-iconic-text" flex="1" xbl:inherits="value=label,accesskey,crop" crop="right"/> |
michael@0 | 216 | <xul:hbox class="menu-accel-container" anonid="accel"> |
michael@0 | 217 | <xul:label class="menu-iconic-accel" xbl:inherits="value=acceltext"/> |
michael@0 | 218 | </xul:hbox> |
michael@0 | 219 | </content> |
michael@0 | 220 | </binding> |
michael@0 | 221 | |
michael@0 | 222 | <binding id="menuitem-iconic-noaccel" extends="chrome://global/content/bindings/menu.xml#menuitem"> |
michael@0 | 223 | <content> |
michael@0 | 224 | <xul:hbox class="menu-iconic-left" align="center" pack="center" |
michael@0 | 225 | xbl:inherits="selected,disabled,checked"> |
michael@0 | 226 | <xul:image class="menu-iconic-icon" xbl:inherits="src=image,validate,src"/> |
michael@0 | 227 | </xul:hbox> |
michael@0 | 228 | <xul:label class="menu-iconic-text" flex="1" xbl:inherits="value=label,accesskey,crop" crop="right"/> |
michael@0 | 229 | </content> |
michael@0 | 230 | </binding> |
michael@0 | 231 | |
michael@0 | 232 | <binding id="menuitem-iconic-desc-noaccel" extends="chrome://global/content/bindings/menu.xml#menuitem"> |
michael@0 | 233 | <content> |
michael@0 | 234 | <xul:hbox class="menu-iconic-left" align="center" pack="center" |
michael@0 | 235 | xbl:inherits="selected,disabled,checked"> |
michael@0 | 236 | <xul:image class="menu-iconic-icon" xbl:inherits="src=image,validate,src"/> |
michael@0 | 237 | </xul:hbox> |
michael@0 | 238 | <xul:label class="menu-iconic-text" xbl:inherits="value=label,accesskey,crop" crop="right" flex="1"/> |
michael@0 | 239 | <xul:label class="menu-iconic-text menu-description" xbl:inherits="value=description" crop="right" flex="10000"/> |
michael@0 | 240 | </content> |
michael@0 | 241 | </binding> |
michael@0 | 242 | |
michael@0 | 243 | <binding id="menu-iconic" |
michael@0 | 244 | extends="chrome://global/content/bindings/menu.xml#menu-base"> |
michael@0 | 245 | <content> |
michael@0 | 246 | <xul:hbox class="menu-iconic-left" align="center" pack="center"> |
michael@0 | 247 | <xul:image class="menu-iconic-icon" xbl:inherits="src=image"/> |
michael@0 | 248 | </xul:hbox> |
michael@0 | 249 | <xul:label class="menu-iconic-text" flex="1" xbl:inherits="value=label,accesskey,crop" crop="right"/> |
michael@0 | 250 | <xul:hbox class="menu-accel-container" anonid="accel"> |
michael@0 | 251 | <xul:label class="menu-iconic-accel" xbl:inherits="value=acceltext"/> |
michael@0 | 252 | </xul:hbox> |
michael@0 | 253 | <xul:hbox align="center" class="menu-right" xbl:inherits="_moz-menuactive,disabled"> |
michael@0 | 254 | <xul:image/> |
michael@0 | 255 | </xul:hbox> |
michael@0 | 256 | <children includes="menupopup|template"/> |
michael@0 | 257 | </content> |
michael@0 | 258 | </binding> |
michael@0 | 259 | |
michael@0 | 260 | <binding id="menubutton-item" extends="chrome://global/content/bindings/menu.xml#menuitem-base"> |
michael@0 | 261 | <content> |
michael@0 | 262 | <xul:label class="menubutton-text" flex="1" xbl:inherits="value=label,accesskey,crop" crop="right"/> |
michael@0 | 263 | <children includes="menupopup"/> |
michael@0 | 264 | </content> |
michael@0 | 265 | </binding> |
michael@0 | 266 | |
michael@0 | 267 | <binding id="menuseparator" role="xul:menuseparator" |
michael@0 | 268 | extends="chrome://global/content/bindings/menu.xml#menuitem-base"> |
michael@0 | 269 | </binding> |
michael@0 | 270 | |
michael@0 | 271 | </bindings> |