Bug 414656. Expose native enumerated role along with ARIA landmark roles. Patch by Alexander Surkov. r=aaronlev, a=schrep

This commit is contained in:
aaronleventhal@moonset.net 2008-02-05 16:30:29 -08:00
Родитель 37d56fb06d
Коммит f3a44ba1be
4 изменённых файлов: 40 добавлений и 6 удалений

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

@ -213,6 +213,15 @@ nsRoleMapEntry nsARIAMap::gLandmarkRoleMap = {
kEndEntry
};
nsRoleMapEntry nsARIAMap::gEmptyRoleMap = {
"",
nsIAccessibleRole::ROLE_NOTHING,
eNameLabelOrTitle,
eNoValue,
kNoReqStates,
kEndEntry
};
/**
* Universal states:
* The following state rules are applied to any accessible element,

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

@ -125,9 +125,29 @@ struct nsRoleMapEntry
*/
struct nsARIAMap
{
/**
* Array of supported ARIA role map entries and its length.
*/
static nsRoleMapEntry gWAIRoleMap[];
static PRUint32 gWAIRoleMapLength;
/**
* Landmark role map entry. Used when specified ARIA role isn't mapped to
* accessibility API.
*/
static nsRoleMapEntry gLandmarkRoleMap;
/**
* Empty role map entry. Used by accessibility service to create an accessible
* if the accessible can't use role of used accessible class. For example,
* it is used for table cells that aren't contained by table.
*/
static nsRoleMapEntry gEmptyRoleMap;
/**
* State map of ARIA states applied to any accessible not depending on
* the role.
*/
static nsStateMapEntry gWAIUnivStateMap[];
};

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

@ -1450,7 +1450,8 @@ NS_IMETHODIMP nsAccessibilityService::GetAccessible(nsIDOMNode *aNode,
}
if (tableAccessible && nsAccessible::Role(tableAccessible) != nsIAccessibleRole::ROLE_TABLE) {
NS_ASSERTION(!roleMapEntry, "Should not be changing ARIA role, just overriding impl class role");
roleMapEntry = &nsARIAMap::gLandmarkRoleMap; // Not in table: override role (roleMap entry was null)
// Not in table: override role (roleMap entry was null).
roleMapEntry = &nsARIAMap::gEmptyRoleMap;
}
break;
}
@ -1458,7 +1459,8 @@ NS_IMETHODIMP nsAccessibilityService::GetAccessible(nsIDOMNode *aNode,
// Stop before we are fooled by any additional table ancestors
// This table cell frameis part of a separate ancestor table.
NS_ASSERTION(!roleMapEntry, "Should not be changing ARIA role, just overriding impl class role");
roleMapEntry = &nsARIAMap::gLandmarkRoleMap; // Not in table: override role
// Not in table: override role (roleMap entry was null).
roleMapEntry = &nsARIAMap::gEmptyRoleMap;
break;
}
}

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

@ -1987,10 +1987,13 @@ NS_IMETHODIMP nsAccessible::GetFinalRole(PRUint32 *aRole)
}
}
// We can now expose ROLE_NOTHING when there is a role map entry, which will
// cause ATK to use ROLE_UNKNOWN and MSAA to use a BSTR role with the ARIA role or element's tag.
// In either case the AT can also use the object attributes tag and xml-roles to find out more.
return NS_OK;
if (mRoleMapEntry == &nsARIAMap::gEmptyRoleMap) {
// We can now expose ROLE_NOTHING when there is a role map entry, which
// will cause ATK to use ROLE_UNKNOWN and MSAA to use a BSTR role with
// the ARIA role or element's tag. In either case the AT can also use
// the object attributes tag and xml-roles to find out more.
return NS_OK;
}
}
return mDOMNode ? GetRole(aRole) : NS_ERROR_FAILURE; // Node already shut down
}