2008-09-10 20:15:29 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 04:12:37 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2008-09-10 20:15:29 -07:00
|
|
|
|
|
|
|
#ifndef nsINodeList_h___
|
|
|
|
#define nsINodeList_h___
|
|
|
|
|
2009-01-02 09:00:18 -08:00
|
|
|
#include "nsIDOMNodeList.h"
|
2009-06-15 23:32:10 -07:00
|
|
|
#include "nsWrapperCache.h"
|
2014-08-19 19:32:25 -07:00
|
|
|
#include "nsIContent.h"
|
2008-09-10 20:15:29 -07:00
|
|
|
|
|
|
|
// IID for the nsINodeList interface
|
|
|
|
#define NS_INODELIST_IID \
|
2012-10-13 05:50:24 -07:00
|
|
|
{ 0xadb5e54c, 0x6e96, 0x4102, \
|
|
|
|
{ 0x8d, 0x40, 0xe0, 0x12, 0x3d, 0xcf, 0x48, 0x7a } }
|
2008-09-10 20:15:29 -07:00
|
|
|
|
|
|
|
/**
|
2011-08-20 06:53:33 -07:00
|
|
|
* An internal interface for a reasonably fast indexOf.
|
2008-09-10 20:15:29 -07:00
|
|
|
*/
|
2009-06-15 23:32:10 -07:00
|
|
|
class nsINodeList : public nsIDOMNodeList,
|
|
|
|
public nsWrapperCache
|
2008-10-22 07:31:14 -07:00
|
|
|
{
|
2008-09-10 20:15:29 -07:00
|
|
|
public:
|
|
|
|
NS_DECLARE_STATIC_IID_ACCESSOR(NS_INODELIST_IID)
|
|
|
|
|
2009-01-29 11:46:18 -08:00
|
|
|
/**
|
|
|
|
* Get the index of the given node in the list. Will return -1 if the node
|
|
|
|
* is not in the list.
|
|
|
|
*/
|
2012-08-22 08:56:38 -07:00
|
|
|
virtual int32_t IndexOf(nsIContent* aContent) = 0;
|
2009-06-15 23:32:10 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the root node for this nodelist.
|
|
|
|
*/
|
|
|
|
virtual nsINode* GetParentObject() = 0;
|
2012-09-05 13:49:53 -07:00
|
|
|
|
|
|
|
using nsIDOMNodeList::Item;
|
|
|
|
|
|
|
|
uint32_t Length()
|
|
|
|
{
|
|
|
|
uint32_t length;
|
|
|
|
GetLength(&length);
|
|
|
|
return length;
|
|
|
|
}
|
2012-10-13 05:50:24 -07:00
|
|
|
virtual nsIContent* Item(uint32_t aIndex) = 0;
|
2012-09-05 13:49:53 -07:00
|
|
|
nsIContent* IndexedGetter(uint32_t aIndex, bool& aFound)
|
|
|
|
{
|
|
|
|
nsIContent* item = Item(aIndex);
|
|
|
|
aFound = !!item;
|
|
|
|
return item;
|
|
|
|
}
|
2008-09-10 20:15:29 -07:00
|
|
|
};
|
|
|
|
|
2008-11-03 02:31:47 -08:00
|
|
|
#define NS_NODELIST_OFFSET_AND_INTERFACE_TABLE_BEGIN(_class) \
|
|
|
|
NS_OFFSET_AND_INTERFACE_TABLE_BEGIN_AMBIGUOUS(_class, nsINodeList)
|
|
|
|
|
2008-09-10 20:15:29 -07:00
|
|
|
NS_DEFINE_STATIC_IID_ACCESSOR(nsINodeList, NS_INODELIST_IID)
|
|
|
|
|
|
|
|
#endif /* nsINodeList_h___ */
|