Bug 804461 - accessible tree walker should take a context accessible as argument, r=tbsaunde

This commit is contained in:
Alexander Surkov 2012-11-18 00:27:03 +09:00
parent 0939b685d7
commit f1de05abda
7 changed files with 15 additions and 16 deletions

View File

@ -31,17 +31,17 @@ struct WalkState
////////////////////////////////////////////////////////////////////////////////
nsAccTreeWalker::
nsAccTreeWalker(DocAccessible* aDoc, nsIContent* aContent,
bool aWalkAnonContent, bool aWalkCache) :
mDoc(aDoc), mWalkCache(aWalkCache), mState(nullptr)
nsAccTreeWalker(DocAccessible* aDoc, Accessible* aContext,
nsIContent* aContent, bool aWalkCache) :
mDoc(aDoc), mContext(aContext), mWalkCache(aWalkCache), mState(nullptr)
{
NS_ASSERTION(aContent, "No node for the accessible tree walker!");
if (aContent)
mState = new WalkState(aContent);
mChildFilter = aWalkAnonContent ? nsIContent::eAllChildren :
nsIContent::eAllButXBL;
mChildFilter = mContext->CanHaveAnonChildren() ?
nsIContent::eAllChildren : nsIContent::eAllButXBL;
mChildFilter |= nsIContent::eSkipPlaceholderContent;

View File

@ -19,8 +19,8 @@ struct WalkState;
class nsAccTreeWalker
{
public:
nsAccTreeWalker(DocAccessible* aDoc, nsIContent* aNode,
bool aWalkAnonymousContent, bool aWalkCache = false);
nsAccTreeWalker(DocAccessible* aDoc, Accessible* aContext, nsIContent* aNode,
bool aWalkCache = false);
virtual ~nsAccTreeWalker();
/**
@ -60,6 +60,7 @@ private:
void PopState();
DocAccessible* mDoc;
Accessible* mContext;
int32_t mChildFilter;
bool mWalkCache;
WalkState* mState;

View File

@ -2949,7 +2949,7 @@ Accessible::CacheChildren()
DocAccessible* doc = Document();
NS_ENSURE_TRUE_VOID(doc);
nsAccTreeWalker walker(doc, mContent, CanHaveAnonChildren());
nsAccTreeWalker walker(doc, this, mContent);
Accessible* child = nullptr;
while ((child = walker.NextChild()) && AppendChild(child));

View File

@ -1511,8 +1511,7 @@ DocAccessible::CacheChildren()
{
// Search for accessible children starting from the document element since
// some web pages tend to insert elements under it rather than document body.
nsAccTreeWalker walker(this, mDocument->GetRootElement(),
CanHaveAnonChildren());
nsAccTreeWalker walker(this, this, mDocument->GetRootElement());
Accessible* child = nullptr;
while ((child = walker.NextChild()) && AppendChild(child));
@ -1857,8 +1856,7 @@ DocAccessible::UpdateTree(Accessible* aContainer, nsIContent* aChildNode,
updateFlags |= UpdateTreeInternal(child, aIsInsert, reorderEvent);
} else {
nsAccTreeWalker walker(this, aChildNode,
aContainer->CanHaveAnonChildren(), true);
nsAccTreeWalker walker(this, aContainer, aChildNode, true);
while ((child = walker.NextChild()))
updateFlags |= UpdateTreeInternal(child, aIsInsert, reorderEvent);

View File

@ -358,7 +358,7 @@ HTMLTableAccessible::CacheChildren()
// caption only, because nsAccessibilityService ensures we don't create
// accessibles for the other captions, since only the first is actually
// visible.
nsAccTreeWalker walker(mDoc, mContent, CanHaveAnonChildren());
nsAccTreeWalker walker(mDoc, this, mContent);
Accessible* child = nullptr;
while ((child = walker.NextChild())) {

View File

@ -141,7 +141,7 @@ XULColorPickerAccessible::CacheChildren()
{
NS_ENSURE_TRUE_VOID(mDoc);
nsAccTreeWalker walker(mDoc, mContent, true);
nsAccTreeWalker walker(mDoc, this, mContent);
Accessible* child = nullptr;
while ((child = walker.NextChild())) {

View File

@ -188,7 +188,7 @@ XULButtonAccessible::CacheChildren()
Accessible* menupopup = nullptr;
Accessible* button = nullptr;
nsAccTreeWalker walker(mDoc, mContent, true);
nsAccTreeWalker walker(mDoc, this, mContent);
Accessible* child = nullptr;
while ((child = walker.NextChild())) {
@ -827,7 +827,7 @@ XULTextFieldAccessible::CacheChildren()
if (!inputContent)
return;
nsAccTreeWalker walker(mDoc, inputContent, false);
nsAccTreeWalker walker(mDoc, this, inputContent);
Accessible* child = nullptr;
while ((child = walker.NextChild()) && AppendChild(child));