зеркало из https://github.com/mozilla/gecko-dev.git
Backout bug 1251218
This commit is contained in:
Родитель
e867f719b9
Коммит
8d10d8bfb6
|
@ -20,35 +20,19 @@ using namespace mozilla::a11y;
|
|||
// TreeWalker
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
TreeWalker::
|
||||
TreeWalker(Accessible* aContext) :
|
||||
mDoc(aContext->Document()), mContext(aContext), mAnchorNode(nullptr),
|
||||
mChildFilter(nsIContent::eSkipPlaceholderContent), mFlags(0)
|
||||
{
|
||||
mChildFilter |= mContext->NoXBLKids() ?
|
||||
nsIContent::eAllButXBL | nsIContent::eAllChildren;
|
||||
|
||||
mAnchorNode = mContext->IsDoc() ?
|
||||
mDoc->DocumentNode()->GetRootElement() : mContext->GetContent();
|
||||
|
||||
if (mAnchorNode) {
|
||||
PushState(mAnchorNode);
|
||||
}
|
||||
|
||||
MOZ_COUNT_CTOR(TreeWalker);
|
||||
}
|
||||
|
||||
TreeWalker::
|
||||
TreeWalker(Accessible* aContext, nsIContent* aContent, uint32_t aFlags) :
|
||||
mDoc(aContext->Document()), mContext(aContext), mAnchorNode(aContent),
|
||||
mChildFilter(nsIContent::eSkipPlaceholderContent), mFlags(aFlags)
|
||||
mFlags(aFlags)
|
||||
{
|
||||
MOZ_ASSERT(aContent, "No anchor node for the accessible tree walker");
|
||||
NS_ASSERTION(aContent, "No node for the accessible tree walker!");
|
||||
|
||||
mChildFilter |= mContext->NoXBLKids() ?
|
||||
nsIContent::eAllButXBL | nsIContent::eAllChildren;
|
||||
mChildFilter = mContext->NoXBLKids() ?
|
||||
nsIContent::eAllButXBL : nsIContent::eAllChildren;
|
||||
mChildFilter |= nsIContent::eSkipPlaceholderContent;
|
||||
|
||||
PushState(aContent);
|
||||
if (aContent)
|
||||
PushState(aContent);
|
||||
|
||||
MOZ_COUNT_CTOR(TreeWalker);
|
||||
}
|
||||
|
|
|
@ -33,20 +33,14 @@ public:
|
|||
};
|
||||
|
||||
/**
|
||||
* Used to navigate and create if needed the accessible children.
|
||||
*/
|
||||
explicit TreeWalker(Accessible* aContext);
|
||||
|
||||
/**
|
||||
* Used to navigate the accessible children relative to the anchor.
|
||||
* Constructor
|
||||
*
|
||||
* @param aContext [in] container accessible for the given node, used to
|
||||
* define accessible context
|
||||
* @param aAnchorNode [in] the node the search will be prepared relative to
|
||||
* @param aNode [in] the node the search will be prepared relative to
|
||||
* @param aFlags [in] flags (see enum above)
|
||||
*/
|
||||
TreeWalker(Accessible* aContext, nsIContent* aAnchorNode, uint32_t aFlags = 0);
|
||||
|
||||
TreeWalker(Accessible* aContext, nsIContent* aNode, uint32_t aFlags = 0);
|
||||
~TreeWalker();
|
||||
|
||||
/**
|
||||
|
|
|
@ -2541,9 +2541,10 @@ Accessible::LastRelease()
|
|||
void
|
||||
Accessible::CacheChildren()
|
||||
{
|
||||
NS_ENSURE_TRUE_VOID(Document());
|
||||
DocAccessible* doc = Document();
|
||||
NS_ENSURE_TRUE_VOID(doc);
|
||||
|
||||
TreeWalker walker(this);
|
||||
TreeWalker walker(this, mContent);
|
||||
|
||||
Accessible* child = nullptr;
|
||||
while ((child = walker.Next()) && AppendChild(child));
|
||||
|
|
|
@ -1418,6 +1418,25 @@ if (!aNode->IsContent() || !aNode->AsContent()->IsHTMLElement(nsGkAtoms::area))
|
|||
return GetAccessible(aNode);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Accessible protected
|
||||
|
||||
void
|
||||
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.
|
||||
dom::Element* rootElm = mDocumentNode->GetRootElement();
|
||||
if (!rootElm)
|
||||
return;
|
||||
|
||||
TreeWalker walker(this, rootElm);
|
||||
Accessible* child = nullptr;
|
||||
while ((child = walker.Next())) {
|
||||
AppendChild(child);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Protected members
|
||||
|
||||
|
|
|
@ -359,6 +359,9 @@ protected:
|
|||
|
||||
void LastRelease();
|
||||
|
||||
// Accessible
|
||||
virtual void CacheChildren() override;
|
||||
|
||||
// DocAccessible
|
||||
virtual nsresult AddEventListeners();
|
||||
virtual nsresult RemoveEventListeners();
|
||||
|
|
Загрузка…
Ссылка в новой задаче