mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
149 lines
4.5 KiB
XML
149 lines
4.5 KiB
XML
<?xml version="1.0"?>
|
|
<!DOCTYPE bindings PUBLIC "-//MOZILLA//DTD XBL V1.0//EN" "http://www.mozilla.org/xbl">
|
|
|
|
<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">
|
|
|
|
<binding id="documenttab">
|
|
<content>
|
|
<xul:stack anonid="page" class="documenttab-container" flex="1">
|
|
<html:canvas anonid="canvas" class="documenttab-canvas" left="8" width="106" height="64" moz-opaque="true"
|
|
onclick="document.getBindingParent(this)._onClick()"/>
|
|
<xul:hbox left="0" top="10" height="64" align="center" onclick="document.getBindingParent(this)._close()">
|
|
<xul:image anonid="close" class="documenttab-close"/>
|
|
</xul:hbox>
|
|
</xul:stack>
|
|
</content>
|
|
|
|
<implementation>
|
|
<method name="_onClick">
|
|
<body>
|
|
<![CDATA[
|
|
this.parentNode.selectedTab = this;
|
|
|
|
let selectFn = new Function("event", this.parentNode.getAttribute('onselect'));
|
|
selectFn.call(this);
|
|
]]>
|
|
</body>
|
|
</method>
|
|
|
|
<method name="_close">
|
|
<body>
|
|
<![CDATA[
|
|
let closeFn = new Function("event", this.parentNode.getAttribute('onclosetab'));
|
|
closeFn.call(this);
|
|
]]>
|
|
</body>
|
|
</method>
|
|
|
|
<method name="updateThumbnail">
|
|
<parameter name="browser"/>
|
|
<parameter name="browserView"/>
|
|
<body>
|
|
<![CDATA[
|
|
const tabWidth = 106;
|
|
const tabHeight = 64;
|
|
|
|
let destCanvas = document.getAnonymousElementByAttribute(this, "anonid", "canvas");
|
|
|
|
if (browserView) {
|
|
browserView.renderToCanvas(destCanvas, tabWidth, tabHeight);
|
|
} else {
|
|
let domWin = browser.contentWindow;
|
|
let ctx = destCanvas.getContext("2d");
|
|
let width = domWin.innerWidth;
|
|
let height = domWin.innerHeight;
|
|
ctx.clearRect(0, 0, tabWidth, tabHeight);
|
|
ctx.save();
|
|
ctx.scale(tabWidth / width, tabHeight / height);
|
|
ctx.drawWindow(domWin, 0, 0, width, height, "white");
|
|
ctx.restore();
|
|
}
|
|
]]>
|
|
</body>
|
|
</method>
|
|
</implementation>
|
|
</binding>
|
|
|
|
<binding id="tablist">
|
|
<implementation>
|
|
<field name="_selectedTab">null</field>
|
|
|
|
<property name="selectedTab">
|
|
<getter>
|
|
<![CDATA[
|
|
return this._selectedTab;
|
|
]]>
|
|
</getter>
|
|
<setter>
|
|
<![CDATA[
|
|
if (this._selectedTab)
|
|
this._selectedTab.removeAttribute('selected');
|
|
|
|
if (val)
|
|
val.setAttribute('selected', 'true');
|
|
|
|
this._selectedTab = val;
|
|
]]>
|
|
</setter>
|
|
</property>
|
|
|
|
<method name="addTab">
|
|
<body>
|
|
<![CDATA[
|
|
let tab = document.createElement("box");
|
|
tab.setAttribute("type", "documenttab");
|
|
this.appendChild(tab);
|
|
this._updateWidth();
|
|
return tab;
|
|
]]>
|
|
</body>
|
|
</method>
|
|
|
|
<method name="removeTab">
|
|
<parameter name="aTab"/>
|
|
<body>
|
|
<![CDATA[
|
|
this.removeChild(aTab);
|
|
this._updateWidth();
|
|
]]>
|
|
</body>
|
|
</method>
|
|
|
|
<method name="resize">
|
|
<body>
|
|
<![CDATA[
|
|
let container = document.getElementById("tabs-container").getBoundingClientRect();
|
|
let el = this.getBoundingClientRect();
|
|
|
|
let height = container.top + (el.top - container.top)
|
|
+ ((container.top + container.height) - (el.top + el.height));
|
|
this.style.height = (window.innerHeight - height) + "px";
|
|
|
|
this._updateWidth();
|
|
]]>
|
|
</body>
|
|
</method>
|
|
|
|
<field name="_columnsCount">1</field>
|
|
<method name="_updateWidth">
|
|
<body>
|
|
<![CDATA[
|
|
let boundingBox = this.firstChild.getBoundingClientRect();
|
|
let columnsCount = Math.ceil(this.childNodes.length / Math.floor(this.style.height / boundingBox.height));
|
|
if (this._columnsCount != columnsCount) {
|
|
this.style.width = (this.lastChild.boxObject.x + boundingBox.width) + "px";
|
|
this._columnsCount = columnsCount;
|
|
}
|
|
]]>
|
|
</body>
|
|
</method>
|
|
|
|
</implementation>
|
|
</binding>
|
|
|
|
</bindings>
|