mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-03 12:35:58 +00:00
Bug 156459 XBL shouldn't pollute the global scope r=jan sr=jag
This commit is contained in:
parent
f713cef1fe
commit
33034e2cae
@ -227,7 +227,7 @@
|
||||
|
||||
<binding id="menu-button-base"
|
||||
extends="chrome://global/content/bindings/button.xml#button-base">
|
||||
<implementation>
|
||||
<implementation implements="nsIDOMEventListener">
|
||||
<constructor>
|
||||
this.init();
|
||||
</constructor>
|
||||
@ -239,18 +239,18 @@
|
||||
if (!btn)
|
||||
throw "XBL binding for <button type=\"menu-button\"/> binding must contain an element with anonid=\"button\"";
|
||||
|
||||
btn._menubuttonParent = this;
|
||||
var menubuttonParent = this;
|
||||
btn.addEventListener("mouseover", function() {
|
||||
if (!this.disabled)
|
||||
this._menubuttonParent.buttonover = true;
|
||||
menubuttonParent.buttonover = true;
|
||||
}, true);
|
||||
btn.addEventListener("mouseout", function() {
|
||||
this._menubuttonParent.buttonover = false;
|
||||
}, true);
|
||||
menubuttonParent.buttonover = false;
|
||||
}, true);
|
||||
btn.addEventListener("mousedown", function() {
|
||||
if (!this.disabled) {
|
||||
this._menubuttonParent.buttondown = true;
|
||||
this._menubuttonParent._captureMouseUp();
|
||||
menubuttonParent.buttondown = true;
|
||||
document.addEventListener("mouseup", menubuttonParent, true);
|
||||
}
|
||||
}, true);
|
||||
]]>
|
||||
@ -295,31 +295,13 @@
|
||||
|
||||
<field name="_pendingActive">false</field>
|
||||
|
||||
<method name="_captureMouseUp">
|
||||
<body>
|
||||
<![CDATA[
|
||||
document.__ButtonMenuMouseDown__ = this;
|
||||
document.addEventListener("mouseup", this._onGlobalMouseUp, true);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="_onGlobalMouseUp" readonly="true">
|
||||
<body>
|
||||
<![CDATA[
|
||||
var btn = document.__ButtonMenuMouseDown__;
|
||||
btn._onMouseReallyUp();
|
||||
document.removeEventListener("mouseup", btn._onGlobalMouseUp, true);
|
||||
delete document.__ButtonMenuMouseDown__;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="_onMouseReallyUp">
|
||||
<method name="handleEvent">
|
||||
<parameter name="aEvent"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
this._pendingActive = false;
|
||||
this.buttondown = false;
|
||||
document.removeEventListener("mouseup", this, true);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
@ -103,7 +103,7 @@
|
||||
-->
|
||||
</content>
|
||||
|
||||
<implementation>
|
||||
<implementation implements="nsIDOMEventListener">
|
||||
|
||||
<property name="color">
|
||||
<getter><![CDATA[
|
||||
@ -326,21 +326,8 @@
|
||||
}
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="addKeyListener">
|
||||
<body><![CDATA[
|
||||
document._focusedPicker = this;
|
||||
document.addEventListener("keydown", this.mPickerKeyDown, true);
|
||||
]]></body>
|
||||
</method>
|
||||
<method name="removeKeyListener">
|
||||
<body><![CDATA[
|
||||
document._focusedPicker = null;
|
||||
document.removeEventListener("keydown", this.mPickerKeyDown, true);
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="pickerKeyDown">
|
||||
<method name="handleEvent">
|
||||
<parameter name="aEvent"/>
|
||||
<body><![CDATA[
|
||||
switch (aEvent.keyCode) {
|
||||
@ -387,7 +374,7 @@
|
||||
<![CDATA[
|
||||
if (!mIsPopup && this.getAttribute('focused') != 'true') {
|
||||
this.setAttribute('focused','true');
|
||||
this.addKeyListener();
|
||||
document.addEventListener("keydown", this, true);
|
||||
if (this.mSelectedCell)
|
||||
this.hoverCell(this.mSelectedCell);
|
||||
}
|
||||
@ -397,7 +384,7 @@
|
||||
<handler event="blur" phase="capturing">
|
||||
<![CDATA[
|
||||
if (!mIsPopup && this.getAttribute('focused') == 'true') {
|
||||
this.removeKeyListener();
|
||||
document.removeEventListener("keydown", this, true);
|
||||
this.removeAttribute('focused');
|
||||
this.resetHover();
|
||||
}
|
||||
@ -491,7 +478,7 @@
|
||||
|
||||
if ("resetHover" in this.mPicker)
|
||||
this.mPicker.resetHover();
|
||||
this.mPicker.addKeyListener();
|
||||
document.addEventListener("keydown", this.mPicker, true);
|
||||
this.mPicker.mIsPopup = true;
|
||||
// Initialize to current button's color
|
||||
this.mPicker.initColor(this.color);
|
||||
@ -503,7 +490,7 @@
|
||||
this.mOpen = false;
|
||||
this.removeAttribute("open");
|
||||
// Removes the key listener
|
||||
this.mPicker.removeKeyListener();
|
||||
document.removeEventListener("keydown", this.mPicker, true);
|
||||
this.mPicker.mIsPopup = false;
|
||||
]]></body>
|
||||
</method>
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
<binding id="tabbox" display="xul:box"
|
||||
extends="chrome://global/content/bindings/tabbox.xml#tab-base">
|
||||
<implementation implements="nsIAccessibleProvider">
|
||||
<implementation implements="nsIDOMEventListener, nsIAccessibleProvider">
|
||||
<property name="accessible">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
@ -110,10 +110,10 @@
|
||||
</setter>
|
||||
</property>
|
||||
|
||||
<field name="_keyEventHandler" readonly="true">
|
||||
<![CDATA[({
|
||||
tabbox: this,
|
||||
handleEvent: function handleEvent(event) {
|
||||
<method name="handleEvent">
|
||||
<parameter name="event"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
if (!event.isTrusted) {
|
||||
// Don't let untrusted events mess with tabs.
|
||||
return;
|
||||
@ -124,24 +124,24 @@
|
||||
switch (event.keyCode) {
|
||||
case event.DOM_VK_TAB:
|
||||
if (event.ctrlKey && !event.altKey && !event.metaKey)
|
||||
if (this.tabbox._tabs && this.tabbox.handleCtrlTab) {
|
||||
this.tabbox._tabs.advanceSelectedTab(event.shiftKey ? -1 : 1);
|
||||
if (this._tabs && this.handleCtrlTab) {
|
||||
this._tabs.advanceSelectedTab(event.shiftKey ? -1 : 1);
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
}
|
||||
break;
|
||||
case event.DOM_VK_PAGE_UP:
|
||||
if (event.ctrlKey && !event.shiftKey && !event.altKey && !event.metaKey)
|
||||
if (this.tabbox._tabs && this.tabbox.handleCtrlPageUpDown) {
|
||||
this.tabbox._tabs.advanceSelectedTab(-1);
|
||||
if (this._tabs && this.handleCtrlPageUpDown) {
|
||||
this._tabs.advanceSelectedTab(-1);
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
}
|
||||
break;
|
||||
case event.DOM_VK_PAGE_DOWN:
|
||||
if (event.ctrlKey && !event.shiftKey && !event.altKey && !event.metaKey)
|
||||
if (this.tabbox._tabs && this.tabbox.handleCtrlPageUpDown) {
|
||||
this.tabbox._tabs.advanceSelectedTab(1);
|
||||
if (this._tabs && this.handleCtrlPageUpDown) {
|
||||
this._tabs.advanceSelectedTab(1);
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
}
|
||||
@ -167,9 +167,9 @@
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
})]]>
|
||||
</field>
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<field name="_eventNode">this</field>
|
||||
|
||||
@ -177,8 +177,8 @@
|
||||
<setter>
|
||||
<![CDATA[
|
||||
if (val != this._eventNode) {
|
||||
val.addEventListener("keypress", this._keyEventHandler, false);
|
||||
this._eventNode.removeEventListener("keypress", this._keyEventHandler, false);
|
||||
val.addEventListener("keypress", this, false);
|
||||
this._eventNode.removeEventListener("keypress", this, false);
|
||||
this._eventNode = val;
|
||||
}
|
||||
return val;
|
||||
@ -192,11 +192,11 @@
|
||||
case "window": this._eventNode = window; break;
|
||||
case "document": this._eventNode = document; break;
|
||||
}
|
||||
this._eventNode.addEventListener("keypress", this._keyEventHandler, false);
|
||||
this._eventNode.addEventListener("keypress", this, false);
|
||||
</constructor>
|
||||
|
||||
<destructor>
|
||||
this._eventNode.removeEventListener("keypress", this._keyEventHandler, false);
|
||||
this._eventNode.removeEventListener("keypress", this, false);
|
||||
</destructor>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
Loading…
x
Reference in New Issue
Block a user