mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 812846 - densify nsAccTreeWalker, r=tbsaunde
--HG-- rename : accessible/src/base/nsAccTreeWalker.cpp => accessible/src/base/TreeWalker.cpp rename : accessible/src/base/nsAccTreeWalker.h => accessible/src/base/TreeWalker.h
This commit is contained in:
parent
245536ec61
commit
6ddf37136f
@ -30,7 +30,6 @@ CPPSRCS = \
|
||||
nsAccUtils.cpp \
|
||||
nsAccessibilityService.cpp \
|
||||
nsAccessiblePivot.cpp \
|
||||
nsAccTreeWalker.cpp \
|
||||
nsEventShell.cpp \
|
||||
nsCaretAccessible.cpp \
|
||||
nsTextEquivUtils.cpp \
|
||||
@ -38,6 +37,7 @@ CPPSRCS = \
|
||||
StyleInfo.cpp \
|
||||
TextAttrs.cpp \
|
||||
TextUpdater.cpp \
|
||||
TreeWalker.cpp \
|
||||
$(NULL)
|
||||
|
||||
ifneq ($(A11Y_LOG),0)
|
||||
|
@ -3,7 +3,7 @@
|
||||
* 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/. */
|
||||
|
||||
#include "nsAccTreeWalker.h"
|
||||
#include "TreeWalker.h"
|
||||
|
||||
#include "Accessible.h"
|
||||
#include "nsAccessibilityService.h"
|
||||
@ -17,6 +17,9 @@ using namespace mozilla::a11y;
|
||||
// WalkState
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
struct WalkState
|
||||
{
|
||||
WalkState(nsIContent *aContent) :
|
||||
@ -28,14 +31,17 @@ struct WalkState
|
||||
WalkState *prevState;
|
||||
};
|
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsAccTreeWalker
|
||||
// TreeWalker
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsAccTreeWalker::
|
||||
nsAccTreeWalker(DocAccessible* aDoc, Accessible* aContext,
|
||||
nsIContent* aContent, bool aWalkCache) :
|
||||
mDoc(aDoc), mContext(aContext), mWalkCache(aWalkCache), mState(nullptr)
|
||||
TreeWalker::
|
||||
TreeWalker(Accessible* aContext, nsIContent* aContent, bool aWalkCache) :
|
||||
mDoc(aContext->Document()), mContext(aContext),
|
||||
mWalkCache(aWalkCache), mState(nullptr)
|
||||
{
|
||||
NS_ASSERTION(aContent, "No node for the accessible tree walker!");
|
||||
|
||||
@ -47,23 +53,23 @@ nsAccTreeWalker::
|
||||
|
||||
mChildFilter |= nsIContent::eSkipPlaceholderContent;
|
||||
|
||||
MOZ_COUNT_CTOR(nsAccTreeWalker);
|
||||
MOZ_COUNT_CTOR(TreeWalker);
|
||||
}
|
||||
|
||||
nsAccTreeWalker::~nsAccTreeWalker()
|
||||
TreeWalker::~TreeWalker()
|
||||
{
|
||||
// Clear state stack from memory
|
||||
while (mState)
|
||||
PopState();
|
||||
|
||||
MOZ_COUNT_DTOR(nsAccTreeWalker);
|
||||
MOZ_COUNT_DTOR(TreeWalker);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsAccTreeWalker: private
|
||||
// TreeWalker: private
|
||||
|
||||
Accessible*
|
||||
nsAccTreeWalker::NextChildInternal(bool aNoWalkUp)
|
||||
TreeWalker::NextChildInternal(bool aNoWalkUp)
|
||||
{
|
||||
if (!mState || !mState->content)
|
||||
return nullptr;
|
||||
@ -104,7 +110,7 @@ nsAccTreeWalker::NextChildInternal(bool aNoWalkUp)
|
||||
}
|
||||
|
||||
void
|
||||
nsAccTreeWalker::PopState()
|
||||
TreeWalker::PopState()
|
||||
{
|
||||
WalkState* prevToLastState = mState->prevState;
|
||||
delete mState;
|
||||
@ -112,7 +118,7 @@ nsAccTreeWalker::PopState()
|
||||
}
|
||||
|
||||
bool
|
||||
nsAccTreeWalker::PushState(nsIContent* aContent)
|
||||
TreeWalker::PushState(nsIContent* aContent)
|
||||
{
|
||||
WalkState* nextToLastState = new WalkState(aContent);
|
||||
if (!nextToLastState)
|
@ -3,8 +3,8 @@
|
||||
* 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/. */
|
||||
|
||||
#ifndef _nsAccTreeWalker_H_
|
||||
#define _nsAccTreeWalker_H_
|
||||
#ifndef mozilla_a11y_TreeWalker_h_
|
||||
#define mozilla_a11y_TreeWalker_h_
|
||||
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsIContent.h"
|
||||
@ -15,23 +15,16 @@ namespace a11y {
|
||||
class Accessible;
|
||||
class DocAccessible;
|
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
struct WalkState;
|
||||
|
||||
/**
|
||||
* This class is used to walk the DOM tree to create accessible tree.
|
||||
*/
|
||||
class nsAccTreeWalker
|
||||
class TreeWalker
|
||||
{
|
||||
public:
|
||||
typedef mozilla::a11y::Accessible Accessible;
|
||||
typedef mozilla::a11y::DocAccessible DocAccessible;
|
||||
|
||||
nsAccTreeWalker(DocAccessible* aDoc, Accessible* aContext, nsIContent* aNode,
|
||||
bool aWalkCache = false);
|
||||
virtual ~nsAccTreeWalker();
|
||||
TreeWalker(Accessible* aContext, nsIContent* aNode, bool aWalkCache = false);
|
||||
virtual ~TreeWalker();
|
||||
|
||||
/**
|
||||
* Return the next child accessible.
|
||||
@ -46,6 +39,9 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
TreeWalker();
|
||||
TreeWalker(const TreeWalker&);
|
||||
TreeWalker& operator =(const TreeWalker&);
|
||||
|
||||
/**
|
||||
* Return the next child accessible.
|
||||
@ -76,4 +72,7 @@ private:
|
||||
WalkState* mState;
|
||||
};
|
||||
|
||||
#endif
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_a11y_TreeWalker_h_
|
@ -14,7 +14,6 @@
|
||||
#include "nsAccEvent.h"
|
||||
#include "nsAccessibleRelation.h"
|
||||
#include "nsAccessibilityService.h"
|
||||
#include "nsAccTreeWalker.h"
|
||||
#include "nsIAccessibleRelation.h"
|
||||
#include "nsEventShell.h"
|
||||
#include "nsTextEquivUtils.h"
|
||||
@ -23,6 +22,7 @@
|
||||
#include "RootAccessible.h"
|
||||
#include "States.h"
|
||||
#include "StyleInfo.h"
|
||||
#include "TreeWalker.h"
|
||||
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsIDOMElement.h"
|
||||
@ -2949,7 +2949,7 @@ Accessible::CacheChildren()
|
||||
DocAccessible* doc = Document();
|
||||
NS_ENSURE_TRUE_VOID(doc);
|
||||
|
||||
nsAccTreeWalker walker(doc, this, mContent);
|
||||
TreeWalker walker(this, mContent);
|
||||
|
||||
Accessible* child = nullptr;
|
||||
while ((child = walker.NextChild()) && AppendChild(child));
|
||||
|
@ -8,12 +8,12 @@
|
||||
#include "DocAccessible-inl.h"
|
||||
#include "nsAccCache.h"
|
||||
#include "nsAccessiblePivot.h"
|
||||
#include "nsAccTreeWalker.h"
|
||||
#include "nsAccUtils.h"
|
||||
#include "nsEventShell.h"
|
||||
#include "nsTextEquivUtils.h"
|
||||
#include "Role.h"
|
||||
#include "RootAccessible.h"
|
||||
#include "TreeWalker.h"
|
||||
|
||||
#include "nsIMutableArray.h"
|
||||
#include "nsICommandManager.h"
|
||||
@ -1511,7 +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, this, mDocument->GetRootElement());
|
||||
TreeWalker walker(this, mDocument->GetRootElement());
|
||||
|
||||
Accessible* child = nullptr;
|
||||
while ((child = walker.NextChild()) && AppendChild(child));
|
||||
@ -1856,7 +1856,7 @@ DocAccessible::UpdateTree(Accessible* aContainer, nsIContent* aChildNode,
|
||||
updateFlags |= UpdateTreeInternal(child, aIsInsert, reorderEvent);
|
||||
|
||||
} else {
|
||||
nsAccTreeWalker walker(this, aContainer, aChildNode, true);
|
||||
TreeWalker walker(aContainer, aChildNode, true);
|
||||
|
||||
while ((child = walker.NextChild()))
|
||||
updateFlags |= UpdateTreeInternal(child, aIsInsert, reorderEvent);
|
||||
|
@ -7,16 +7,15 @@
|
||||
|
||||
#include "Accessible-inl.h"
|
||||
#include "nsAccessibilityService.h"
|
||||
#include "nsAccTreeWalker.h"
|
||||
#include "nsAccUtils.h"
|
||||
#include "DocAccessible.h"
|
||||
#include "nsIAccessibleRelation.h"
|
||||
#include "nsTextEquivUtils.h"
|
||||
#include "Relation.h"
|
||||
#include "Role.h"
|
||||
#include "States.h"
|
||||
#include "nsIMutableArray.h"
|
||||
#include "TreeWalker.h"
|
||||
|
||||
#include "nsIAccessibleRelation.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMRange.h"
|
||||
@ -29,6 +28,7 @@
|
||||
#include "nsIDOMHTMLTableRowElement.h"
|
||||
#include "nsIDOMHTMLTableSectionElem.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIMutableArray.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsITableLayout.h"
|
||||
#include "nsITableCellLayout.h"
|
||||
@ -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, this, mContent);
|
||||
TreeWalker walker(this, mContent);
|
||||
|
||||
Accessible* child = nullptr;
|
||||
while ((child = walker.NextChild())) {
|
||||
|
@ -7,11 +7,11 @@
|
||||
|
||||
#include "Accessible-inl.h"
|
||||
#include "nsAccUtils.h"
|
||||
#include "nsAccTreeWalker.h"
|
||||
#include "nsCoreUtils.h"
|
||||
#include "DocAccessible.h"
|
||||
#include "Role.h"
|
||||
#include "States.h"
|
||||
#include "TreeWalker.h"
|
||||
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsMenuPopupFrame.h"
|
||||
@ -141,7 +141,7 @@ XULColorPickerAccessible::CacheChildren()
|
||||
{
|
||||
NS_ENSURE_TRUE_VOID(mDoc);
|
||||
|
||||
nsAccTreeWalker walker(mDoc, this, mContent);
|
||||
TreeWalker walker(this, mContent);
|
||||
|
||||
Accessible* child = nullptr;
|
||||
while ((child = walker.NextChild())) {
|
||||
|
@ -8,13 +8,13 @@
|
||||
#include "Accessible-inl.h"
|
||||
#include "HTMLFormControlAccessible.h"
|
||||
#include "nsAccUtils.h"
|
||||
#include "nsAccTreeWalker.h"
|
||||
#include "nsCoreUtils.h"
|
||||
#include "DocAccessible.h"
|
||||
#include "nsIAccessibleRelation.h"
|
||||
#include "Relation.h"
|
||||
#include "Role.h"
|
||||
#include "States.h"
|
||||
#include "TreeWalker.h"
|
||||
#include "XULMenuAccessible.h"
|
||||
|
||||
#include "nsIDOMNSEditableElement.h"
|
||||
@ -188,7 +188,7 @@ XULButtonAccessible::CacheChildren()
|
||||
Accessible* menupopup = nullptr;
|
||||
Accessible* button = nullptr;
|
||||
|
||||
nsAccTreeWalker walker(mDoc, this, mContent);
|
||||
TreeWalker walker(this, mContent);
|
||||
|
||||
Accessible* child = nullptr;
|
||||
while ((child = walker.NextChild())) {
|
||||
@ -827,7 +827,7 @@ XULTextFieldAccessible::CacheChildren()
|
||||
if (!inputContent)
|
||||
return;
|
||||
|
||||
nsAccTreeWalker walker(mDoc, this, inputContent);
|
||||
TreeWalker walker(this, inputContent);
|
||||
|
||||
Accessible* child = nullptr;
|
||||
while ((child = walker.NextChild()) && AppendChild(child));
|
||||
|
Loading…
Reference in New Issue
Block a user