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 mozilla_a11y_TreeWalker_h_
7 #define mozilla_a11y_TreeWalker_h_
9 #include "mozilla/Attributes.h"
23 * This class is used to walk the DOM tree to create accessible tree.
25 class TreeWalker MOZ_FINAL
29 // used to walk the existing tree of the given node
31 // used to walk the context tree starting from given node
32 eWalkContextTree
= 2 | eWalkCache
38 * @param aContext [in] container accessible for the given node, used to
39 * define accessible context
40 * @param aNode [in] the node the search will be prepared relative to
41 * @param aFlags [in] flags (see enum above)
43 TreeWalker(Accessible
* aContext
, nsIContent
* aNode
, uint32_t aFlags
= 0);
47 * Return the next child accessible.
49 * @note Returned accessible is bound to the document, if the accessible is
50 * rejected during tree creation then the caller should be unbind it
53 Accessible
* NextChild()
55 return NextChildInternal(false);
60 TreeWalker(const TreeWalker
&);
61 TreeWalker
& operator =(const TreeWalker
&);
64 * Return the next child accessible.
66 * @param aNoWalkUp [in] specifies the walk direction, true means we
67 * shouldn't go up through the tree if we failed find
68 * accessible children.
70 Accessible
* NextChildInternal(bool aNoWalkUp
);
73 * Create new state for the given node and push it on top of stack.
75 * @note State stack is used to navigate up/down the DOM subtree during
76 * accessible children search.
78 void PushState(nsIContent
* aNode
);
81 * Pop state from stack.
93 } // namespace mozilla
95 #endif // mozilla_a11y_TreeWalker_h_