Bug 553005 - add getApplicationAccessible() method to nsIAccesibleRetrival, r=davidb

This commit is contained in:
Alexander Surkov 2010-03-18 13:45:10 +08:00
Родитель 4b7d16a57a
Коммит 7cf86d274f
3 изменённых файлов: 20 добавлений и 23 удалений

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

@ -56,9 +56,14 @@ interface nsIDOMDOMStringList;
*
* @status UNDER_REVIEW
*/
[scriptable, uuid(5f5a6f98-835d-4771-8bfe-a0c7cdc85fec)]
[scriptable, uuid(3df14f00-7253-4b9c-97c2-b4632090da23)]
interface nsIAccessibleRetrieval : nsISupports
{
/**
* Return application accessible.
*/
nsIAccessible getApplicationAccessible();
/**
* Return an nsIAccessible for a DOM node in pres shell 0.
* Create a new accessible of the appropriate type if necessary,

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

@ -960,6 +960,19 @@ nsAccessibilityService::GetCachedAccessNode(nsIDOMNode *aNode,
////////////////////////////////////////////////////////////////////////////////
// nsIAccessibleRetrieval
NS_IMETHODIMP
nsAccessibilityService::GetApplicationAccessible(nsIAccessible **aApplicationAccessible)
{
NS_ENSURE_ARG_POINTER(aApplicationAccessible);
*aApplicationAccessible = nsnull;
nsRefPtr<nsApplicationAccessibleWrap> appAcc =
nsAccessNode::GetApplicationAccessible();
NS_ENSURE_STATE(appAcc);
return CallQueryInterface(appAcc, aApplicationAccessible);
}
NS_IMETHODIMP
nsAccessibilityService::GetStringRole(PRUint32 aRole, nsAString& aString)
{

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

@ -277,28 +277,7 @@ function getRootAccessible(aAccOrElmOrID)
*/
function getApplicationAccessible()
{
var acc = getAccessible(document), parent = null;
while (acc) {
try {
parent = acc.parent;
} catch (e) {
ok(false, "Can't get a parent for " + prettyName(acc));
return null;
}
if (!parent) {
if (acc.role == ROLE_APP_ROOT)
return acc;
ok(false, "No application accessible!");
return null;
}
acc = parent;
}
return null;
return gAccRetrieval.getApplicationAccessible();
}
/**