From 55a509e7104660c236f634f99730fcb5a4a77fcc Mon Sep 17 00:00:00 2001 From: "hewitt%netscape.com" Date: Sat, 12 Jan 2002 01:20:29 +0000 Subject: [PATCH] 104401 - eliminate mOuter aggregate from nsXULElement, r=waterson, sr=hyatt --- content/events/src/nsEventStateManager.h | 1 - content/xul/content/src/Makefile.in | 1 - content/xul/content/src/makefile.win | 1 - content/xul/content/src/nsIXULTreeContent.h | 0 content/xul/content/src/nsXULElement.cpp | 192 ++---- content/xul/content/src/nsXULElement.h | 47 +- content/xul/content/src/nsXULTreeElement.cpp | 0 content/xul/content/src/nsXULTreeElement.h | 0 dom/macbuild/dom_xulIDL.xml | 10 +- dom/public/idl/xul/MANIFEST_IDL | 1 - dom/public/idl/xul/Makefile.in | 4 +- dom/public/idl/xul/makefile.win | 2 +- .../idl/xul/nsIDOMXULMultSelectCntrlEl.idl | 67 ++ dom/public/idl/xul/nsIDOMXULTreeElement.idl | 0 dom/public/nsIDOMClassInfo.h | 1 - dom/src/base/nsDOMClassInfo.cpp | 9 - editor/ui/composer/content/sb-bookmarks.js | 19 +- editor/ui/composer/content/sb-file-panel.js | 544 --------------- .../ui/dialogs/content/EdAECSSAttributes.js | 2 +- .../ui/dialogs/content/EdAEHTMLAttributes.js | 2 +- editor/ui/dialogs/content/EdAdvancedEdit.js | 2 +- editor/ui/dialogs/content/EdDialogCommon.js | 4 +- .../resources/content/pref-contentpacks.xul | 2 +- extensions/irc/xul/content/static.js | 9 + extensions/wallet/editor/WalletEditor.xul | 6 +- .../content/abSelectAddressesDialog.xul | 2 +- .../prefs/resources/content/SmtpServerList.js | 2 +- mailnews/base/resources/content/subscribe.xul | 2 +- .../resources/content/FilterListDialog.js | 2 +- .../resources/content/pref-formatting.xul | 4 +- .../pki/resources/content/CAOverlay.xul | 2 +- .../pki/resources/content/MineOverlay.xul | 2 +- .../pki/resources/content/OthersOverlay.xul | 2 +- .../pki/resources/content/WebSitesOverlay.xul | 2 +- .../pki/resources/content/crlManager.xul | 2 +- .../pki/resources/content/device_manager.xul | 4 +- .../resources/content/downloadmanager.xul | 2 +- .../resources/content/pref-charset.js | 8 +- .../resources/content/pref-charset.xul | 4 +- .../resources/content/pref-languages-add.xul | 2 +- .../resources/content/pref-languages.js | 4 +- .../resources/content/pref-languages.xul | 2 +- .../resources/content/pref-smart_browsing.xul | 2 +- .../search/resources/search-editor.xul | 4 +- .../components/sidebar/resources/customize.js | 6 +- .../sidebar/resources/customize.xul | 4 +- .../resources/content/bindings/tree.xml | 617 ++++++++++++++---- 47 files changed, 683 insertions(+), 924 deletions(-) delete mode 100644 content/xul/content/src/nsIXULTreeContent.h delete mode 100644 content/xul/content/src/nsXULTreeElement.cpp delete mode 100644 content/xul/content/src/nsXULTreeElement.h create mode 100644 dom/public/idl/xul/nsIDOMXULMultSelectCntrlEl.idl delete mode 100644 dom/public/idl/xul/nsIDOMXULTreeElement.idl diff --git a/content/events/src/nsEventStateManager.h b/content/events/src/nsEventStateManager.h index 402ab510d4b..9f73d51bf4d 100644 --- a/content/events/src/nsEventStateManager.h +++ b/content/events/src/nsEventStateManager.h @@ -51,7 +51,6 @@ class nsIDocument; class nsIScrollableView; class nsIPresShell; -class nsITreeFrame; class nsIFrameSelection; class nsIDocShell; class nsIDocShellTreeNode; diff --git a/content/xul/content/src/Makefile.in b/content/xul/content/src/Makefile.in index 4aab305f8dd..7dcae15f976 100644 --- a/content/xul/content/src/Makefile.in +++ b/content/xul/content/src/Makefile.in @@ -54,7 +54,6 @@ CPPSRCS = \ nsXULAttributes.cpp \ nsXULElement.cpp \ nsXULPopupListener.cpp \ - nsXULTreeElement.cpp \ $(NULL) # we don't want the shared lib, but we want to force the creation of a static lib. diff --git a/content/xul/content/src/makefile.win b/content/xul/content/src/makefile.win index ce201cf957a..e06da52ae61 100644 --- a/content/xul/content/src/makefile.win +++ b/content/xul/content/src/makefile.win @@ -51,7 +51,6 @@ CPP_OBJS= \ .\$(OBJDIR)\nsXULAttributes.obj \ .\$(OBJDIR)\nsXULElement.obj \ .\$(OBJDIR)\nsXULPopupListener.obj \ - .\$(OBJDIR)\nsXULTreeElement.obj \ $(NULL) LINCS= \ diff --git a/content/xul/content/src/nsIXULTreeContent.h b/content/xul/content/src/nsIXULTreeContent.h deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/content/xul/content/src/nsXULElement.cpp b/content/xul/content/src/nsXULElement.cpp index a7db2114a9d..9a216902264 100644 --- a/content/xul/content/src/nsXULElement.cpp +++ b/content/xul/content/src/nsXULElement.cpp @@ -77,6 +77,7 @@ #include "nsIDOMNodeList.h" #include "nsIDOMXULCommandDispatcher.h" #include "nsIDOMXULElement.h" +#include "nsIDOMXULSelectCntrlItemEl.h" #include "nsIDocument.h" #include "nsIEventListenerManager.h" #include "nsIEventStateManager.h" @@ -117,7 +118,6 @@ #include "nsXPIDLString.h" #include "nsXULAttributes.h" #include "nsXULControllers.h" -#include "nsXULTreeElement.h" #include "nsIBoxObject.h" #include "nsPIBoxObject.h" #include "nsXULDocument.h" @@ -649,8 +649,6 @@ nsXULElement::QueryInterface(REFNSIID iid, void** result) return NS_ERROR_NULL_POINTER; *result = nsnull; - nsresult rv; - if (iid.Equals(NS_GET_IID(nsIStyledContent)) || iid.Equals(NS_GET_IID(nsIContent)) || iid.Equals(NS_GET_IID(nsISupports))) { @@ -679,46 +677,13 @@ nsXULElement::QueryInterface(REFNSIID iid, void** result) else if (iid.Equals(NS_GET_IID(nsIChromeEventHandler))) { *result = NS_STATIC_CAST(nsIChromeEventHandler*, this); } - else if ((iid.Equals(NS_GET_IID(nsIDOMXULTreeElement)) || - iid.Equals(NS_GET_IID(nsIXULTreeContent))) && - (NodeInfo()->NamespaceEquals(kNameSpaceID_XUL))){ - nsCOMPtr tag; - PRInt32 dummy; - nsIXBLService *xblService = GetXBLService(); - xblService->ResolveTag(NS_STATIC_CAST(nsIStyledContent*, this), &dummy, getter_AddRefs(tag)); - if (tag == nsXULAtoms::tree) { - // We delegate XULTreeElement APIs to an aggregate object - if (! InnerXULElement()) { - rv = EnsureSlots(); - if (NS_FAILED(rv)) return rv; - - if ((mSlots->mInnerXULElement = new nsXULTreeElement(this)) == nsnull) - return NS_ERROR_OUT_OF_MEMORY; - } - - return InnerXULElement()->QueryInterface(iid, result); - } - else - return NS_NOINTERFACE; - } else if (iid.Equals(NS_GET_IID(nsIDOM3Node))) { *result = new nsNode3Tearoff(this); NS_ENSURE_TRUE(*result, NS_ERROR_OUT_OF_MEMORY); } else if (iid.Equals(NS_GET_IID(nsIClassInfo))) { - nsISupports *inst = nsnull; - - nsCOMPtr tag; - PRInt32 dummy; - nsIXBLService *xblService = GetXBLService(); - xblService->ResolveTag(NS_STATIC_CAST(nsIStyledContent*, this), &dummy, getter_AddRefs(tag)); - if (tag == nsXULAtoms::tree) { - inst = nsContentUtils:: - GetClassInfoInstance(eDOMClassInfo_XULTreeElement_id); - } else { - inst = nsContentUtils:: + nsISupports *inst = nsContentUtils:: GetClassInfoInstance(eDOMClassInfo_XULElement_id); - } NS_ENSURE_TRUE(inst, NS_ERROR_OUT_OF_MEMORY); @@ -2394,7 +2359,7 @@ nsXULElement::RemoveChildAt(PRInt32 aIndex, PRBool aNotify) // the possibility exists that some of the items in the removed subtree // are selected (and therefore need to be deselected). We need to account for this. nsCOMPtr tag; - nsCOMPtr treeElement; + nsCOMPtr controlElement; nsCOMPtr treeBox; PRBool fireSelectionHandler = PR_FALSE; @@ -2404,50 +2369,40 @@ nsXULElement::RemoveChildAt(PRInt32 aIndex, PRBool aNotify) oldKid->GetTag(*getter_AddRefs(tag)); if (tag && (tag == nsXULAtoms::treechildren || tag == nsXULAtoms::treeitem || - tag == nsXULAtoms::treecell)) { + tag == nsXULAtoms::treecell || tag == nsXULAtoms::listitem)) { // This is the nasty case. We have (potentially) a slew of selected items // and cells going away. // First, retrieve the tree. // Check first whether this element IS the tree - treeElement = do_QueryInterface((nsIDOMXULElement*)this); + controlElement = do_QueryInterface((nsIDOMXULElement*)this); // If it's not, look at our parent - if (!treeElement) - rv = GetParentTree(getter_AddRefs(treeElement)); - if (treeElement) { - nsCOMPtr itemList; - treeElement->GetSelectedItems(getter_AddRefs(itemList)); - + if (!controlElement) + rv = GetParentTree(getter_AddRefs(controlElement)); + if (controlElement) { nsCOMPtr parentKid = do_QueryInterface(oldKid); - if (itemList) { - // Iterate over all of the items and find out if they are contained inside - // the removed subtree. - PRUint32 length; - itemList->GetLength(&length); - for (PRUint32 i = 0; i < length; i++) { - nsCOMPtr node; - itemList->Item(i, getter_AddRefs(node)); - if (IsAncestor(parentKid, node)) { - nsCOMPtr content = do_QueryInterface(node); - content->UnsetAttr(kNameSpaceID_None, nsXULAtoms::selected, PR_FALSE); - nsCOMPtr tree = do_QueryInterface(treeElement); - nsCOMPtr domxulnode = do_QueryInterface(node); - if (tree && domxulnode) - tree->CheckSelection(domxulnode); - length--; - i--; - fireSelectionHandler = PR_TRUE; - } + // Iterate over all of the items and find out if they are contained inside + // the removed subtree. + PRInt32 length; + controlElement->GetSelectedCount(&length); + for (PRInt32 i = 0; i < length; i++) { + nsCOMPtr node; + controlElement->GetSelectedItem(i, getter_AddRefs(node)); + if (IsAncestor(parentKid, node)) { + controlElement->RemoveItemFromSelection(node); + length--; + i--; + fireSelectionHandler = PR_TRUE; } } - nsCOMPtr curItem; - treeElement->GetCurrentItem(getter_AddRefs(curItem)); + nsCOMPtr curItem; + controlElement->GetCurrentItem(getter_AddRefs(curItem)); nsCOMPtr curNode = do_QueryInterface(curItem); if (IsAncestor(parentKid, curNode)) { // Current item going away nsCOMPtr box; - treeElement->GetBoxObject(getter_AddRefs(box)); + controlElement->GetBoxObject(getter_AddRefs(box)); treeBox = do_QueryInterface(box); if (treeBox) { nsCOMPtr domElem = do_QueryInterface(parentKid); @@ -2471,7 +2426,7 @@ nsXULElement::RemoveChildAt(PRInt32 aIndex, PRBool aNotify) } if (newCurrentIndex == -2) - treeElement->SetCurrentItem(nsnull); + controlElement->SetCurrentItem(nsnull); else if (newCurrentIndex > -1) { // Make sure the index is still valid PRInt32 treeRows; @@ -2481,19 +2436,23 @@ nsXULElement::RemoveChildAt(PRInt32 aIndex, PRBool aNotify) nsCOMPtr newCurrentItem; treeBox->GetItemAtIndex(newCurrentIndex, getter_AddRefs(newCurrentItem)); if (newCurrentItem) { - nsCOMPtr xulCurItem = do_QueryInterface(newCurrentItem); + nsCOMPtr xulCurItem = do_QueryInterface(newCurrentItem); if (xulCurItem) - treeElement->SetCurrentItem(xulCurItem); + controlElement->SetCurrentItem(xulCurItem); } } else { - treeElement->SetCurrentItem(nsnull); + controlElement->SetCurrentItem(nsnull); } } - + if (fireSelectionHandler) { - nsCOMPtr tree = do_QueryInterface(treeElement); - if (tree) { - tree->FireOnSelectHandler(); + nsCOMPtr doc(do_QueryInterface(mDocument)); + nsCOMPtr event; + doc->CreateEvent(NS_LITERAL_STRING("Events"), getter_AddRefs(event)); + if (event) { + event->InitEvent(NS_LITERAL_STRING("select"), PR_FALSE, PR_TRUE); + PRBool noDefault; + DispatchEvent(event, &noDefault); } } @@ -2626,31 +2585,6 @@ nsXULElement::SetAttr(nsINodeInfo* aNodeInfo, // XXX Some kind of special document update might need to happen here. } - // Need to check for the SELECTED attribute - // being set. If we're a , , or , the act of - // setting these attributes forces us to update our selected arrays. - nsCOMPtr tag; - GetTag(*getter_AddRefs(tag)); - if (mDocument && aNodeInfo->NamespaceEquals(kNameSpaceID_None)) { - // See if we're a treeitem atom. - nsCOMPtr nodeList; - if (tag && (tag == nsXULAtoms::treeitem) && - aNodeInfo->Equals(nsXULAtoms::selected)) { - nsCOMPtr treeElement; - GetParentTree(getter_AddRefs(treeElement)); - if (treeElement) { - nsCOMPtr nodes; - treeElement->GetSelectedItems(getter_AddRefs(nodes)); - nodeList = do_QueryInterface(nodes); - } - } - - if (nodeList) { - // Append this node to the list. - nodeList->AppendNode(this); - } - } - // XXX need to check if they're changing an event handler: if so, then we need // to unhook the old one. @@ -2902,39 +2836,17 @@ nsXULElement::UnsetAttr(PRInt32 aNameSpaceID, // XXXwaterson if aNotify == PR_TRUE, do we want to call // nsIDocument::BeginUpdate() now? if (aNameSpaceID == kNameSpaceID_None) { - if (aName == nsXULAtoms::selected) { - // Need to check for the SELECTED attribute - // being unset. If we're a , , or , the act of - // unsetting these attributes forces us to update our selected arrays. - nsCOMPtr tag; - GetTag(*getter_AddRefs(tag)); - - // See if we're a treeitem atom. - if (tag && (tag == nsXULAtoms::treeitem)) { - nsCOMPtr treeElement; - GetParentTree(getter_AddRefs(treeElement)); - if (treeElement) { - nsCOMPtr nodes; - treeElement->GetSelectedItems(getter_AddRefs(nodes)); - nsCOMPtr nodeList(do_QueryInterface(nodes)); - if (nodeList) { - // Remove this node from the list. - nodeList->RemoveNode(this); - } - - } - } - } else if (mDocument) { - if (aName == nsXULAtoms::clazz) { - // If CLASS is being unset, delete our class list. - Attributes()->UpdateClassList(nsAutoString()); - } else if (aName == nsXULAtoms::style) { - nsCOMPtr docURL; - mDocument->GetBaseURL(*getter_AddRefs(docURL)); - Attributes()->UpdateStyleRule(docURL, nsAutoString()); - // XXX Some kind of special document update might need to happen here. - } + if (mDocument) { + if (aName == nsXULAtoms::clazz) { + // If CLASS is being unset, delete our class list. + Attributes()->UpdateClassList(nsAutoString()); + } else if (aName == nsXULAtoms::style) { + nsCOMPtr docURL; + mDocument->GetBaseURL(*getter_AddRefs(docURL)); + Attributes()->UpdateStyleRule(docURL, nsAutoString()); + // XXX Some kind of special document update might need to happen here. } + } } // XXX Know how to remove POPUP event listeners when an attribute is unset? @@ -3385,7 +3297,7 @@ nsXULElement::HandleDOMEvent(nsIPresContext* aPresContext, parent = mParent; } - if (retarget || (parent != mParent)) { + if (!retarget || (parent != mParent)) { if (!*aDOMEvent) { // We haven't made a DOMEvent yet. Force making one now. nsCOMPtr listenerManager; @@ -4402,15 +4314,15 @@ nsXULElement::GetStyle(nsIDOMCSSStyleDeclaration** aStyle) } NS_IMETHODIMP -nsXULElement::GetParentTree(nsIDOMXULTreeElement** aTreeElement) +nsXULElement::GetParentTree(nsIDOMXULMultiSelectControlElement** aTreeElement) { nsCOMPtr current; GetParent(*getter_AddRefs(current)); while (current) { nsCOMPtr tag; current->GetTag(*getter_AddRefs(tag)); - if (tag && (tag == nsXULAtoms::tree)) { - nsCOMPtr element = do_QueryInterface(current); + if (tag && (tag == nsXULAtoms::tree || tag == nsXULAtoms::listbox)) { + nsCOMPtr element = do_QueryInterface(current); *aTreeElement = element; NS_IF_ADDREF(*aTreeElement); return NS_OK; @@ -4819,8 +4731,7 @@ nsresult nsXULElement::MakeHeavyweight() nsXULElement::Slots::Slots(nsXULElement* aElement) : mAttributes(nsnull), - mLazyState(0), - mInnerXULElement(nsnull) + mLazyState(0) { MOZ_COUNT_CTOR(nsXULElement::Slots); } @@ -4831,9 +4742,6 @@ nsXULElement::Slots::~Slots() MOZ_COUNT_DTOR(nsXULElement::Slots); NS_IF_RELEASE(mAttributes); - - // Delete the aggregated interface, if one exists. - delete mInnerXULElement; } diff --git a/content/xul/content/src/nsXULElement.h b/content/xul/content/src/nsXULElement.h index cdeb94fe0a2..4502148d2f8 100644 --- a/content/xul/content/src/nsXULElement.h +++ b/content/xul/content/src/nsXULElement.h @@ -57,7 +57,7 @@ #include "nsIDOMElement.h" #include "nsIDOMEventReceiver.h" #include "nsIDOMXULElement.h" -#include "nsIDOMXULTreeElement.h" +#include "nsIDOMXULMultSelectCntrlEl.h" #include "nsIEventListenerManager.h" #include "nsINameSpace.h" #include "nsINameSpaceManager.h" @@ -309,42 +309,6 @@ public: nsString mValue; }; - -//////////////////////////////////////////////////////////////////////// - -/** - - This class serves as a base for aggregates that will implement a - per-element XUL API. - - */ - -class nsXULAggregateElement : public nsISupports -{ -protected: - nsIDOMXULElement* mOuter; - nsXULAggregateElement(nsIDOMXULElement* aOuter) : mOuter(aOuter) {} - -public: - virtual ~nsXULAggregateElement() {}; - - // nsISupports interface. Subclasses should use the - // NS_DECL/IMPL_ISUPPORTS_INHERITED macros to implement the - // nsISupports interface. - NS_IMETHOD_(nsrefcnt) AddRef() { - return mOuter->AddRef(); - } - - NS_IMETHOD_(nsrefcnt) Release() { - return mOuter->Release(); - } - - NS_IMETHOD QueryInterface(REFNSIID aIID, void** aResult) { - return mOuter->QueryInterface(aIID, aResult); - } -}; - - //////////////////////////////////////////////////////////////////////// /** @@ -528,7 +492,7 @@ protected: static PRBool IsAncestor(nsIDOMNode* aParentNode, nsIDOMNode* aChildNode); // Helper routine that crawls a parent chain looking for a tree element. - NS_IMETHOD GetParentTree(nsIDOMXULTreeElement** aTreeElement); + NS_IMETHOD GetParentTree(nsIDOMXULMultiSelectControlElement** aTreeElement); nsresult AddPopupListener(nsIAtom* aName); @@ -567,12 +531,6 @@ protected: * RDF; see nsIXULContent and nsRDFGenericBuilder. */ PRInt32 mLazyState; - - /** - * An unreferenced bare pointer to an aggregate that can - * implement element-specific APIs. - */ - nsXULAggregateElement* mInnerXULElement; }; friend struct Slots; @@ -630,7 +588,6 @@ protected: nsINodeInfo* NodeInfo() const { return mSlots ? mSlots->mNodeInfo : mPrototype->mNodeInfo; } nsIControllers* Controllers() const { return mSlots ? mSlots->mControllers.get() : nsnull; } nsXULAttributes* Attributes() const { return mSlots ? mSlots->mAttributes : nsnull; } - nsXULAggregateElement* InnerXULElement() const { return mSlots ? mSlots->mInnerXULElement : nsnull; } static nsIXBLService *gXBLService; }; diff --git a/content/xul/content/src/nsXULTreeElement.cpp b/content/xul/content/src/nsXULTreeElement.cpp deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/content/xul/content/src/nsXULTreeElement.h b/content/xul/content/src/nsXULTreeElement.h deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/dom/macbuild/dom_xulIDL.xml b/dom/macbuild/dom_xulIDL.xml index 70726aedf5e..0f651ca53f7 100644 --- a/dom/macbuild/dom_xulIDL.xml +++ b/dom/macbuild/dom_xulIDL.xml @@ -733,7 +733,7 @@ Name - nsIDOMXULTreeElement.idl + nsIDOMXULMultSelectCntrlEl.idl MacOS Text @@ -834,7 +834,7 @@ Name - nsIDOMXULTreeElement.idl + nsIDOMXULMultSelectCntrlEl.idl MacOS @@ -1574,7 +1574,7 @@ Name - nsIDOMXULTreeElement.idl + nsIDOMXULMultSelectCntrlEl.idl MacOS Text @@ -1675,7 +1675,7 @@ Name - nsIDOMXULTreeElement.idl + nsIDOMXULMultSelectCntrlEl.idl MacOS @@ -1764,7 +1764,7 @@ headers Name - nsIDOMXULTreeElement.idl + nsIDOMXULMultSelectCntrlEl.idl MacOS diff --git a/dom/public/idl/xul/MANIFEST_IDL b/dom/public/idl/xul/MANIFEST_IDL index 5f8d104c229..89b917e2fc1 100644 --- a/dom/public/idl/xul/MANIFEST_IDL +++ b/dom/public/idl/xul/MANIFEST_IDL @@ -1,4 +1,3 @@ nsIDOMXULCommandDispatcher.idl nsIDOMXULDocument.idl nsIDOMXULElement.idl -nsIDOMXULTreeElement.idl diff --git a/dom/public/idl/xul/Makefile.in b/dom/public/idl/xul/Makefile.in index 6482b0b6468..c57f4a788b3 100644 --- a/dom/public/idl/xul/Makefile.in +++ b/dom/public/idl/xul/Makefile.in @@ -40,11 +40,11 @@ XPIDLSRCS = \ nsIDOMXULImageElement.idl \ nsIDOMXULLabelElement.idl \ nsIDOMXULLabeledControlEl.idl \ - nsIDOMXULMenuListElement.idl \ + nsIDOMXULMenuListElement.idl \ nsIDOMXULPopupElement.idl \ nsIDOMXULSelectCntrlEl.idl \ nsIDOMXULSelectCntrlItemEl.idl \ - nsIDOMXULTreeElement.idl \ + nsIDOMXULMultSelectCntrlEl.idl \ $(NULL) include $(topsrcdir)/config/rules.mk diff --git a/dom/public/idl/xul/makefile.win b/dom/public/idl/xul/makefile.win index 8dd85246bf2..1beb2253fa8 100644 --- a/dom/public/idl/xul/makefile.win +++ b/dom/public/idl/xul/makefile.win @@ -40,7 +40,7 @@ XPIDLSRCS = \ .\nsIDOMXULPopupElement.idl \ .\nsIDOMXULSelectCntrlEl.idl \ .\nsIDOMXULSelectCntrlItemEl.idl \ - .\nsIDOMXULTreeElement.idl \ + .\nsIDOMXULMultSelectCntrlEl.idl \ $(NULL) include <$(DEPTH)\config\rules.mak> diff --git a/dom/public/idl/xul/nsIDOMXULMultSelectCntrlEl.idl b/dom/public/idl/xul/nsIDOMXULMultSelectCntrlEl.idl new file mode 100644 index 00000000000..0094afb5105 --- /dev/null +++ b/dom/public/idl/xul/nsIDOMXULMultSelectCntrlEl.idl @@ -0,0 +1,67 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: NPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Netscape Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 2000 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * David Hyatt (original author) + * Joe Hewitt + * + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the NPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the NPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include "nsIDOMXULSelectCntrlEl.idl" + +[scriptable, uuid(7F435623-BA16-4c44-B4B0-0990946D3D7C)] +interface nsIDOMXULMultiSelectControlElement : nsIDOMXULSelectControlElement +{ + attribute DOMString selType; + + attribute nsIDOMXULSelectControlItemElement currentItem; + + readonly attribute nsIDOMNodeList selectedItems; + + void addItemToSelection(in nsIDOMXULSelectControlItemElement item); + void removeItemFromSelection(in nsIDOMXULSelectControlItemElement item); + void toggleItemSelection(in nsIDOMXULSelectControlItemElement item); + + void selectItem(in nsIDOMXULSelectControlItemElement item); + void selectItemRange(in nsIDOMXULSelectControlItemElement startItem, in nsIDOMXULSelectControlItemElement item); + + void selectAll(); + void invertSelection(); + void clearSelection(); + + // XXX - temporary, pending implementation of scriptable, + // mutable nsIDOMNodeList for selectedItems + readonly attribute long selectedCount; + nsIDOMXULSelectControlItemElement getSelectedItem(in long index); +}; diff --git a/dom/public/idl/xul/nsIDOMXULTreeElement.idl b/dom/public/idl/xul/nsIDOMXULTreeElement.idl deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/dom/public/nsIDOMClassInfo.h b/dom/public/nsIDOMClassInfo.h index 751682eff9f..266f759c20f 100644 --- a/dom/public/nsIDOMClassInfo.h +++ b/dom/public/nsIDOMClassInfo.h @@ -172,7 +172,6 @@ enum nsDOMClassInfoID { // XUL classes eDOMClassInfo_XULDocument_id, eDOMClassInfo_XULElement_id, - eDOMClassInfo_XULTreeElement_id, eDOMClassInfo_XULCommandDispatcher_id, eDOMClassInfo_XULNodeList_id, eDOMClassInfo_XULNamedNodeMap_id, diff --git a/dom/src/base/nsDOMClassInfo.cpp b/dom/src/base/nsDOMClassInfo.cpp index 0315b52ce1c..c9e86e5a645 100644 --- a/dom/src/base/nsDOMClassInfo.cpp +++ b/dom/src/base/nsDOMClassInfo.cpp @@ -253,7 +253,6 @@ #include "nsIDOMTreeWalker.h" #include "nsIDOMXULDocument.h" #include "nsIDOMXULElement.h" -#include "nsIDOMXULTreeElement.h" #include "nsIDOMXULCommandDispatcher.h" #include "nsIDOMCrypto.h" #include "nsIDOMCRMFObject.h" @@ -659,8 +658,6 @@ static nsDOMClassInfoData sClassInfoData[] = { nsIXPCScriptable::WANT_ENUMERATE) NS_DEFINE_CLASSINFO_DATA(XULElement, nsElementSH, ELEMENT_SCRIPTABLE_FLAGS) - NS_DEFINE_CLASSINFO_DATA(XULTreeElement, nsElementSH, - ELEMENT_SCRIPTABLE_FLAGS) NS_DEFINE_CLASSINFO_DATA(XULCommandDispatcher, nsDOMGenericSH, DOM_DEFAULT_SCRIPTABLE_FLAGS) NS_DEFINE_CLASSINFO_DATA_WITH_NAME(XULNodeList, NodeList, nsArraySH, @@ -1709,12 +1706,6 @@ nsDOMClassInfo::Init() DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget) DOM_CLASSINFO_MAP_END - DOM_CLASSINFO_MAP_BEGIN(XULTreeElement, nsIDOMXULTreeElement) - DOM_CLASSINFO_MAP_ENTRY(nsIDOMXULElement) - DOM_CLASSINFO_MAP_ENTRY(nsIDOMXULTreeElement) - DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget) - DOM_CLASSINFO_MAP_END - DOM_CLASSINFO_MAP_BEGIN(XULCommandDispatcher, nsIDOMXULCommandDispatcher) DOM_CLASSINFO_MAP_ENTRY(nsIDOMXULCommandDispatcher) DOM_CLASSINFO_MAP_END diff --git a/editor/ui/composer/content/sb-bookmarks.js b/editor/ui/composer/content/sb-bookmarks.js index 1a037edc7df..0d725858547 100644 --- a/editor/ui/composer/content/sb-bookmarks.js +++ b/editor/ui/composer/content/sb-bookmarks.js @@ -29,7 +29,7 @@ function BookmarkProperties() { var tree = document.getElementById('bookmarksTree'); - var select_list = tree.getElementsByAttribute("selected", "true"); + var select_list = tree.selectedItems; if (select_list.length >= 1) { @@ -172,17 +172,8 @@ function OpenEditNode() saveNode = gEditNode; // unselect all nodes! - var select_list = document.getElementsByAttribute("selected", "true"); - dump("# of Nodes selected: " + select_list.length + "\n\n"); - for (var nodeIndex=0; nodeIndex= 1) { - // don't bother showing properties on bookmark separators - var type = tree.selectedItems[0].getAttribute('type'); - if (type != "http://home.netscape.com/NC-rdf#BookmarkSeparator") { - var props = window.open("chrome://communicator/content/bookmarks/bm-props.xul", - "BookmarkProperties", "chrome,menubar,resizable"); - props.BookmarkURL = tree.selectedItems[0].getAttribute("id"); - } - } else { - dump("nothing selected!\n"); - } -} - -function OpenSearch(tabName) -{ - window.openDialog("resource:/res/samples/search.xul", "SearchWindow", "dialog=no,close,chrome,resizable", tabName); -} - -function OpenURL(event, node) -{ - // clear any single-click/edit timeouts - if (timerID != null) - { - gEditNode = null; - clearTimeout(timerID); - timerID = null; - } - - if (node.getAttribute('container') == "true") - { - return(false); - } - - var url = node.getAttribute('id'); - - // Ignore "NC:" urls. - if (url.substring(0, 3) == "NC:") - { - return(false); - } - - try - { - // add support for IE favorites under Win32, and NetPositive URLs under BeOS - if (url.indexOf("file://") == 0) - { - var rdf = Components.classes["@mozilla.org/rdf/rdf-service;1"].getService(); - if (rdf) rdf = rdf.QueryInterface(Components.interfaces.nsIRDFService); - if (rdf) - { - var fileSys = rdf.GetDataSource("rdf:files"); - if (fileSys) - { - var src = rdf.GetResource(url, true); - var prop = rdf.GetResource("http://home.netscape.com/NC-rdf#URL", true); - var target = fileSys.GetTarget(src, prop, true); - if (target) target = target.QueryInterface(Components.interfaces.nsIRDFLiteral); - if (target) target = target.Value; - if (target) url = target; - - } - } - } - } - catch(ex) - { - } - - if(top.isEditor != undefined) { - if(top.editorShell) { - var ext = getFileExtension(url); - // look at the extension of the file to see what should be done - // with it. Note that this is a typically windowsey approach. will - // rdf:files hold a reference to the actual file type? (Mac?) - switch(ext) { - // XXX Crude, but it will do for now. - case "gif": - case "jpeg": - case "jpg": - case "png": - // just insert the image - EditorAutoInsertImage(url); - break; - case "htm": - case "html": - case "xul": - toEditor(url); - break; - case "js": - EditorInsertJSFile(url); - break; - case "css": - EditorInsertCSSFile(url); - break; - default: - // load the file in the editor - dump("Editor Message: Weirdo File Format\n"); - toEditor(url); - break; - } - } - } else { - window.open(url,'bookmarks'); - } - - dump("OpenURL(" + url + ")\n"); - - return(true); -} - -// returns the extension of a specified file URL -function getFileExtension(url) -{ - return url.substring(url.lastIndexOf(".")+1,url.length).toLowerCase(); -} - -var htmlInput = null; -var saveNode = null; -var newValue = ""; -var timerID = null; -var gEditNode = null; - -function DoSingleClick(event, node) -{ - var type = node.parentNode.parentNode.getAttribute('type'); - var selected = node.parentNode.parentNode.getAttribute('selected'); - - if (gEditNode == node) { - // Only start an inline edit if it is the second consecutive click - // on the same node that is not already editing or a separator. - if (!htmlInput && - type != "http://home.netscape.com/NC-rdf#BookmarkSeparator") { - // Edit node if we don't get a double-click in less than 1/2 second - timerID = setTimeout("OpenEditNode()", 500); - } - } else { - if (htmlInput) { - // Clicked during an edit - // Save the changes and move on - CloseEditNode(true); - } - gEditNode = node; - } - return false; -} - -function OpenEditNode() -{ - dump("OpenEditNode entered.\n"); - - // clear any single-click/edit timeouts - if (timerID != null) - { - clearTimeout(timerID); - timerID = null; - } - - // XXX uncomment the following line to replace the whole input row we do this - // (and, therefore, only allow editing on the name column) until we can - // arbitrarily change the content model (bugs prevent this at the moment) - gEditNode = gEditNode.parentNode; - - var name = gEditNode.parentNode.getAttribute("Name"); - dump("Single click on '" + name + "'\n"); - - var theParent = gEditNode.parentNode; - dump("Parent node is a " + theParent.nodeName + "\n\n"); - - saveNode = gEditNode; - - // unselect all nodes! - var select_list = document.getElementsByAttribute("selected", "true"); - dump("# of Nodes selected: " + select_list.length + "\n\n"); - for (var nodeIndex=0; nodeIndex child if (tree.firstChild) { @@ -462,7 +462,7 @@ function RemoveSelectedTreelistItem(tree) var treeItem = tree.selectedItems[0]; if (treeItem) { - tree.clearItemSelection(); + tree.cleaclearSelection var parent = treeItem.parentNode; if (parent) { diff --git a/extensions/content-packs/resources/content/pref-contentpacks.xul b/extensions/content-packs/resources/content/pref-contentpacks.xul index 43759d169ff..71526290bed 100644 --- a/extensions/content-packs/resources/content/pref-contentpacks.xul +++ b/extensions/content-packs/resources/content/pref-contentpacks.xul @@ -125,7 +125,7 @@ sortResource="http://www.mozilla.org/rdf/chrome#name" preftype="localizedstring" prefstring="general.useragent.contentlocale" prefvalue="" prefattribute="prefvalue" wsm_attributes="prefvalue" - multiple="false" onselect="SelectContentPack();" + seltype="false" onselect="SelectContentPack();" sortDirection="ascending"> diff --git a/extensions/irc/xul/content/static.js b/extensions/irc/xul/content/static.js index 0e4047c28fc..e937ece9a7a 100644 --- a/extensions/irc/xul/content/static.js +++ b/extensions/irc/xul/content/static.js @@ -1663,9 +1663,18 @@ function setCurrentObject (obj) /* Unselect currently selected users. */ userList = document.getElementById("user-list"); +<<<<<<< static.js + if (userList) + /* Remove curently selection items before this tree gets rerooted, + * because it seems to remember the selections for eternity if not. */ + userList.clearSelection (); + else + dd ("setCurrentObject: could not find element with ID='user-list'"); +======= /* Remove curently selection items before this tree gets rerooted, * because it seems to remember the selections for eternity if not. */ userList.clearItemSelection (); +>>>>>>> 1.31 if (obj.TYPE == "IRCChannel") client.rdf.setTreeRoot ("user-list", obj.getGraphResource()); diff --git a/extensions/wallet/editor/WalletEditor.xul b/extensions/wallet/editor/WalletEditor.xul index 5aae1c4716c..0b51e41b56e 100644 --- a/extensions/wallet/editor/WalletEditor.xul +++ b/extensions/wallet/editor/WalletEditor.xul @@ -45,7 +45,7 @@