Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef nsINodeList_h___
7 #define nsINodeList_h___
9 #include "nsIDOMNodeList.h"
10 #include "nsWrapperCache.h"
11 #include "nsIContent.h"
13 // IID for the nsINodeList interface
14 #define NS_INODELIST_IID \
15 { 0xadb5e54c, 0x6e96, 0x4102, \
16 { 0x8d, 0x40, 0xe0, 0x12, 0x3d, 0xcf, 0x48, 0x7a } }
18 /**
19 * An internal interface for a reasonably fast indexOf.
20 */
21 class nsINodeList : public nsIDOMNodeList,
22 public nsWrapperCache
23 {
24 public:
25 NS_DECLARE_STATIC_IID_ACCESSOR(NS_INODELIST_IID)
27 /**
28 * Get the index of the given node in the list. Will return -1 if the node
29 * is not in the list.
30 */
31 virtual int32_t IndexOf(nsIContent* aContent) = 0;
33 /**
34 * Get the root node for this nodelist.
35 */
36 virtual nsINode* GetParentObject() = 0;
38 using nsIDOMNodeList::Item;
40 uint32_t Length()
41 {
42 uint32_t length;
43 GetLength(&length);
44 return length;
45 }
46 virtual nsIContent* Item(uint32_t aIndex) = 0;
47 nsIContent* IndexedGetter(uint32_t aIndex, bool& aFound)
48 {
49 nsIContent* item = Item(aIndex);
50 aFound = !!item;
51 return item;
52 }
53 };
55 #define NS_NODELIST_OFFSET_AND_INTERFACE_TABLE_BEGIN(_class) \
56 NS_OFFSET_AND_INTERFACE_TABLE_BEGIN_AMBIGUOUS(_class, nsINodeList)
58 NS_DEFINE_STATIC_IID_ACCESSOR(nsINodeList, NS_INODELIST_IID)
60 #endif /* nsINodeList_h___ */