browser/metro/base/content/bindings/tabs.xml

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

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 <!DOCTYPE bindings [
michael@0 7 <!ENTITY % browserDTD SYSTEM "chrome://browser/locale/browser.dtd">
michael@0 8 %browserDTD;
michael@0 9 ]>
michael@0 10
michael@0 11 <bindings
michael@0 12 xmlns="http://www.mozilla.org/xbl"
michael@0 13 xmlns:xbl="http://www.mozilla.org/xbl"
michael@0 14 xmlns:html="http://www.w3.org/1999/xhtml"
michael@0 15 xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
michael@0 16
michael@0 17 <binding id="documenttab">
michael@0 18 <content>
michael@0 19 <xul:stack class="documenttab-container">
michael@0 20 <html:canvas anonid="thumbnail-canvas" class="documenttab-thumbnail" />
michael@0 21 <xul:image anonid="favicon" class="documenttab-favicon" width="26" height="26"/>
michael@0 22
michael@0 23 <xul:label anonid="title" class="documenttab-title" bottom="0" start="0" end="0" crop="end"/>
michael@0 24 <xul:box anonid="selection" class="documenttab-crop"/>
michael@0 25 <xul:box anonid="selection" class="documenttab-selection"/>
michael@0 26 <xul:button anonid="close" class="documenttab-close" end="0" top="0"
michael@0 27 onclick="event.stopPropagation(); document.getBindingParent(this)._onClose()"
michael@0 28 label="&closetab.label;"/>
michael@0 29 </xul:stack>
michael@0 30 </content>
michael@0 31
michael@0 32 <handlers>
michael@0 33 <handler event="click" button="0" clickcount="1" action="this._onClick()"/>
michael@0 34 <handler event="click" button="1" clickcount="1" action="event.stopPropagation(); this._onClose()"/>
michael@0 35 <handler event="dblclick" action="this._onDoubleClick(); event.stopPropagation();"/>
michael@0 36 </handlers>
michael@0 37
michael@0 38 <implementation>
michael@0 39 <field name="thumbnailCanvas" readonly="true">document.getAnonymousElementByAttribute(this, "anonid", "thumbnail-canvas");</field>
michael@0 40 <field name="_close" readonly="true">document.getAnonymousElementByAttribute(this, "anonid", "close");</field>
michael@0 41 <field name="_title" readonly="true">document.getAnonymousElementByAttribute(this, "anonid", "title");</field>
michael@0 42 <field name="_favicon" readonly="true">document.getAnonymousElementByAttribute(this, "anonid", "favicon");</field>
michael@0 43 <field name="_container" readonly="true">this.parentNode;</field>
michael@0 44
michael@0 45 <constructor>
michael@0 46 <![CDATA[
michael@0 47 this.thumbnailCanvas.mozOpaque = true;
michael@0 48 this.thumbnailCanvas.mozImageSmoothingEnabled = true;
michael@0 49 ]]>
michael@0 50 </constructor>
michael@0 51
michael@0 52 <method name="_onClick">
michael@0 53 <body>
michael@0 54 <![CDATA[
michael@0 55 this._container.selectedTab = this;
michael@0 56 let selectFn = new Function("event", this._container.parentNode.getAttribute("onselect"));
michael@0 57 selectFn.call(this);
michael@0 58 ]]>
michael@0 59 </body>
michael@0 60 </method>
michael@0 61
michael@0 62 <method name="_onDoubleClick">
michael@0 63 <body>
michael@0 64 <![CDATA[
michael@0 65 this._container.selectedTab = this;
michael@0 66 let selectFn = new Function("event", this._container.parentNode.getAttribute("ondbltap"));
michael@0 67 selectFn.call(this);
michael@0 68 ]]>
michael@0 69 </body>
michael@0 70 </method>
michael@0 71
michael@0 72 <method name="_onClose">
michael@0 73 <body>
michael@0 74 <![CDATA[
michael@0 75 let callbackFunc = this._container.parentNode.getAttribute("onclosetab");
michael@0 76 let closeFn = new Function("event", callbackFunc);
michael@0 77 closeFn.call(this);
michael@0 78 ]]>
michael@0 79 </body>
michael@0 80 </method>
michael@0 81
michael@0 82 <method name="updateTitle">
michael@0 83 <parameter name="title"/>
michael@0 84 <body>
michael@0 85 <![CDATA[
michael@0 86 this._title.value = title;
michael@0 87 ]]>
michael@0 88 </body>
michael@0 89 </method>
michael@0 90
michael@0 91 <method name="updateFavicon">
michael@0 92 <parameter name="src"/>
michael@0 93 <body>
michael@0 94 <![CDATA[
michael@0 95 this._favicon.src = src;
michael@0 96 ]]>
michael@0 97 </body>
michael@0 98 </method>
michael@0 99
michael@0 100 </implementation>
michael@0 101 </binding>
michael@0 102
michael@0 103 <binding id="tablist">
michael@0 104 <content>
michael@0 105 <xul:arrowscrollbox anonid="tabs-scrollbox" class="tabs-scrollbox" flex="1" orient="horizontal"
michael@0 106 clicktoscroll="true" />
michael@0 107 </content>
michael@0 108
michael@0 109 <handlers>
michael@0 110 <handler event="dblclick" action="this._onDoubleClick();"/>
michael@0 111 </handlers>
michael@0 112
michael@0 113 <implementation implements="nsIDOMEventListener">
michael@0 114 <constructor>
michael@0 115 <![CDATA[
michael@0 116 window.addEventListener("MozContextUITabsShow", this, true);
michael@0 117 ]]>
michael@0 118 </constructor>
michael@0 119
michael@0 120 <destructor>
michael@0 121 <![CDATA[
michael@0 122 window.removeEventListener("MozContextUITabsShow", this, true);
michael@0 123 ]]>
michael@0 124 </destructor>
michael@0 125
michael@0 126 <method name="handleEvent">
michael@0 127 <parameter name="event"/>
michael@0 128 <body>
michael@0 129 <![CDATA[
michael@0 130 switch (event.type) {
michael@0 131 case "MozContextUITabsShow":
michael@0 132 this.strip.ensureElementIsVisible(this.selectedTab, false);
michael@0 133 break;
michael@0 134 }
michael@0 135 ]]>
michael@0 136 </body>
michael@0 137 </method>
michael@0 138
michael@0 139 <field name="strip">document.getAnonymousElementByAttribute(this, "anonid", "tabs-scrollbox");</field>
michael@0 140 <field name="_selectedTab">null</field>
michael@0 141
michael@0 142 <!-- Used by the chrome input handler -->
michael@0 143 <property name="anonScrollBox"
michael@0 144 readonly="true"
michael@0 145 onget="return this.strip;"/>
michael@0 146
michael@0 147 <property name="selectedTab" onget="return this._selectedTab;">
michael@0 148 <setter>
michael@0 149 <![CDATA[
michael@0 150 if (this._selectedTab)
michael@0 151 this._selectedTab.removeAttribute("selected");
michael@0 152
michael@0 153 if (val)
michael@0 154 val.setAttribute("selected", "true");
michael@0 155
michael@0 156 this._selectedTab = val;
michael@0 157 this.strip.ensureElementIsVisible(val);
michael@0 158 ]]>
michael@0 159 </setter>
michael@0 160 </property>
michael@0 161
michael@0 162 <method name="addTab">
michael@0 163 <parameter name="aIndex"/>
michael@0 164 <body>
michael@0 165 <![CDATA[
michael@0 166 let tab = document.createElement("documenttab");
michael@0 167 if (aIndex >= 0) {
michael@0 168 let child = this.strip.children[aIndex];
michael@0 169 this.strip.insertBefore(tab, child);
michael@0 170 } else {
michael@0 171 this.strip.appendChild(tab);
michael@0 172 }
michael@0 173 return tab;
michael@0 174 ]]>
michael@0 175 </body>
michael@0 176 </method>
michael@0 177
michael@0 178 <method name="removeTab">
michael@0 179 <parameter name="aTab"/>
michael@0 180 <body>
michael@0 181 <![CDATA[
michael@0 182 this.strip.removeChild(aTab);
michael@0 183 ]]>
michael@0 184 </body>
michael@0 185 </method>
michael@0 186
michael@0 187 <method name="_onDoubleTap">
michael@0 188 <body>
michael@0 189 <![CDATA[
michael@0 190 new Function("event", this.getAttribute("ondoubletap")).call();
michael@0 191 ]]>
michael@0 192 </body>
michael@0 193 </method>
michael@0 194
michael@0 195 <method name="_onDoubleClick">
michael@0 196 <body>
michael@0 197 <![CDATA[
michael@0 198 // ignore mouse events if we're interacting with touch input
michael@0 199 if (!InputSourceHelper.isPrecise)
michael@0 200 return;
michael@0 201 new Function("event", this.getAttribute("ondoubletap")).call();
michael@0 202 ]]>
michael@0 203 </body>
michael@0 204 </method>
michael@0 205
michael@0 206 </implementation>
michael@0 207 </binding>
michael@0 208 </bindings>

mercurial