1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
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/. */
8 * Implementation of common traversal methods for TreeWalker and NodeIterator.
11 #ifndef nsTraversal_h___
12 #define nsTraversal_h___
15 #include "mozilla/dom/CallbackObject.h"
16 #include "mozilla/ErrorResult.h"
17 #include "mozilla/dom/NodeFilterBinding.h"
23 nsTraversal(nsINode
* aRoot
, uint32_t aWhatToShow
,
24 mozilla::dom::NodeFilter
* aFilter
);
25 virtual ~nsTraversal();
28 nsCOMPtr
<nsINode
> mRoot
;
30 RefPtr
<mozilla::dom::NodeFilter
> mFilter
;
34 * Tests if and how a node should be filtered. Uses mWhatToShow and
35 * mFilter to test the node.
36 * @param aNode Node to test
37 * @param aResult Whether we succeeded
38 * @param aUnskippedNode If non-null is passed, set to aNode if node isn't
39 * filtered out by mWhatToShow.
40 * @returns Filtervalue. See NodeFilter.webidl
42 int16_t TestNode(nsINode
* aNode
, mozilla::ErrorResult
& aResult
,
43 nsCOMPtr
<nsINode
>* aUnskippedNode
= nullptr);