toolkit/content/widgets/spinbuttons.xml

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1 <?xml version="1.0" encoding="UTF-8"?>
michael@0 2
michael@0 3 <!-- This Source Code Form is subject to the terms of the Mozilla Public
michael@0 4 - License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 5 - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
michael@0 6
michael@0 7 <bindings id="spinbuttonsBindings"
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="spinbuttons"
michael@0 13 extends="chrome://global/content/bindings/general.xml#basecontrol">
michael@0 14
michael@0 15 <resources>
michael@0 16 <stylesheet src="chrome://global/skin/spinbuttons.css"/>
michael@0 17 </resources>
michael@0 18
michael@0 19 <content>
michael@0 20 <xul:vbox class="spinbuttons-box" flex="1">
michael@0 21 <xul:button anonid="increaseButton" type="repeat" flex="1"
michael@0 22 class="spinbuttons-button spinbuttons-up"
michael@0 23 xbl:inherits="disabled,disabled=increasedisabled"/>
michael@0 24 <xul:button anonid="decreaseButton" type="repeat" flex="1"
michael@0 25 class="spinbuttons-button spinbuttons-down"
michael@0 26 xbl:inherits="disabled,disabled=decreasedisabled"/>
michael@0 27 </xul:vbox>
michael@0 28 </content>
michael@0 29
michael@0 30 <implementation>
michael@0 31 <property name="_increaseButton" readonly="true">
michael@0 32 <getter>
michael@0 33 return document.getAnonymousElementByAttribute(this, "anonid", "increaseButton");
michael@0 34 </getter>
michael@0 35 </property>
michael@0 36 <property name="_decreaseButton" readonly="true">
michael@0 37 <getter>
michael@0 38 return document.getAnonymousElementByAttribute(this, "anonid", "decreaseButton");
michael@0 39 </getter>
michael@0 40 </property>
michael@0 41
michael@0 42 <property name="increaseDisabled"
michael@0 43 onget="return this._increaseButton.getAttribute('disabled') == 'true';"
michael@0 44 onset="if (val) this._increaseButton.setAttribute('disabled', 'true');
michael@0 45 else this._increaseButton.removeAttribute('disabled'); return val;"/>
michael@0 46 <property name="decreaseDisabled"
michael@0 47 onget="return this._decreaseButton.getAttribute('disabled') == 'true';"
michael@0 48 onset="if (val) this._decreaseButton.setAttribute('disabled', 'true');
michael@0 49 else this._decreaseButton.removeAttribute('disabled'); return val;"/>
michael@0 50 </implementation>
michael@0 51
michael@0 52 <handlers>
michael@0 53 <handler event="mousedown">
michael@0 54 <![CDATA[
michael@0 55 // on the Mac, the native theme draws the spinbutton as a single widget
michael@0 56 // so a state attribute is set based on where the mouse button was pressed
michael@0 57 if (event.originalTarget == this._increaseButton)
michael@0 58 this.setAttribute("state", "up");
michael@0 59 else if (event.originalTarget == this._decreaseButton)
michael@0 60 this.setAttribute("state", "down");
michael@0 61 ]]>
michael@0 62 </handler>
michael@0 63
michael@0 64 <handler event="mouseup">
michael@0 65 this.removeAttribute("state");
michael@0 66 </handler>
michael@0 67 <handler event="mouseout">
michael@0 68 this.removeAttribute("state");
michael@0 69 </handler>
michael@0 70
michael@0 71 <handler event="command">
michael@0 72 <![CDATA[
michael@0 73 var eventname;
michael@0 74 if (event.originalTarget == this._increaseButton)
michael@0 75 eventname = "up";
michael@0 76 else if (event.originalTarget == this._decreaseButton)
michael@0 77 eventname = "down";
michael@0 78
michael@0 79 var evt = document.createEvent("Events");
michael@0 80 evt.initEvent(eventname, true, true);
michael@0 81 var cancel = this.dispatchEvent(evt);
michael@0 82
michael@0 83 if (this.hasAttribute("on" + eventname)) {
michael@0 84 var fn = new Function("event", this.getAttribute("on" + eventname));
michael@0 85 if (fn.call(this, event) == false)
michael@0 86 cancel = true;
michael@0 87 }
michael@0 88
michael@0 89 return !cancel;
michael@0 90 ]]>
michael@0 91 </handler>
michael@0 92
michael@0 93 </handlers>
michael@0 94 </binding>
michael@0 95
michael@0 96 </bindings>

mercurial