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