From 3f0c50d813e5eb0335d4db69739bda8b41303a17 Mon Sep 17 00:00:00 2001 From: "jaggernaut%netscape.com" Date: Fri, 10 Aug 2001 01:32:12 +0000 Subject: [PATCH] Bug 94458: change dynamically registered listeners to "create" and "destroy" events to listen to "popupshowing" and "popuphiding". r=bryner, sr=hyatt --- .../src/html/nsHTMLSelectAccessible.cpp | 4 +- accessible/src/nsHTMLComboboxAccessible.cpp | 6 +- accessible/src/nsHTMLSelectAccessible.cpp | 4 +- content/xbl/builtin/selectBindings.xml | 413 ------------------ .../content/cookieContextOverlay.xul | 2 +- .../resources/content/browserOverlay.xul | 2 +- .../content/search/inSearchService.js | 5 +- .../resources/content/navWidgetBindings.xml | 2 +- .../resources/content/viewZoomOverlay.js | 2 +- .../content/imageContextOverlay.xul | 2 +- .../resources/content/bindings/menulist.xml | 6 +- .../resources/content/bindings/popup.xml | 2 +- 12 files changed, 18 insertions(+), 432 deletions(-) diff --git a/accessible/src/html/nsHTMLSelectAccessible.cpp b/accessible/src/html/nsHTMLSelectAccessible.cpp index 01893391371..5c56fcd3207 100644 --- a/accessible/src/html/nsHTMLSelectAccessible.cpp +++ b/accessible/src/html/nsHTMLSelectAccessible.cpp @@ -346,7 +346,7 @@ nsMenuListenerAccessible::~nsMenuListenerAccessible() if (mRegistered) { nsCOMPtr eventReceiver(do_QueryInterface(mDOMNode)); if (eventReceiver) - eventReceiver->RemoveEventListener(NS_LITERAL_STRING("create"), this, PR_TRUE); + eventReceiver->RemoveEventListener(NS_LITERAL_STRING("popupshowing"), this, PR_TRUE); } } @@ -388,7 +388,7 @@ nsMenuListenerAccessible::SetupMenuListener() return; } - nsresult rv = eventReceiver->AddEventListener(NS_LITERAL_STRING("create"), this, PR_TRUE); + nsresult rv = eventReceiver->AddEventListener(NS_LITERAL_STRING("popupshowing"), this, PR_TRUE); if (NS_FAILED(rv)) { return; diff --git a/accessible/src/nsHTMLComboboxAccessible.cpp b/accessible/src/nsHTMLComboboxAccessible.cpp index 4fd43767f75..1a54015c138 100644 --- a/accessible/src/nsHTMLComboboxAccessible.cpp +++ b/accessible/src/nsHTMLComboboxAccessible.cpp @@ -55,7 +55,7 @@ nsHTMLComboboxAccessible::~nsHTMLComboboxAccessible() if (mRegistered) { nsCOMPtr eventReceiver(do_QueryInterface(mDOMNode)); if (eventReceiver) - eventReceiver->RemoveEventListener(NS_LITERAL_STRING("create"), this, PR_TRUE); + eventReceiver->RemoveEventListener(NS_LITERAL_STRING("popupshowing"), this, PR_TRUE); } } @@ -194,7 +194,7 @@ NS_IMETHODIMP nsHTMLComboboxAccessible::Close(nsIDOMEvent* aEvent) /** * If we aren't already registered, register ourselves as a - * listener to "create" events on our DOM node. Set our + * listener to "popupshowing" events on our DOM node. Set our * state to registered, but don't notify MSAA as they * don't need to know about this state. */ @@ -204,7 +204,7 @@ nsHTMLComboboxAccessible::SetupMenuListener() // if not already registered as a popup listener, register ourself if (!mRegistered) { nsCOMPtr eventReceiver(do_QueryInterface(mDOMNode)); - if (eventReceiver && NS_SUCCEEDED(eventReceiver->AddEventListener(NS_LITERAL_STRING("create"), this, PR_TRUE))) + if (eventReceiver && NS_SUCCEEDED(eventReceiver->AddEventListener(NS_LITERAL_STRING("popupshowing"), this, PR_TRUE))) mRegistered = PR_TRUE; } } diff --git a/accessible/src/nsHTMLSelectAccessible.cpp b/accessible/src/nsHTMLSelectAccessible.cpp index 01893391371..5c56fcd3207 100644 --- a/accessible/src/nsHTMLSelectAccessible.cpp +++ b/accessible/src/nsHTMLSelectAccessible.cpp @@ -346,7 +346,7 @@ nsMenuListenerAccessible::~nsMenuListenerAccessible() if (mRegistered) { nsCOMPtr eventReceiver(do_QueryInterface(mDOMNode)); if (eventReceiver) - eventReceiver->RemoveEventListener(NS_LITERAL_STRING("create"), this, PR_TRUE); + eventReceiver->RemoveEventListener(NS_LITERAL_STRING("popupshowing"), this, PR_TRUE); } } @@ -388,7 +388,7 @@ nsMenuListenerAccessible::SetupMenuListener() return; } - nsresult rv = eventReceiver->AddEventListener(NS_LITERAL_STRING("create"), this, PR_TRUE); + nsresult rv = eventReceiver->AddEventListener(NS_LITERAL_STRING("popupshowing"), this, PR_TRUE); if (NS_FAILED(rv)) { return; diff --git a/content/xbl/builtin/selectBindings.xml b/content/xbl/builtin/selectBindings.xml index 6ef274ef191..e69de29bb2d 100644 --- a/content/xbl/builtin/selectBindings.xml +++ b/content/xbl/builtin/selectBindings.xml @@ -1,413 +0,0 @@ - - - - - - - - - var size = this.getAttribute("size") - return !size ? 1 : size; - - - this.setAttribute("size", val); - return val; - - - - [] - - - - - - - - - - - - - - - - - - - - - - = 0 && this.hasChildNodes() && this.childNodes[val]) { - this.childNodes[val].setAttribute("selected", "true"); - this._selectArray.push(this.childNodes[val]); - } - - return val; - ]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - return this.hasAttribute("disabled"); - - - if (val == "true") this.setAttribute("disabled", "true"); - else this.removeAttribute("disabled"); - return val; - - - - - - - - = 0 && this.hasChildNodes() && this.childNodes[val]) { - this.childNodes[val].setAttribute("selected", "true"); - this._selectArray.push(this.childNodes[val]); - - var textDisplayNode = this.getElementByAttribute("selectattr", "text"); - if (textDisplayNode) { - var text = this.childNodes[val].text; - text = text.replace(/\n/g, ""); - textDisplayNode.setAttribute("value", text); - } - } - - return val; - ]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - false - - - - - - - - - - - - - - - - return this.hasAttribute("disabled"); - - - if (val) this.setAttribute("disabled", "true"); - else this.removeAttribute("disabled"); - - - - - - return this.getAttribute("label"); - - - this.setAttribute("label", val); - return val; - - - - - - return this.hasAttribute("selected"); - - - var parent = this.parentNode; - if (parent) - parent.selectedIndex = this.index; - return val; - - - - - - return this.getAttribute("value"); - - - this.setAttribute("value", val); - return val; - - - - - - - - - - - diff --git a/extensions/cookie/resources/content/cookieContextOverlay.xul b/extensions/cookie/resources/content/cookieContextOverlay.xul index f12b6e19081..3d31483dd4d 100644 --- a/extensions/cookie/resources/content/cookieContextOverlay.xul +++ b/extensions/cookie/resources/content/cookieContextOverlay.xul @@ -99,7 +99,7 @@ addContextMenuItemListeners : function (aEvent) { var contextPopup = document.getElementById("contentAreaContextSet"); - contextPopup.addEventListener("create", cookieContextMenu.initImageBlocking, false); + contextPopup.addEventListener("popupshowing", cookieContextMenu.initImageBlocking, false); } } diff --git a/extensions/inspector/resources/content/browserOverlay.xul b/extensions/inspector/resources/content/browserOverlay.xul index f9385b3aef0..91cbbc580fd 100644 --- a/extensions/inspector/resources/content/browserOverlay.xul +++ b/extensions/inspector/resources/content/browserOverlay.xul @@ -19,7 +19,7 @@ document.getElementById("menu_inspectPage").setAttribute("hidden", "true"); } else { var popup = document.getElementById("contentAreaContextMenu"); - popup.addEventListener("create", inspectorContextCreate, false); + popup.addEventListener("popupshowing", inspectorContextCreate, false); } } diff --git a/extensions/inspector/resources/content/search/inSearchService.js b/extensions/inspector/resources/content/search/inSearchService.js index fa730cf853c..90db2aa250f 100644 --- a/extensions/inspector/resources/content/search/inSearchService.js +++ b/extensions/inspector/resources/content/search/inSearchService.js @@ -238,7 +238,7 @@ inSearchService.prototype = var mod = this.mCurrentModule; if (mod) { var menu = this.mContextMenu; - menu.addEventListener("create", inSearchService_onCreatePopup, true); + menu.addEventListener("popupshowing", inSearchService_onCreatePopup, true); mod.installContextMenu(menu, this.mCMInsertPt, this.mCMInsert); } }, @@ -249,7 +249,7 @@ inSearchService.prototype = if (mod) { // remove the createion listener var menu = this.mContextMenu; - menu.removeEventListener("create", inSearchService_onCreatePopup, true); + menu.removeEventListener("popupshowing", inSearchService_onCreatePopup, true); mod.uninstallContextMenu(menu, this.mCMInsertPt, this.mCMInsert); } }, @@ -400,4 +400,3 @@ inSearchServiceLoadObserver.prototype = { }, */ - \ No newline at end of file diff --git a/xpfe/browser/resources/content/navWidgetBindings.xml b/xpfe/browser/resources/content/navWidgetBindings.xml index 96fecb5b093..dc5df221bb6 100644 --- a/xpfe/browser/resources/content/navWidgetBindings.xml +++ b/xpfe/browser/resources/content/navWidgetBindings.xml @@ -94,7 +94,7 @@ - + - + - + - \ No newline at end of file + diff --git a/xpfe/global/resources/content/bindings/popup.xml b/xpfe/global/resources/content/bindings/popup.xml index e0c2148b930..7c4c67044b2 100644 --- a/xpfe/global/resources/content/bindings/popup.xml +++ b/xpfe/global/resources/content/bindings/popup.xml @@ -492,7 +492,7 @@ ]]> - +