2015-05-03 22:32:37 +03: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 15:12:37 +04: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 07:15:29 +04:00
|
|
|
|
|
|
|
#ifndef nsINodeList_h___
|
|
|
|
#define nsINodeList_h___
|
|
|
|
|
2009-01-02 20:00:18 +03:00
|
|
|
#include "nsIDOMNodeList.h"
|
2009-06-16 10:32:10 +04:00
|
|
|
#include "nsWrapperCache.h"
|
2015-05-19 13:33:00 +03:00
|
|
|
#include "nsIContent.h"
|
2008-09-11 07:15:29 +04:00
|
|
|
|
|
|
|
// IID for the nsINodeList interface
|
|
|
|
#define NS_INODELIST_IID \
|
2012-10-13 16:50:24 +04:00
|
|
|
{ 0xadb5e54c, 0x6e96, 0x4102, \
|
|
|
|
{ 0x8d, 0x40, 0xe0, 0x12, 0x3d, 0xcf, 0x48, 0x7a } }
|
2008-09-11 07:15:29 +04:00
|
|
|
|
2015-04-17 04:39:13 +03:00
|
|
|
class nsIContent;
|
|
|
|
class nsINode;
|
|
|
|
|
2008-09-11 07:15:29 +04:00
|
|
|
/**
|
2011-08-20 17:53:33 +04:00
|
|
|
* An internal interface for a reasonably fast indexOf.
|
2008-09-11 07:15:29 +04:00
|
|
|
*/
|
2009-06-16 10:32:10 +04:00
|
|
|
class nsINodeList : public nsIDOMNodeList,
|
|
|
|
public nsWrapperCache
|
2008-10-22 18:31:14 +04:00
|
|
|
{
|
2008-09-11 07:15:29 +04:00
|
|
|
public:
|
|
|
|
NS_DECLARE_STATIC_IID_ACCESSOR(NS_INODELIST_IID)
|
|
|
|
|
2009-01-29 22:46:18 +03: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 19:56:38 +04:00
|
|
|
virtual int32_t IndexOf(nsIContent* aContent) = 0;
|
2009-06-16 10:32:10 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the root node for this nodelist.
|
|
|
|
*/
|
|
|
|
virtual nsINode* GetParentObject() = 0;
|
2012-09-06 00:49:53 +04:00
|
|
|
|
2018-03-20 21:02:08 +03:00
|
|
|
virtual uint32_t Length() = 0;
|
2012-10-13 16:50:24 +04:00
|
|
|
virtual nsIContent* Item(uint32_t aIndex) = 0;
|
2012-09-06 00:49:53 +04:00
|
|
|
nsIContent* IndexedGetter(uint32_t aIndex, bool& aFound)
|
|
|
|
{
|
|
|
|
nsIContent* item = Item(aIndex);
|
|
|
|
aFound = !!item;
|
|
|
|
return item;
|
|
|
|
}
|
2008-09-11 07:15:29 +04:00
|
|
|
|
2018-03-20 21:02:08 +03:00
|
|
|
static nsINodeList* FromDOMNodeList(nsIDOMNodeList *list)
|
|
|
|
{
|
|
|
|
return static_cast<nsINodeList*>(list);
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
2008-11-03 13:31:47 +03:00
|
|
|
|
2008-09-11 07:15:29 +04:00
|
|
|
NS_DEFINE_STATIC_IID_ACCESSOR(nsINodeList, NS_INODELIST_IID)
|
|
|
|
|
|
|
|
#endif /* nsINodeList_h___ */
|