Bug 367145. Remove suspect code from nsAccessible::GetLabelContent. Patch by Alexander Surkov. r=aaronlev

This commit is contained in:
aaronleventhal%moonset.net 2007-01-16 19:59:50 +00:00
Родитель 935eb58a74
Коммит 632e7cf374
1 изменённых файлов: 5 добавлений и 20 удалений

Просмотреть файл

@ -1493,31 +1493,16 @@ nsIContent *nsAccessible::GetLabelContent(nsIContent *aForNode)
nsIContent* nsAccessible::GetXULLabelContent(nsIContent *aForNode, nsIAtom *aLabelType) nsIContent* nsAccessible::GetXULLabelContent(nsIContent *aForNode, nsIAtom *aLabelType)
{ {
nsAutoString controlID; nsAutoString controlID;
nsIContent *labelContent = GetContentPointingTo(&controlID, aForNode, nsnull, nsnull,
kNameSpaceID_None, aLabelType);
if (labelContent) {
return labelContent;
}
// If we're in anonymous content, determine whether we should use
// the binding parent based on where the id for this control is
aForNode->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::id, controlID); aForNode->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::id, controlID);
if (controlID.IsEmpty()) { if (controlID.IsEmpty())
// If no control ID and we're anonymous content return nsnull;
// get ID from parent that inserted us.
aForNode = aForNode->GetBindingParent();
if (aForNode) {
aForNode->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::id, controlID);
}
if (controlID.IsEmpty()) {
return nsnull;
}
}
// Look for label in subtrees of nearby ancestors // Look for label in subtrees of nearby ancestors
static const PRUint32 kAncestorLevelsToSearch = 5; static const PRUint32 kAncestorLevelsToSearch = 5;
PRUint32 count = 0; PRUint32 count = 0;
nsIContent *labelContent = nsnull;
nsIContent *prevSearched = nsnull; nsIContent *prevSearched = nsnull;
while (!labelContent && ++count <= kAncestorLevelsToSearch && while (!labelContent && ++count <= kAncestorLevelsToSearch &&
(aForNode = aForNode->GetParent()) != nsnull) { (aForNode = aForNode->GetParent()) != nsnull) {
labelContent = GetContentPointingTo(&controlID, aForNode, labelContent = GetContentPointingTo(&controlID, aForNode,