2010-02-20 16:55:04 -08:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 04:12:37 -07: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-20 16:55:04 -08:00
|
|
|
|
|
|
|
#ifndef _nsAccTreeWalker_H_
|
|
|
|
#define _nsAccTreeWalker_H_
|
|
|
|
|
2010-02-20 16:56:35 -08:00
|
|
|
#include "nsAutoPtr.h"
|
2010-02-20 16:55:04 -08:00
|
|
|
#include "nsIContent.h"
|
|
|
|
|
2012-05-28 18:18:45 -07:00
|
|
|
class Accessible;
|
2012-05-27 02:01:40 -07:00
|
|
|
class DocAccessible;
|
2010-02-20 16:55:04 -08:00
|
|
|
struct WalkState;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This class is used to walk the DOM tree to create accessible tree.
|
|
|
|
*/
|
|
|
|
class nsAccTreeWalker
|
|
|
|
{
|
|
|
|
public:
|
2012-05-27 02:01:40 -07:00
|
|
|
nsAccTreeWalker(DocAccessible* aDoc, nsIContent* aNode,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aWalkAnonymousContent, bool aWalkCache = false);
|
2010-02-20 16:55:04 -08:00
|
|
|
virtual ~nsAccTreeWalker();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the next child accessible.
|
2011-03-31 02:30:58 -07: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-20 16:55:04 -08:00
|
|
|
*/
|
2012-05-28 18:18:45 -07:00
|
|
|
Accessible* NextChild()
|
2010-02-20 16:55:04 -08:00
|
|
|
{
|
2011-03-31 02:30:58 -07:00
|
|
|
return NextChildInternal(false);
|
2010-02-20 16:55:04 -08: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.
|
|
|
|
*/
|
2012-05-28 18:18:45 -07:00
|
|
|
Accessible* NextChildInternal(bool aNoWalkUp);
|
2010-02-20 16:55:04 -08: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-28 23:19:26 -07:00
|
|
|
bool PushState(nsIContent *aNode);
|
2010-02-20 16:55:04 -08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Pop state from stack.
|
|
|
|
*/
|
|
|
|
void PopState();
|
|
|
|
|
2012-05-27 02:01:40 -07:00
|
|
|
DocAccessible* mDoc;
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t mChildFilter;
|
2011-04-06 22:17:29 -07:00
|
|
|
bool mWalkCache;
|
2010-02-20 16:55:04 -08:00
|
|
|
WalkState* mState;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|