mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-24 16:54:08 +00:00
Fix for bug 112534. Remove collapse grippies.
r=caillon, sr=jag
This commit is contained in:
parent
ac949626ce
commit
889977c6d1
@ -11,158 +11,13 @@
|
||||
</resources>
|
||||
</binding>
|
||||
|
||||
<binding id="toolbox" extends="chrome://global/content/bindings/toolbar.xml#toolbar-base">
|
||||
<content orient="vertical">
|
||||
<xul:vbox flex="1" class="toolbar-internal-box">
|
||||
<children/>
|
||||
</xul:vbox>
|
||||
<xul:hbox tbattr="collapsed-tray-holder" class="collapsed-tray-holder" moz-collapsed="true">
|
||||
<xul:hbox tbattr="collapsed-tray" class="collapsed-tray"/>
|
||||
<xul:spacer flex="1" class="collapsed-tray-spacer"/>
|
||||
</xul:hbox>
|
||||
</content>
|
||||
|
||||
<implementation>
|
||||
<method name="collapseToolbar">
|
||||
<parameter name="toolbar"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||
try {
|
||||
this.createCollapsedGrippy(toolbar);
|
||||
toolbar.setAttribute("moz-collapsed", "true");
|
||||
document.persist(toolbar.id, "moz-collapsed");
|
||||
}
|
||||
catch(e) {
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="expandToolbar">
|
||||
<parameter name="aGrippyID"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var idString = aGrippyID.substring("moz_tb_collapsed_".length, aGrippyID.length);
|
||||
var toolbar = document.getElementById(idString);
|
||||
toolbar.setAttribute("moz-collapsed", "false");
|
||||
var collapsedTray = this.findNodeByAttribute("tbattr", "collapsed-tray");
|
||||
var collapsedToolbar = document.getElementById("moz_tb_collapsed_" + toolbar.id);
|
||||
collapsedTray.removeChild(collapsedToolbar);
|
||||
if (!collapsedTray.hasChildNodes())
|
||||
this.findNodeByAttribute("tbattr", "collapsed-tray-holder").setAttribute("moz-collapsed", "true");
|
||||
document.persist(toolbar.id, "moz-collapsed");
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="findNodeByAttribute">
|
||||
<parameter name="aAttribute"/>
|
||||
<parameter name="aValue"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var nodes = document.getAnonymousNodes(this);
|
||||
for (var i = 0; i < nodes.length; i++) {
|
||||
if (nodes[i].getAttribute(aAttribute) == aValue)
|
||||
return nodes[i];
|
||||
else {
|
||||
var subnodes = nodes[i].getElementsByAttribute(aAttribute, aValue);
|
||||
if (!subnodes.length) continue;
|
||||
return subnodes[0];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="createCollapsedGrippy">
|
||||
<parameter name="aToolbar"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||
try {
|
||||
var grippy = aToolbar.findNodeByAttribute("tbattr", "toolbar-grippy");
|
||||
var boxObject = grippy.boxObject.QueryInterface(Components.interfaces.nsIBoxObject);
|
||||
var collapsedGrippy = document.createElementNS(XUL_NS, "toolbargrippy");
|
||||
if (collapsedGrippy) {
|
||||
var width = boxObject.height > 20 ? boxObject.height : 23;
|
||||
var height = boxObject.width > 10 ? boxObject.width : 12;
|
||||
var styleString = "width: " + width + "px; height: " + height + "px;";
|
||||
collapsedGrippy.setAttribute("style", styleString);
|
||||
collapsedGrippy.setAttribute("tooltiptext", aToolbar.getAttribute("grippytooltiptext"));
|
||||
collapsedGrippy.setAttribute("id", "moz_tb_collapsed_" + aToolbar.id);
|
||||
collapsedGrippy.setAttribute("moz_grippy_collapsed", "true");
|
||||
collapsedGrippy.setAttribute("tbgrippy-collapsed", "true");
|
||||
var collapsedTrayHolder = this.findNodeByAttribute("tbattr", "collapsed-tray-holder");
|
||||
if (collapsedTrayHolder.getAttribute("moz-collapsed") == "true")
|
||||
collapsedTrayHolder.removeAttribute("moz-collapsed");
|
||||
this.findNodeByAttribute("tbattr", "collapsed-tray").appendChild(collapsedGrippy);
|
||||
collapsedGrippy = document.getElementById("moz_tb_collapsed_" + aToolbar.id);
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
throw e;
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<property name="deferAttached">
|
||||
<getter>
|
||||
return (this.hasAttribute("deferattached") ? "true" : "false");
|
||||
</getter>
|
||||
<setter>
|
||||
if (val)
|
||||
this.setAttribute("deferattached", "true");
|
||||
else
|
||||
this.removeAttribute("deferattached");
|
||||
return val;
|
||||
</setter>
|
||||
</property>
|
||||
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="toolbar" extends="chrome://global/content/bindings/toolbar.xml#toolbar-base">
|
||||
<content>
|
||||
<xul:toolbargrippy xbl:inherits="last-toolbar,hidden=grippyhidden"
|
||||
tbattr="toolbar-grippy"
|
||||
class="toolbar-grippy"/>
|
||||
<xul:hbox flex="1" class="toolbar-holder" align="center"
|
||||
xbl:inherits="collapsed,last-toolbar,orient=tborient,align=tbalign,pack=tbpack">
|
||||
<children/>
|
||||
</xul:hbox>
|
||||
</content>
|
||||
|
||||
<implementation>
|
||||
<constructor>
|
||||
<![CDATA[
|
||||
if (this.getAttribute("moz-collapsed") == "true" &&
|
||||
this.parentNode.localName == "toolbox")
|
||||
this.parentNode.createCollapsedGrippy(this);
|
||||
]]>
|
||||
</constructor>
|
||||
|
||||
<method name="findNodeByAttribute">
|
||||
<parameter name="aAttribute"/>
|
||||
<parameter name="aValue"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var nodes = document.getAnonymousNodes(this);
|
||||
for (var i = 0; i < nodes.length; i++) {
|
||||
if (nodes[i].getAttribute(aAttribute) == aValue)
|
||||
return nodes[i];
|
||||
else {
|
||||
var subnodes = nodes[i].getElementsByAttribute(aAttribute, aValue);
|
||||
return subnodes.length ? subnodes[0] : null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="toolbar-primary" extends="chrome://global/content/bindings/toolbar.xml#toolbar">
|
||||
@ -224,8 +79,6 @@
|
||||
</resources>
|
||||
|
||||
<content>
|
||||
<xul:toolbargrippy xbl:inherits="last-toolbar,hidden=grippyhidden"
|
||||
tbattr="toolbar-grippy" class="toolbar-grippy"/>
|
||||
<xul:hbox flex="1" class="toolbar-holder" xbl:inherits="collapsed,last-toolbar" align="center">
|
||||
<children/>
|
||||
</xul:hbox>
|
||||
@ -240,95 +93,9 @@
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
|
||||
<constructor>
|
||||
<![CDATA[
|
||||
if (this.getAttribute("moz-collapsed") == "true" &&
|
||||
this.parentNode.localName == "toolbox")
|
||||
this.parentNode.createCollapsedGrippy(this);
|
||||
]]>
|
||||
</constructor>
|
||||
|
||||
<method name="findNodeByAttribute">
|
||||
<parameter name="aAttribute"/>
|
||||
<parameter name="aValue"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var nodes = document.getAnonymousNodes(this);
|
||||
for (var i = 0; i < nodes.length; i++) {
|
||||
if (nodes[i].getAttribute(aAttribute) == aValue)
|
||||
return nodes[i];
|
||||
else {
|
||||
var subnodes = nodes[i].getElementsByAttribute(aAttribute, aValue);
|
||||
return subnodes.length ? subnodes[0] : null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="toolbargrippy" display="xul:button"
|
||||
extends="chrome://global/content/bindings/toolbar.xml#toolbar-base">
|
||||
<content>
|
||||
<xul:image class="toolbargrippy-arrow"/>
|
||||
<xul:spacer class="toolbargrippy-texture" flex="1"/>
|
||||
</content>
|
||||
|
||||
<implementation>
|
||||
<property name="collapsed">
|
||||
<getter>
|
||||
return this.hasAttribute("moz_grippy_collapsed");
|
||||
</getter>
|
||||
<setter>
|
||||
if (val)
|
||||
this.setAttribute("moz_grippy_collapsed", "true");
|
||||
else
|
||||
this.removeAttribute("moz_grippy_collapsed");
|
||||
return val;
|
||||
</setter>
|
||||
</property>
|
||||
|
||||
<method name="returnNode">
|
||||
<parameter name="aNodeA"/>
|
||||
<parameter name="aNodeB"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var node = this.parentNode;
|
||||
while (node && node.localName != "window" &&
|
||||
(node.localName != aNodeA && (node.localName != aNodeB))) {
|
||||
node = node.parentNode;
|
||||
}
|
||||
return node;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="grippyTriggered">
|
||||
<body>
|
||||
<![CDATA[
|
||||
var toolbox = this.returnNode("toolbox");
|
||||
var toolbar = this.returnNode("toolbar", "menubar");
|
||||
if (this.collapsed)
|
||||
toolbox.expandToolbar(this.id);
|
||||
else
|
||||
toolbox.collapseToolbar(toolbar);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
</implementation>
|
||||
|
||||
<handlers>
|
||||
<handler event="command">
|
||||
<![CDATA[
|
||||
this.grippyTriggered();
|
||||
]]>
|
||||
</handler>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
<binding id="toolbarseparator" extends="chrome://global/content/bindings/toolbar.xml#toolbar-base"/>
|
||||
|
||||
</bindings>
|
||||
|
Loading…
Reference in New Issue
Block a user