accessible/src/base/TreeWalker.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #ifndef mozilla_a11y_TreeWalker_h_
michael@0 7 #define mozilla_a11y_TreeWalker_h_
michael@0 8
michael@0 9 #include "mozilla/Attributes.h"
michael@0 10 #include <stdint.h>
michael@0 11
michael@0 12 class nsIContent;
michael@0 13
michael@0 14 namespace mozilla {
michael@0 15 namespace a11y {
michael@0 16
michael@0 17 class Accessible;
michael@0 18 class DocAccessible;
michael@0 19
michael@0 20 struct WalkState;
michael@0 21
michael@0 22 /**
michael@0 23 * This class is used to walk the DOM tree to create accessible tree.
michael@0 24 */
michael@0 25 class TreeWalker MOZ_FINAL
michael@0 26 {
michael@0 27 public:
michael@0 28 enum {
michael@0 29 // used to walk the existing tree of the given node
michael@0 30 eWalkCache = 1,
michael@0 31 // used to walk the context tree starting from given node
michael@0 32 eWalkContextTree = 2 | eWalkCache
michael@0 33 };
michael@0 34
michael@0 35 /**
michael@0 36 * Constructor
michael@0 37 *
michael@0 38 * @param aContext [in] container accessible for the given node, used to
michael@0 39 * define accessible context
michael@0 40 * @param aNode [in] the node the search will be prepared relative to
michael@0 41 * @param aFlags [in] flags (see enum above)
michael@0 42 */
michael@0 43 TreeWalker(Accessible* aContext, nsIContent* aNode, uint32_t aFlags = 0);
michael@0 44 ~TreeWalker();
michael@0 45
michael@0 46 /**
michael@0 47 * Return the next child accessible.
michael@0 48 *
michael@0 49 * @note Returned accessible is bound to the document, if the accessible is
michael@0 50 * rejected during tree creation then the caller should be unbind it
michael@0 51 * from the document.
michael@0 52 */
michael@0 53 Accessible* NextChild()
michael@0 54 {
michael@0 55 return NextChildInternal(false);
michael@0 56 }
michael@0 57
michael@0 58 private:
michael@0 59 TreeWalker();
michael@0 60 TreeWalker(const TreeWalker&);
michael@0 61 TreeWalker& operator =(const TreeWalker&);
michael@0 62
michael@0 63 /**
michael@0 64 * Return the next child accessible.
michael@0 65 *
michael@0 66 * @param aNoWalkUp [in] specifies the walk direction, true means we
michael@0 67 * shouldn't go up through the tree if we failed find
michael@0 68 * accessible children.
michael@0 69 */
michael@0 70 Accessible* NextChildInternal(bool aNoWalkUp);
michael@0 71
michael@0 72 /**
michael@0 73 * Create new state for the given node and push it on top of stack.
michael@0 74 *
michael@0 75 * @note State stack is used to navigate up/down the DOM subtree during
michael@0 76 * accessible children search.
michael@0 77 */
michael@0 78 void PushState(nsIContent* aNode);
michael@0 79
michael@0 80 /**
michael@0 81 * Pop state from stack.
michael@0 82 */
michael@0 83 void PopState();
michael@0 84
michael@0 85 DocAccessible* mDoc;
michael@0 86 Accessible* mContext;
michael@0 87 int32_t mChildFilter;
michael@0 88 uint32_t mFlags;
michael@0 89 WalkState* mState;
michael@0 90 };
michael@0 91
michael@0 92 } // namespace a11y
michael@0 93 } // namespace mozilla
michael@0 94
michael@0 95 #endif // mozilla_a11y_TreeWalker_h_

mercurial