Bug 396025 - accessible object created for tbody/thead/tfoot event when ARIA role is on parent table, r=aaronlev, a=discore

This commit is contained in:
surkov.alexander@gmail.com 2007-09-18 20:12:54 -07:00
Родитель 594d6f1e28
Коммит 0dc404bc6a
1 изменённых файлов: 28 добавлений и 19 удалений

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

@ -1361,12 +1361,9 @@ NS_IMETHODIMP nsAccessibilityService::GetAccessible(nsIDOMNode *aNode,
nsIAccessibleRole::ROLE_EQUATION);
}
} else if (!newAcc) { // HTML accessibles
// Prefer to use markup (mostly tag name, perhaps attributes) to
// decide if and what kind of accessible to create.
CreateHTMLAccessibleByMarkup(frame, aWeakShell, aNode, getter_AddRefs(newAcc));
PRBool tryTagNameOrFrame = PR_TRUE;
PRBool tryFrame = (newAcc == nsnull);
if (!content->IsFocusable()) {
if (!content->IsFocusable()) {
// If we're in unfocusable table-related subcontent, check for the
// Presentation role on the containing table
nsIAtom *tag = content->Tag();
@ -1386,28 +1383,40 @@ NS_IMETHODIMP nsAccessibilityService::GetAccessible(nsIDOMNode *aNode,
// Table that we're a descendant of is not styled as a table,
// and has no table accessible for an ancestor, or
// table that we're a descendant of is presentational
tryFrame = PR_FALSE;
tryTagNameOrFrame = PR_FALSE;
}
break;
}
}
}
}
if (tryFrame) {
// Do not create accessible object subtrees for non-rendered table captions.
// This could not be done in nsTableCaptionFrame::GetAccessible() because the
// descendants of the table caption would still be created.
// By setting *aIsHidden = PR_TRUE we ensure that no descendant accessibles are created
if (frame->GetType() == nsAccessibilityAtoms::tableCaptionFrame &&
frame->GetRect().IsEmpty()) {
// XXX This is not the ideal place for this code, but right now there is
// no better place:
*aIsHidden = PR_TRUE;
return NS_OK;
if (tryTagNameOrFrame) {
// Prefer to use markup (mostly tag name, perhaps attributes) to
// decide if and what kind of accessible to create.
// The method creates accessibles for table related content too therefore
// we do not call it if accessibles for table related content are
// prevented above.
rv = CreateHTMLAccessibleByMarkup(frame, aWeakShell, aNode,
getter_AddRefs(newAcc));
NS_ENSURE_SUCCESS(rv, rv);
if (!newAcc) {
// Do not create accessible object subtrees for non-rendered table
// captions. This could not be done in
// nsTableCaptionFrame::GetAccessible() because the descendants of
// the table caption would still be created. By setting
// *aIsHidden = PR_TRUE we ensure that no descendant accessibles are
// created.
if (frame->GetType() == nsAccessibilityAtoms::tableCaptionFrame &&
frame->GetRect().IsEmpty()) {
// XXX This is not the ideal place for this code, but right now there
// is no better place:
*aIsHidden = PR_TRUE;
return NS_OK;
}
frame->GetAccessible(getter_AddRefs(newAcc)); // Try using frame to do it
}
frame->GetAccessible(getter_AddRefs(newAcc)); // Try using frame to do it
}
}