Bug 688531 - Remove NameList; r=jst

This commit is contained in:
Ms2ger 2011-10-01 18:14:40 +02:00
parent 1329413242
commit cc09584cbb
8 changed files with 2 additions and 185 deletions

View File

@ -38,8 +38,7 @@
* ***** END LICENSE BLOCK ***** */
/*
* Implementations of nsIDOMDOMStringList and nsIDOMNameList, used by various
* DOM3 stuff and some interfaces specified by WHATWG.
* Implementation of nsIDOMDOMStringList, used by various DOM stuff.
*/
#include "nsDOMLists.h"
@ -95,92 +94,3 @@ nsDOMStringList::Contains(const nsAString& aString, bool *aResult)
return NS_OK;
}
nsNameList::nsNameList()
{
}
nsNameList::~nsNameList()
{
}
DOMCI_DATA(NameList, nsNameList)
NS_IMPL_ADDREF(nsNameList)
NS_IMPL_RELEASE(nsNameList)
NS_INTERFACE_TABLE_HEAD(nsNameList)
NS_OFFSET_AND_INTERFACE_TABLE_BEGIN(nsNameList)
NS_INTERFACE_TABLE_ENTRY(nsNameList, nsIDOMNameList)
NS_OFFSET_AND_INTERFACE_TABLE_END
NS_OFFSET_AND_INTERFACE_TABLE_TO_MAP_SEGUE
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(NameList)
NS_INTERFACE_MAP_END
NS_IMETHODIMP
nsNameList::GetName(PRUint32 aIndex, nsAString& aResult)
{
if (aIndex >= mNames.Length()) {
SetDOMStringToNull(aResult);
} else {
aResult = mNames[aIndex];
}
return NS_OK;
}
NS_IMETHODIMP
nsNameList::GetNamespaceURI(PRUint32 aIndex, nsAString& aResult)
{
if (aIndex >= mNames.Length()) {
SetDOMStringToNull(aResult);
} else {
aResult = mNamespaceURIs[aIndex];
}
return NS_OK;
}
NS_IMETHODIMP
nsNameList::GetLength(PRUint32 *aLength)
{
*aLength = mNames.Length();
return NS_OK;
}
bool
nsNameList::Add(const nsAString& aNamespaceURI, const nsAString& aName)
{
PRUint32 count = mNamespaceURIs.Length();
if (mNamespaceURIs.InsertElementAt(count, aNamespaceURI)) {
if (mNames.InsertElementAt(count, aName)) {
return PR_TRUE;
}
mNamespaceURIs.RemoveElementAt(count);
}
return PR_FALSE;
}
NS_IMETHODIMP
nsNameList::Contains(const nsAString& aName, bool *aResult)
{
*aResult = mNames.Contains(aName);
return NS_OK;
}
NS_IMETHODIMP
nsNameList::ContainsNS(const nsAString& aNamespaceURI, const nsAString& aName,
bool *aResult)
{
PRUint32 index = mNames.IndexOf(aName);
if (index != mNames.NoIndex) {
*aResult = mNamespaceURIs[index].Equals(aNamespaceURI);
}
else {
*aResult = PR_FALSE;
}
return NS_OK;
}

View File

@ -38,15 +38,13 @@
* ***** END LICENSE BLOCK ***** */
/*
* Implementations of nsIDOMDOMStringList and nsIDOMNameList, used by various
* DOM3 stuff and some interfaces specified by WHATWG.
* Implementation of nsIDOMDOMStringList, used by various DOM stuff.
*/
#ifndef nsDOMLists_h___
#define nsDOMLists_h___
#include "nsIDOMDOMStringList.h"
#include "nsIDOMNameList.h"
#include "nsTArray.h"
#include "nsString.h"
@ -68,20 +66,4 @@ private:
nsTArray<nsString> mNames;
};
class nsNameList : public nsIDOMNameList
{
public:
nsNameList();
virtual ~nsNameList();
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMNAMELIST
bool Add(const nsAString& aNamespaceURI, const nsAString& aName);
private:
nsTArray<nsString> mNamespaceURIs;
nsTArray<nsString> mNames;
};
#endif /* nsDOMLists_h___ */

View File

@ -139,7 +139,6 @@
#include "nsIDOMDOMStringList.h"
#include "nsIDOMDOMTokenList.h"
#include "nsIDOMDOMSettableTokenList.h"
#include "nsIDOMNameList.h"
#include "nsIDOMNSElement.h"
#include "nsDOMStringMap.h"
@ -1000,9 +999,6 @@ static nsDOMClassInfoData sClassInfoData[] = {
NS_DEFINE_CLASSINFO_DATA(DOMStringList, nsStringListSH,
ARRAY_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(NameList, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
#ifdef MOZ_XUL
NS_DEFINE_CLASSINFO_DATA(TreeColumn, nsDOMGenericSH,
DEFAULT_SCRIPTABLE_FLAGS)
@ -2996,10 +2992,6 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDOMStringList)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(NameList, nsIDOMNameList)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNameList)
DOM_CLASSINFO_MAP_END
#ifdef MOZ_XUL
DOM_CLASSINFO_MAP_BEGIN(TreeColumn, nsITreeColumn)
DOM_CLASSINFO_MAP_ENTRY(nsITreeColumn)

View File

@ -220,9 +220,6 @@ DOMCI_CLASS(XULTreeBuilder)
// DOMStringList object
DOMCI_CLASS(DOMStringList)
// NameList object used by the DOM
DOMCI_CLASS(NameList)
#ifdef MOZ_XUL
DOMCI_CLASS(TreeColumn)
DOMCI_CLASS(TreeColumns)

View File

@ -60,7 +60,6 @@ interface nsIDOMProcessingInstruction;
interface nsIDOMText;
interface nsIDOMDOMStringList;
interface nsIDOMDOMTokenList;
interface nsIDOMNameList;
interface nsIDOMClientRect;
interface nsIDOMClientRectList;

View File

@ -66,7 +66,6 @@ SDK_XPIDLSRCS = \
$(NULL)
XPIDLSRCS = \
nsIDOMDOMStringList.idl \
nsIDOMNameList.idl \
nsIDOMXMLDocument.idl \
nsIDOMUserDataHandler.idl \
nsIDOMNSEditableElement.idl \

View File

@ -1,57 +0,0 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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) 2003
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Peter Van der Beken <peterv@netscape.com>
*
*
* 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 MPL, 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 MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/**
* Corresponds to http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407
*/
#include "domstubs.idl"
[scriptable, uuid(faaf1b80-1ddd-11d9-8c46-000a95dc234c)]
interface nsIDOMNameList : nsISupports
{
DOMString getName(in unsigned long index)
raises(DOMException);
DOMString getNamespaceURI(in unsigned long index)
raises(DOMException);
readonly attribute unsigned long length;
boolean contains(in DOMString str);
boolean containsNS(in DOMString namespaceURI,
in DOMString name);
};

View File

@ -148,11 +148,6 @@ members = [
'nsIDOMDOMStringList.*',
'nsIDOMDOMTokenList.*',
'nsIDOMDOMSettableTokenList.*',
'nsIDOMNameList.getName',
'nsIDOMNameList.contains',
'nsIDOMNameList.containsNS',
'nsIDOMNameList.length',
'nsIDOMNameList.getNamespaceURI',
'nsIDOMXULDocument.getBoxObjectFor',
'nsIDOMNSElement.*',