2010-02-21 00:55:04 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 11:12:37 +00:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2010-02-21 00:55:04 +00:00
|
|
|
|
|
|
|
#ifndef _nsAccTreeWalker_H_
|
|
|
|
#define _nsAccTreeWalker_H_
|
|
|
|
|
2010-02-21 00:56:35 +00:00
|
|
|
#include "nsAutoPtr.h"
|
2010-02-21 00:55:04 +00:00
|
|
|
#include "nsIContent.h"
|
|
|
|
|
2010-02-21 00:56:35 +00:00
|
|
|
class nsAccessible;
|
2012-02-09 16:49:17 +00:00
|
|
|
class nsDocAccessible;
|
2010-02-21 00:55:04 +00:00
|
|
|
struct WalkState;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This class is used to walk the DOM tree to create accessible tree.
|
|
|
|
*/
|
|
|
|
class nsAccTreeWalker
|
|
|
|
{
|
|
|
|
public:
|
2012-02-09 16:49:17 +00:00
|
|
|
nsAccTreeWalker(nsDocAccessible* aDoc, nsIContent* aNode,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool aWalkAnonymousContent, bool aWalkCache = false);
|
2010-02-21 00:55:04 +00:00
|
|
|
virtual ~nsAccTreeWalker();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the next child accessible.
|
2011-03-31 09:30:58 +00:00
|
|
|
*
|
|
|
|
* @note Returned accessible is bound to the document, if the accessible is
|
|
|
|
* rejected during tree creation then the caller should be unbind it
|
|
|
|
* from the document.
|
2010-02-21 00:55:04 +00:00
|
|
|
*/
|
2011-03-31 09:30:58 +00:00
|
|
|
inline nsAccessible* NextChild()
|
2010-02-21 00:55:04 +00:00
|
|
|
{
|
2011-03-31 09:30:58 +00:00
|
|
|
return NextChildInternal(false);
|
2010-02-21 00:55:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the next child accessible.
|
|
|
|
*
|
|
|
|
* @param aNoWalkUp [in] specifies the walk direction, true means we
|
|
|
|
* shouldn't go up through the tree if we failed find
|
|
|
|
* accessible children.
|
|
|
|
*/
|
2011-03-31 09:30:58 +00:00
|
|
|
nsAccessible* NextChildInternal(bool aNoWalkUp);
|
2010-02-21 00:55:04 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Create new state for the given node and push it on top of stack.
|
|
|
|
*
|
|
|
|
* @note State stack is used to navigate up/down the DOM subtree during
|
|
|
|
* accessible children search.
|
|
|
|
*/
|
2011-09-29 06:19:26 +00:00
|
|
|
bool PushState(nsIContent *aNode);
|
2010-02-21 00:55:04 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Pop state from stack.
|
|
|
|
*/
|
|
|
|
void PopState();
|
|
|
|
|
2012-02-09 16:49:17 +00:00
|
|
|
nsDocAccessible* mDoc;
|
2010-10-15 15:34:35 +00:00
|
|
|
PRInt32 mChildFilter;
|
2011-04-07 05:17:29 +00:00
|
|
|
bool mWalkCache;
|
2010-02-21 00:55:04 +00:00
|
|
|
WalkState* mState;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|