2015-05-03 19:32:37 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-05-21 11:12:37 +00: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-11 03:15:29 +00:00
|
|
|
|
|
|
|
#ifndef nsINodeList_h___
|
|
|
|
#define nsINodeList_h___
|
|
|
|
|
2009-01-02 17:00:18 +00:00
|
|
|
#include "nsIDOMNodeList.h"
|
2009-06-16 06:32:10 +00:00
|
|
|
#include "nsWrapperCache.h"
|
2015-05-19 10:33:00 +00:00
|
|
|
#include "nsIContent.h"
|
2008-09-11 03:15:29 +00:00
|
|
|
|
|
|
|
// IID for the nsINodeList interface
|
|
|
|
#define NS_INODELIST_IID \
|
2012-10-13 12:50:24 +00:00
|
|
|
{ 0xadb5e54c, 0x6e96, 0x4102, \
|
|
|
|
{ 0x8d, 0x40, 0xe0, 0x12, 0x3d, 0xcf, 0x48, 0x7a } }
|
2008-09-11 03:15:29 +00:00
|
|
|
|
2015-04-17 01:39:13 +00:00
|
|
|
class nsIContent;
|
|
|
|
class nsINode;
|
|
|
|
|
2008-09-11 03:15:29 +00:00
|
|
|
/**
|
2011-08-20 13:53:33 +00:00
|
|
|
* An internal interface for a reasonably fast indexOf.
|
2008-09-11 03:15:29 +00:00
|
|
|
*/
|
2009-06-16 06:32:10 +00:00
|
|
|
class nsINodeList : public nsIDOMNodeList,
|
|
|
|
public nsWrapperCache
|
2008-10-22 14:31:14 +00:00
|
|
|
{
|
2008-09-11 03:15:29 +00:00
|
|
|
public:
|
|
|
|
NS_DECLARE_STATIC_IID_ACCESSOR(NS_INODELIST_IID)
|
|
|
|
|
2009-01-29 19:46:18 +00: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 15:56:38 +00:00
|
|
|
virtual int32_t IndexOf(nsIContent* aContent) = 0;
|
2009-06-16 06:32:10 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the root node for this nodelist.
|
|
|
|
*/
|
|
|
|
virtual nsINode* GetParentObject() = 0;
|
2012-09-05 20:49:53 +00:00
|
|
|
|
|
|
|
using nsIDOMNodeList::Item;
|
|
|
|
|
|
|
|
uint32_t Length()
|
|
|
|
{
|
|
|
|
uint32_t length;
|
|
|
|
GetLength(&length);
|
|
|
|
return length;
|
|
|
|
}
|
2012-10-13 12:50:24 +00:00
|
|
|
virtual nsIContent* Item(uint32_t aIndex) = 0;
|
2012-09-05 20:49:53 +00:00
|
|
|
nsIContent* IndexedGetter(uint32_t aIndex, bool& aFound)
|
|
|
|
{
|
|
|
|
nsIContent* item = Item(aIndex);
|
|
|
|
aFound = !!item;
|
|
|
|
return item;
|
|
|
|
}
|
2008-09-11 03:15:29 +00:00
|
|
|
};
|
|
|
|
|
2008-11-03 10:31:47 +00:00
|
|
|
#define NS_NODELIST_OFFSET_AND_INTERFACE_TABLE_BEGIN(_class) \
|
|
|
|
NS_OFFSET_AND_INTERFACE_TABLE_BEGIN_AMBIGUOUS(_class, nsINodeList)
|
|
|
|
|
2008-09-11 03:15:29 +00:00
|
|
|
NS_DEFINE_STATIC_IID_ACCESSOR(nsINodeList, NS_INODELIST_IID)
|
|
|
|
|
|
|
|
#endif /* nsINodeList_h___ */
|