|
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- |
|
2 * |
|
3 * This Source Code Form is subject to the terms of the Mozilla Public |
|
4 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
6 |
|
7 /* |
|
8 * Implementation of DOM Traversal's nsIDOMTreeWalker |
|
9 */ |
|
10 |
|
11 #ifndef nsTraversal_h___ |
|
12 #define nsTraversal_h___ |
|
13 |
|
14 #include "nsCOMPtr.h" |
|
15 #include "nsIDocument.h" |
|
16 #include "mozilla/dom/CallbackObject.h" |
|
17 #include "mozilla/ErrorResult.h" |
|
18 #include "mozilla/dom/NodeFilterBinding.h" |
|
19 #include "nsIDOMNodeFilter.h" |
|
20 |
|
21 class nsINode; |
|
22 |
|
23 class nsTraversal |
|
24 { |
|
25 public: |
|
26 nsTraversal(nsINode *aRoot, |
|
27 uint32_t aWhatToShow, |
|
28 const mozilla::dom::NodeFilterHolder &aFilter); |
|
29 virtual ~nsTraversal(); |
|
30 |
|
31 protected: |
|
32 nsCOMPtr<nsINode> mRoot; |
|
33 uint32_t mWhatToShow; |
|
34 mozilla::dom::NodeFilterHolder mFilter; |
|
35 bool mInAcceptNode; |
|
36 |
|
37 /* |
|
38 * Tests if and how a node should be filtered. Uses mWhatToShow and |
|
39 * mFilter to test the node. |
|
40 * @param aNode Node to test |
|
41 * @param aResult Whether we succeeded |
|
42 * @returns Filtervalue. See nsIDOMNodeFilter.idl |
|
43 */ |
|
44 int16_t TestNode(nsINode* aNode, mozilla::ErrorResult& aResult); |
|
45 }; |
|
46 |
|
47 #endif |
|
48 |