2008-11-21 21:12:25 -08:00
|
|
|
<?xml version="1.0"?>
|
2012-05-21 04:12:37 -07:00
|
|
|
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
|
|
|
|
2008-11-21 21:12:25 -08:00
|
|
|
|
|
|
|
<bindings
|
|
|
|
xmlns="http://www.mozilla.org/xbl"
|
|
|
|
xmlns:xbl="http://www.mozilla.org/xbl"
|
|
|
|
xmlns:html="http://www.w3.org/1999/xhtml"
|
|
|
|
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
|
|
|
|
2009-09-09 20:32:13 -07:00
|
|
|
<binding id="documenttab">
|
2011-09-07 13:47:39 -07:00
|
|
|
<content observes="bcast_urlbarState">
|
2011-09-14 14:03:08 -07:00
|
|
|
<xul:vbox anonid="container" class="documenttab-container" left="0" top="0" observes="bcast_urlbarState">
|
|
|
|
<xul:stack anonid="page" flex="1">
|
|
|
|
<html:canvas anonid="thumbnail" class="documenttab-thumbnail" left="0" moz-opaque="true" empty="true"
|
2011-10-06 21:16:38 -07:00
|
|
|
observes="bcast_urlbarState"/>
|
2011-09-14 14:03:08 -07:00
|
|
|
<xul:hbox anonid="reload" class="documenttab-reload" left="0" top="0" onclick="document.getBindingParent(this)._onUndo();" observes="bcast_urlbarState"/>
|
2012-05-18 21:01:42 -07:00
|
|
|
<xul:hbox anonid="close-container" class="documenttab-close-container" top="0" align="center" onclick="event.stopPropagation(); document.getBindingParent(this)._onClose()" observes="bcast_urlbarState">
|
2011-09-14 14:03:08 -07:00
|
|
|
<xul:image anonid="close" class="documenttab-close" mousethrough="always" observes="bcast_urlbarState"/>
|
|
|
|
</xul:hbox>
|
|
|
|
</xul:stack>
|
|
|
|
<xul:label anonid="title" crop="end" class="documenttab-title" observes="bcast_urlbarState"/>
|
|
|
|
</xul:vbox>
|
2008-11-21 21:12:25 -08:00
|
|
|
</content>
|
2010-10-06 08:08:56 -07:00
|
|
|
|
2011-10-06 21:16:38 -07:00
|
|
|
<handlers>
|
|
|
|
<handler event="click" clickcount="1" action="this._onClick()"/>
|
|
|
|
</handlers>
|
|
|
|
|
2010-12-09 07:08:56 -08:00
|
|
|
<implementation>
|
|
|
|
<field name="ignoreUndo">false</field>
|
2011-09-07 13:47:37 -07:00
|
|
|
<field name="thumbnail" readonly="true">document.getAnonymousElementByAttribute(this, "anonid", "thumbnail");</field>
|
|
|
|
<field name="_reload" readonly="true">document.getAnonymousElementByAttribute(this, "anonid", "reload");</field>
|
|
|
|
<field name="_closeContainer" readonly="true">document.getAnonymousElementByAttribute(this, "anonid", "close-container");</field>
|
2011-09-14 14:03:08 -07:00
|
|
|
<field name="_title" readonly="true">document.getAnonymousElementByAttribute(this, "anonid", "title");</field>
|
2011-09-07 13:47:37 -07:00
|
|
|
<field name="_container" readonly="true">this.parentNode.parentNode;</field>
|
|
|
|
|
|
|
|
<constructor>
|
|
|
|
<![CDATA[
|
2011-09-07 13:47:39 -07:00
|
|
|
this.updateTabletLayout(this.thumbnail);
|
2011-09-07 13:47:37 -07:00
|
|
|
]]>
|
|
|
|
</constructor>
|
|
|
|
|
2011-09-07 13:47:39 -07:00
|
|
|
<method name="updateTabletLayout">
|
|
|
|
<parameter name="thumbnail"/>
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
2011-09-19 09:44:03 -07:00
|
|
|
let tabWidth, tabHeight;
|
2011-09-07 13:47:39 -07:00
|
|
|
|
|
|
|
if (Util.isTablet()) {
|
|
|
|
tabWidth = 176;
|
2011-09-19 15:54:19 -07:00
|
|
|
tabHeight = 108;
|
2011-09-07 13:47:39 -07:00
|
|
|
} else {
|
|
|
|
tabWidth = 104;
|
|
|
|
tabHeight = 65;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (tabWidth != thumbnail.width) {
|
|
|
|
let reload = this._reload;
|
|
|
|
let closeContainer = this._closeContainer;
|
2011-09-14 14:03:08 -07:00
|
|
|
let title = this._title;
|
2011-09-07 13:47:39 -07:00
|
|
|
|
2011-09-14 14:03:08 -07:00
|
|
|
thumbnail.width = reload.width = title.width = tabWidth;
|
2011-09-19 15:59:23 -07:00
|
|
|
thumbnail.height = reload.height = closeContainer.height = tabHeight;
|
2011-09-07 13:47:39 -07:00
|
|
|
}
|
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
|
2009-09-09 20:32:13 -07:00
|
|
|
<method name="_onClick">
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
2010-10-06 08:08:56 -07:00
|
|
|
this._container.selectedTab = this;
|
2009-09-09 20:32:13 -07:00
|
|
|
|
2011-02-10 08:13:38 -08:00
|
|
|
let selectFn = new Function("event", this._container.parentNode.getAttribute("onselect"));
|
2009-09-09 20:32:13 -07:00
|
|
|
selectFn.call(this);
|
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
|
2010-10-06 08:08:56 -07:00
|
|
|
<method name="_onClose">
|
2009-09-09 20:32:13 -07:00
|
|
|
<body>
|
|
|
|
<![CDATA[
|
2011-02-10 08:13:38 -08:00
|
|
|
let callbackFunc = this._container.parentNode.getAttribute(this.hasAttribute("reload") ? "onclosereloadtab" : "onclosetab");
|
2010-10-06 08:08:56 -07:00
|
|
|
let closeFn = new Function("event", callbackFunc);
|
2009-09-09 20:32:13 -07:00
|
|
|
closeFn.call(this);
|
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
2008-11-21 21:12:25 -08:00
|
|
|
|
2010-10-06 08:08:56 -07:00
|
|
|
<method name="_onUndo">
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
2011-09-20 13:25:22 -07:00
|
|
|
let container = this._container;
|
|
|
|
let closeFn = new Function("event", container.getAttribute("onreloadtab"));
|
2010-10-06 08:08:56 -07:00
|
|
|
closeFn.call(this);
|
2011-09-20 13:25:22 -07:00
|
|
|
container.removeClosedTab(this);
|
2010-10-06 08:08:56 -07:00
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
|
2011-09-14 14:03:08 -07:00
|
|
|
<method name="updateTitle">
|
|
|
|
<parameter name="title"/>
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
|
|
|
this._title.value = title;
|
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
|
2008-11-21 21:12:25 -08:00
|
|
|
<method name="updateThumbnail">
|
|
|
|
<parameter name="browser"/>
|
2010-06-23 12:23:06 -07:00
|
|
|
<parameter name="width"/>
|
|
|
|
<parameter name="height"/>
|
2008-11-21 21:12:25 -08:00
|
|
|
<body>
|
|
|
|
<![CDATA[
|
2011-05-25 04:49:12 -07:00
|
|
|
let thumbnail = this.thumbnail;
|
2011-09-07 13:47:39 -07:00
|
|
|
// Ensure the thumbnail will have the correct
|
|
|
|
// dimensions for tablet and phone modes
|
|
|
|
this.updateTabletLayout(thumbnail);
|
|
|
|
|
2011-05-25 04:49:12 -07:00
|
|
|
if (browser.currentURI.spec == "about:blank") {
|
|
|
|
thumbnail.setAttribute("empty", "true");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
thumbnail.removeAttribute("empty");
|
|
|
|
|
2011-09-07 13:47:39 -07:00
|
|
|
const tabWidth = thumbnail.width;
|
|
|
|
const tabHeight = thumbnail.height;
|
2008-11-21 21:12:25 -08:00
|
|
|
|
2010-09-24 17:41:10 -07:00
|
|
|
let ratio = tabHeight / tabWidth;
|
2011-03-07 15:01:05 -08:00
|
|
|
if (browser.contentDocumentWidth > 0)
|
|
|
|
width = Math.min(width, browser.contentDocumentWidth);
|
2011-03-18 11:41:12 -07:00
|
|
|
|
|
|
|
if (browser.contentDocumentHeight > 0)
|
|
|
|
height = Math.min(height, browser.contentDocumentHeight);
|
|
|
|
|
|
|
|
let newHeight = width * ratio;
|
|
|
|
if (height >= newHeight) {
|
|
|
|
height = newHeight;
|
|
|
|
} else {
|
|
|
|
// the browser aspect ratio does not match the tabs aspect ratio
|
|
|
|
width = height / ratio;
|
|
|
|
}
|
2010-12-15 17:47:38 -08:00
|
|
|
|
|
|
|
// Recreate the canvas as it may be tainted and not useable for remote pages
|
|
|
|
if (thumbnail.hasAttribute("restored")) {
|
|
|
|
thumbnail.removeAttribute("restored");
|
|
|
|
thumbnail = this.thumbnail.cloneNode(false);
|
|
|
|
this.thumbnail.parentNode.replaceChild(thumbnail, this.thumbnail);
|
|
|
|
this.thumbnail = thumbnail;
|
|
|
|
}
|
|
|
|
|
|
|
|
let self = this;
|
2011-03-07 15:01:05 -08:00
|
|
|
let renderer = rendererFactory(browser, thumbnail);
|
2010-09-03 13:23:55 -07:00
|
|
|
renderer.drawContent(function(ctx, callback) {
|
2010-09-27 08:11:56 -07:00
|
|
|
ctx.save();
|
2010-09-24 17:41:10 -07:00
|
|
|
ctx.clearRect(0, 0, tabWidth, tabHeight);
|
2010-09-03 13:23:55 -07:00
|
|
|
ctx.scale(tabWidth / width, tabHeight / height);
|
|
|
|
callback(browser, 0, 0, width, height, "white");
|
|
|
|
ctx.restore();
|
2010-12-15 17:47:38 -08:00
|
|
|
|
|
|
|
// We don't have an event for the async drawContent anymore, so hack it
|
|
|
|
setTimeout(function() {
|
|
|
|
// Save the thumbnail to the session in case we need to use it in a restore
|
|
|
|
let data = thumbnail.toDataURL("image/png");
|
|
|
|
let ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore);
|
|
|
|
ss.setTabValue(self, "thumbnail", data);
|
|
|
|
}, 800);
|
2010-09-03 13:23:55 -07:00
|
|
|
});
|
2008-11-21 21:12:25 -08:00
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
</implementation>
|
|
|
|
</binding>
|
|
|
|
|
2009-09-09 20:32:13 -07:00
|
|
|
<binding id="tablist">
|
2010-10-06 08:08:56 -07:00
|
|
|
<content>
|
2011-09-08 12:13:12 -07:00
|
|
|
<xul:scrollbox anonid="tabs-scrollbox" class="tabs-scrollbox" flex="1">
|
2011-02-10 08:13:38 -08:00
|
|
|
<xul:vbox class="tabs-list" anonid="tabs-children" />
|
|
|
|
</xul:scrollbox>
|
2010-10-18 14:53:12 -07:00
|
|
|
<xul:box class="tabs-list" anonid="tabs-undo"/>
|
2010-10-06 08:08:56 -07:00
|
|
|
</content>
|
2011-10-06 21:16:38 -07:00
|
|
|
|
|
|
|
<handlers>
|
|
|
|
<handler event="TapDouble" action="this._onDoubleTap();"/>
|
|
|
|
</handlers>
|
|
|
|
|
2008-11-21 21:12:25 -08:00
|
|
|
<implementation>
|
2010-10-06 08:08:56 -07:00
|
|
|
<field name="children">document.getAnonymousElementByAttribute(this, "anonid", "tabs-children");</field>
|
2011-02-10 08:13:38 -08:00
|
|
|
<field name="_scrollbox">document.getAnonymousElementByAttribute(this, "anonid", "tabs-scrollbox");</field>
|
2010-10-06 08:08:56 -07:00
|
|
|
<field name="_tabsUndo">document.getAnonymousElementByAttribute(this, "anonid", "tabs-undo");</field>
|
2009-09-09 20:32:13 -07:00
|
|
|
<field name="_selectedTab">null</field>
|
|
|
|
|
2011-09-22 19:19:12 -07:00
|
|
|
<constructor>
|
|
|
|
<![CDATA[
|
|
|
|
// This customDragger wraps the default dragger, and looks for
|
|
|
|
// horizontal movement to hide or show the tab bar in tablet mode.
|
|
|
|
let scrollbox = this._scrollbox;
|
|
|
|
let [,scroller,dragger] = ScrollUtils.getScrollboxFromElement(scrollbox);
|
|
|
|
scrollbox.customDragger = {
|
|
|
|
_grabSidebar: false,
|
|
|
|
|
|
|
|
isDraggable: function isDraggable(target, content) {
|
|
|
|
return { x: true, y: true };
|
|
|
|
},
|
|
|
|
|
|
|
|
dragStart: function dragStart(cx, cy, target) {
|
2011-10-06 22:51:37 -07:00
|
|
|
this._canGrabSidebar = true;
|
2011-09-23 11:07:43 -07:00
|
|
|
this._grabSidebar = false;
|
2011-09-22 19:19:12 -07:00
|
|
|
dragger.dragStart(cx, cy, target, scroller);
|
|
|
|
},
|
|
|
|
|
|
|
|
dragStop: function dragStop(dx, dy) {
|
|
|
|
if (this._grabSidebar)
|
2011-10-03 12:39:05 -07:00
|
|
|
TabletSidebar.ungrab();
|
2011-09-22 19:19:12 -07:00
|
|
|
dragger.dragStop(dx, dy, scroller);
|
|
|
|
},
|
|
|
|
|
|
|
|
dragMove: function dragMove(dx, dy) {
|
2011-10-06 22:51:37 -07:00
|
|
|
if (this._canGrabSidebar) {
|
|
|
|
this._grabSidebar = TabletSidebar.tryGrab(dx);
|
|
|
|
// After trying once, don't keep checking every move.
|
|
|
|
this._canGrabSidebar = false;
|
2011-09-23 11:07:43 -07:00
|
|
|
}
|
2011-09-22 19:19:12 -07:00
|
|
|
if (this._grabSidebar)
|
2011-10-03 12:39:05 -07:00
|
|
|
TabletSidebar.slideBy(dx);
|
2011-09-22 19:19:12 -07:00
|
|
|
return dragger.dragMove(dx, dy, scroller);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
]]>
|
|
|
|
</constructor>
|
|
|
|
|
2011-02-10 08:13:38 -08:00
|
|
|
<!-- Used by the chrome input handler -->
|
|
|
|
<property name="boxObject"
|
|
|
|
readonly="true"
|
|
|
|
onget="return this._scrollbox.boxObject;"/>
|
|
|
|
|
|
|
|
<field name="scrollBoxObject">
|
|
|
|
this.boxObject.QueryInterface(Ci.nsIScrollBoxObject);
|
|
|
|
</field>
|
|
|
|
|
2011-02-07 04:56:11 -08:00
|
|
|
<field name="_closedTab">null</field>
|
|
|
|
<property name="hasClosedTab" readonly="true" onget="return !!this._closedTab;"/>
|
|
|
|
|
2010-10-06 08:08:56 -07:00
|
|
|
<property name="selectedTab" onget="return this._selectedTab;">
|
2009-09-09 20:32:13 -07:00
|
|
|
<setter>
|
|
|
|
<![CDATA[
|
|
|
|
if (this._selectedTab)
|
2010-10-06 08:08:56 -07:00
|
|
|
this._selectedTab.removeAttribute("selected");
|
2009-09-09 20:32:13 -07:00
|
|
|
|
|
|
|
if (val)
|
2010-10-06 08:08:56 -07:00
|
|
|
val.setAttribute("selected", "true");
|
2009-09-09 20:32:13 -07:00
|
|
|
|
|
|
|
this._selectedTab = val;
|
|
|
|
]]>
|
|
|
|
</setter>
|
2008-11-21 21:12:25 -08:00
|
|
|
</property>
|
2009-09-09 20:32:13 -07:00
|
|
|
|
2008-11-21 21:12:25 -08:00
|
|
|
<method name="addTab">
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
2010-10-06 08:08:56 -07:00
|
|
|
let tab = document.createElement("documenttab");
|
|
|
|
this.children.appendChild(tab);
|
2009-09-09 20:32:13 -07:00
|
|
|
this._updateWidth();
|
2008-11-21 21:12:25 -08:00
|
|
|
return tab;
|
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
2009-09-09 20:32:13 -07:00
|
|
|
|
2008-11-21 21:12:25 -08:00
|
|
|
<method name="removeTab">
|
2009-09-09 20:32:13 -07:00
|
|
|
<parameter name="aTab"/>
|
2008-11-21 21:12:25 -08:00
|
|
|
<body>
|
|
|
|
<![CDATA[
|
2010-10-06 08:08:56 -07:00
|
|
|
let closedTab = this._closedTab;
|
|
|
|
if (closedTab) {
|
|
|
|
this._tabsUndo.removeChild(closedTab);
|
|
|
|
this._closedTab = null;
|
|
|
|
}
|
|
|
|
|
2011-05-25 04:49:12 -07:00
|
|
|
let isEmpty = (aTab.thumbnail && aTab.thumbnail.hasAttribute("empty"));
|
|
|
|
if (aTab.ignoreUndo || isEmpty) {
|
2010-12-09 07:08:56 -08:00
|
|
|
this.children.removeChild(aTab);
|
|
|
|
} else if (!closedTab || closedTab != aTab) {
|
2011-05-25 04:49:12 -07:00
|
|
|
// duplicate the old thumbnail to the new one because moving the
|
|
|
|
// tab in the dom clear the canvas
|
|
|
|
let oldThumbnail = aTab.thumbnail.toDataURL("image/png");
|
|
|
|
this._tabsUndo.appendChild(aTab);
|
|
|
|
let thumbnailImg = new Image();
|
|
|
|
thumbnailImg.onload = function() {
|
|
|
|
if (aTab.thumbnail)
|
|
|
|
aTab.thumbnail.getContext("2d").drawImage(thumbnailImg, 0, 0);
|
|
|
|
};
|
|
|
|
thumbnailImg.src = oldThumbnail;
|
2010-10-06 08:08:56 -07:00
|
|
|
|
|
|
|
aTab.setAttribute("reload", "true");
|
|
|
|
this._closedTab = aTab;
|
|
|
|
}
|
|
|
|
|
|
|
|
this.resize();
|
2009-09-09 20:32:13 -07:00
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
|
2010-10-06 08:08:56 -07:00
|
|
|
<method name="removeClosedTab">
|
|
|
|
<body><![CDATA[
|
|
|
|
if (!this._closedTab)
|
|
|
|
return;
|
|
|
|
|
|
|
|
this.removeTab(this._closedTab);
|
|
|
|
]]></body>
|
|
|
|
</method>
|
|
|
|
|
2009-09-09 20:32:13 -07:00
|
|
|
<method name="resize">
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
2011-08-05 16:01:33 -07:00
|
|
|
let container = Rect.fromRect(this.parentNode.getBoundingClientRect());
|
|
|
|
if (container.height == 0)
|
|
|
|
return; // Don't try to resize while collapsed.
|
|
|
|
|
|
|
|
let element = Rect.fromRect(this._scrollbox.getBoundingClientRect());
|
|
|
|
let undo = Rect.fromRect(this._tabsUndo.getBoundingClientRect());
|
|
|
|
let lastChild = Rect.fromRect(this.parentNode.lastChild.getBoundingClientRect());
|
2011-02-07 04:56:11 -08:00
|
|
|
|
|
|
|
let height = window.innerHeight - element.top - (lastChild.top - element.bottom) - lastChild.height;
|
2010-10-06 08:08:56 -07:00
|
|
|
this.children.style.height = height + "px";
|
2011-02-10 08:13:38 -08:00
|
|
|
this._scrollbox.style.height = height + "px";
|
2008-11-21 21:12:25 -08:00
|
|
|
|
2009-09-09 20:32:13 -07:00
|
|
|
this._updateWidth();
|
2008-11-21 21:12:25 -08:00
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
2009-09-09 20:32:13 -07:00
|
|
|
|
2010-12-15 17:35:24 -08:00
|
|
|
<field name="_columnsCount">0</field>
|
2009-09-09 20:32:13 -07:00
|
|
|
<method name="_updateWidth">
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
2010-12-21 10:16:04 -08:00
|
|
|
// XXX we can do better than using a constant
|
|
|
|
const COLUMN_MARGIN = 20;
|
2010-10-06 08:08:56 -07:00
|
|
|
let firstBox = this.children.firstChild.getBoundingClientRect();
|
|
|
|
let lastBox = this.children.lastChild.getBoundingClientRect();
|
2010-10-07 17:49:00 -07:00
|
|
|
|
2011-01-27 12:33:43 -08:00
|
|
|
// We can't rely on getBoundingClientRect() for this.children height
|
|
|
|
// it is not synced (sometimes, especially during resize) with the
|
|
|
|
// style.height rule
|
2011-09-08 12:13:12 -07:00
|
|
|
let columnsCount = Util.isTablet() ? 1 : Math.ceil(this.children.childNodes.length / Math.floor(parseInt(this.children.style.height) / (firstBox.height + 4)));
|
2010-12-22 09:50:49 -08:00
|
|
|
if (this._columnsCount != columnsCount && window.innerWidth > 1) { // > 1 to ignore column resizing while the main window is loading
|
2011-02-10 08:13:38 -08:00
|
|
|
let width = columnsCount * (COLUMN_MARGIN + firstBox.width);
|
|
|
|
this.children.style.width = width + "px";
|
2011-06-22 12:46:42 -07:00
|
|
|
|
|
|
|
// Clamp the sidebar width so it won't overflow the window. Only clamp
|
|
|
|
// the scrollbox. The children need to be the full width.
|
|
|
|
if (width > window.innerWidth - firstBox.width)
|
|
|
|
width = window.innerWidth - firstBox.width;
|
2011-02-10 08:13:38 -08:00
|
|
|
this._scrollbox.style.width = width + "px";
|
2009-09-09 20:32:13 -07:00
|
|
|
this._columnsCount = columnsCount;
|
|
|
|
}
|
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
|
2011-10-06 21:16:38 -07:00
|
|
|
<method name="_onDoubleTap">
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
|
|
|
new Function("event", this.getAttribute("ondoubletap")).call();
|
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
|
2008-11-21 21:12:25 -08:00
|
|
|
</implementation>
|
|
|
|
</binding>
|
|
|
|
|
2011-09-19 20:17:05 -07:00
|
|
|
<binding id="documenttab-popup" extends="chrome://browser/content/bindings.xml#richlistitem">
|
|
|
|
<content>
|
|
|
|
<xul:box class="tab-popup-item-box">
|
|
|
|
<xul:image class="documenttab-popup-checkmark"/>
|
|
|
|
<xul:image class="documenttab-popup-favicon" xbl:inherits="src=img"/>
|
|
|
|
<xul:label class="documenttab-popup-label" xbl:inherits="value=label" crop="center"/>
|
|
|
|
<xul:button class="documenttab-popup-closebutton" onclick="event.stopPropagation(); document.getBindingParent(this)._onClose()" />
|
|
|
|
</xul:box>
|
|
|
|
</content>
|
|
|
|
|
|
|
|
<implementation>
|
|
|
|
<field name="_container" readonly="true">this.parentNode;</field>
|
|
|
|
<field name="tab">null</field>
|
|
|
|
|
|
|
|
<method name="_onClick">
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
|
|
|
this._container.selectedTab = this;
|
|
|
|
let selectFn = new Function("event", this._container.getAttribute("onselect"));
|
|
|
|
selectFn.call(this.tab);
|
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
|
|
|
|
<method name="_onClose">
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
|
|
|
let callbackFunc = this._container.getAttribute(this.hasAttribute("reload") ? "onclosereloadtab" : "onclosetab");
|
|
|
|
let closeFn = new Function("event", callbackFunc);
|
|
|
|
closeFn.call(this.tab);
|
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
|
|
|
|
</implementation>
|
|
|
|
|
|
|
|
<handlers>
|
|
|
|
<handler event="click" action="this._onClick();"/>
|
|
|
|
</handlers>
|
|
|
|
|
|
|
|
</binding>
|
|
|
|
|
2008-11-21 21:12:25 -08:00
|
|
|
</bindings>
|