mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 15:52:07 +00:00
Bug 726005 - IDRefsIterator::Next() should use nsDocAccessible::GetAccessible(), r=tbsaunde, f=surkov
This commit is contained in:
parent
68228072cd
commit
9a3cd09269
@ -277,8 +277,10 @@ XULDescriptionIterator::Next()
|
||||
// IDRefsIterator
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
IDRefsIterator::IDRefsIterator(nsIContent* aContent, nsIAtom* aIDRefsAttr) :
|
||||
mCurrIdx(0), mContent(aContent)
|
||||
IDRefsIterator::
|
||||
IDRefsIterator(nsDocAccessible* aDoc, nsIContent* aContent,
|
||||
nsIAtom* aIDRefsAttr) :
|
||||
mCurrIdx(0), mContent(aContent), mDoc(aDoc)
|
||||
{
|
||||
if (mContent->IsInDoc())
|
||||
mContent->GetAttr(kNameSpaceID_None, aIDRefsAttr, mIDs);
|
||||
@ -368,7 +370,7 @@ nsAccessible*
|
||||
IDRefsIterator::Next()
|
||||
{
|
||||
nsIContent* nextElm = NextElem();
|
||||
return nextElm ? GetAccService()->GetAccessible(nextElm, nsnull) : nsnull;
|
||||
return nextElm ? mDoc->GetAccessible(nextElm) : nsnull;
|
||||
}
|
||||
|
||||
nsAccessible*
|
||||
|
@ -264,7 +264,8 @@ private:
|
||||
class IDRefsIterator : public AccIterable
|
||||
{
|
||||
public:
|
||||
IDRefsIterator(nsIContent* aContent, nsIAtom* aIDRefsAttr);
|
||||
IDRefsIterator(nsDocAccessible* aDoc, nsIContent* aContent,
|
||||
nsIAtom* aIDRefsAttr);
|
||||
virtual ~IDRefsIterator() { }
|
||||
|
||||
/**
|
||||
@ -292,6 +293,7 @@ private:
|
||||
|
||||
nsString mIDs;
|
||||
nsIContent* mContent;
|
||||
nsDocAccessible* mDoc;
|
||||
nsAString::index_type mCurrIdx;
|
||||
};
|
||||
|
||||
|
@ -2015,14 +2015,14 @@ nsAccessible::RelationByType(PRUint32 aType)
|
||||
Relation rel(new RelatedAccIterator(Document(), mContent,
|
||||
nsGkAtoms::aria_labelledby));
|
||||
if (mContent->Tag() == nsGkAtoms::label)
|
||||
rel.AppendIter(new IDRefsIterator(mContent, mContent->IsHTML() ?
|
||||
rel.AppendIter(new IDRefsIterator(mDoc, mContent, mContent->IsHTML() ?
|
||||
nsGkAtoms::_for :
|
||||
nsGkAtoms::control));
|
||||
|
||||
return rel;
|
||||
}
|
||||
case nsIAccessibleRelation::RELATION_LABELLED_BY: {
|
||||
Relation rel(new IDRefsIterator(mContent,
|
||||
Relation rel(new IDRefsIterator(mDoc, mContent,
|
||||
nsGkAtoms::aria_labelledby));
|
||||
if (mContent->IsHTML()) {
|
||||
rel.AppendIter(new HTMLLabelIterator(Document(), this));
|
||||
@ -2033,8 +2033,8 @@ nsAccessible::RelationByType(PRUint32 aType)
|
||||
return rel;
|
||||
}
|
||||
case nsIAccessibleRelation::RELATION_DESCRIBED_BY: {
|
||||
Relation rel(new IDRefsIterator(mContent,
|
||||
nsGkAtoms::aria_describedby));
|
||||
Relation rel(new IDRefsIterator(mDoc, mContent,
|
||||
nsGkAtoms::aria_describedby));
|
||||
if (mContent->IsXUL())
|
||||
rel.AppendIter(new XULDescriptionIterator(Document(), mContent));
|
||||
|
||||
@ -2049,7 +2049,7 @@ nsAccessible::RelationByType(PRUint32 aType)
|
||||
// tied to a control.
|
||||
if (mContent->Tag() == nsGkAtoms::description &&
|
||||
mContent->IsXUL())
|
||||
rel.AppendIter(new IDRefsIterator(mContent,
|
||||
rel.AppendIter(new IDRefsIterator(mDoc, mContent,
|
||||
nsGkAtoms::control));
|
||||
|
||||
return rel;
|
||||
@ -2091,13 +2091,13 @@ nsAccessible::RelationByType(PRUint32 aType)
|
||||
return Relation(new RelatedAccIterator(Document(), mContent,
|
||||
nsGkAtoms::aria_controls));
|
||||
case nsIAccessibleRelation::RELATION_CONTROLLER_FOR: {
|
||||
Relation rel(new IDRefsIterator(mContent,
|
||||
Relation rel(new IDRefsIterator(mDoc, mContent,
|
||||
nsGkAtoms::aria_controls));
|
||||
rel.AppendIter(new HTMLOutputIterator(Document(), mContent));
|
||||
return rel;
|
||||
}
|
||||
case nsIAccessibleRelation::RELATION_FLOWS_TO:
|
||||
return Relation(new IDRefsIterator(mContent,
|
||||
return Relation(new IDRefsIterator(mDoc, mContent,
|
||||
nsGkAtoms::aria_flowto));
|
||||
case nsIAccessibleRelation::RELATION_FLOWS_FROM:
|
||||
return Relation(new RelatedAccIterator(Document(), mContent,
|
||||
|
@ -1617,7 +1617,7 @@ nsDocAccessible::AddDependentIDsFor(nsAccessible* aRelProvider,
|
||||
continue;
|
||||
}
|
||||
|
||||
IDRefsIterator iter(aRelProvider->GetContent(), relAttr);
|
||||
IDRefsIterator iter(this, aRelProvider->GetContent(), relAttr);
|
||||
while (true) {
|
||||
const nsDependentSubstring id = iter.NextID();
|
||||
if (id.IsEmpty())
|
||||
@ -1668,7 +1668,7 @@ nsDocAccessible::RemoveDependentIDsFor(nsAccessible* aRelProvider,
|
||||
if (aRelAttr && aRelAttr != *kRelationAttrs[idx])
|
||||
continue;
|
||||
|
||||
IDRefsIterator iter(aRelProvider->GetContent(), relAttr);
|
||||
IDRefsIterator iter(this, aRelProvider->GetContent(), relAttr);
|
||||
while (true) {
|
||||
const nsDependentSubstring id = iter.NextID();
|
||||
if (id.IsEmpty())
|
||||
|
@ -94,7 +94,7 @@ nsTextEquivUtils::GetTextEquivFromIDRefs(nsAccessible *aAccessible,
|
||||
return NS_OK;
|
||||
|
||||
nsIContent* refContent = nsnull;
|
||||
IDRefsIterator iter(content, aIDRefsAttr);
|
||||
IDRefsIterator iter(aAccessible->Document(), content, aIDRefsAttr);
|
||||
while ((refContent = iter.NextElem())) {
|
||||
if (!aTextEquiv.IsEmpty())
|
||||
aTextEquiv += ' ';
|
||||
|
@ -334,7 +334,7 @@ nsHTMLTableCellAccessible::GetHeaderCells(PRInt32 aRowOrColumnHeaderCell,
|
||||
nsIArray **aHeaderCells)
|
||||
{
|
||||
// Get header cells from @header attribute.
|
||||
IDRefsIterator iter(mContent, nsGkAtoms::headers);
|
||||
IDRefsIterator iter(mDoc, mContent, nsGkAtoms::headers);
|
||||
nsIContent* headerCellElm = iter.NextElem();
|
||||
if (headerCellElm) {
|
||||
nsresult rv = NS_OK;
|
||||
|
@ -204,7 +204,7 @@ nsHTMLOutputAccessible::RelationByType(PRUint32 aType)
|
||||
{
|
||||
Relation rel = nsAccessibleWrap::RelationByType(aType);
|
||||
if (aType == nsIAccessibleRelation::RELATION_CONTROLLED_BY)
|
||||
rel.AppendIter(new IDRefsIterator(mContent, nsGkAtoms::_for));
|
||||
rel.AppendIter(new IDRefsIterator(mDoc, mContent, nsGkAtoms::_for));
|
||||
|
||||
return rel;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user