Bug 382270. The displayed menu item in a collapsed HTML combo box should have SHOWING state exposed via AT-SPI. r=evan.yan

This commit is contained in:
aaronleventhal@moonset.net 2007-06-05 13:02:35 -07:00
Родитель 6627ba1753
Коммит 6a9342cfb6
1 изменённых файлов: 17 добавлений и 2 удалений

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

@ -604,6 +604,10 @@ nsHTMLSelectOptionAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
PRUint32 selectState;
nsCOMPtr<nsIContent> selectContent = GetSelectState(&selectState);
if (selectState & nsIAccessibleStates::STATE_INVISIBLE) {
return NS_OK;
}
nsCOMPtr<nsIDOMNode> selectNode = do_QueryInterface(selectContent);
NS_ENSURE_TRUE(selectNode, NS_ERROR_FAILURE);
@ -625,10 +629,21 @@ nsHTMLSelectOptionAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
*aState |= nsIAccessibleStates::STATE_FOCUSABLE;
if (selectState & nsIAccessibleStates::STATE_COLLAPSED) {
// <select> is COLLAPSED: add STATE_OFFSCREEN
if (selectState & nsIAccessibleStates::STATE_OFFSCREEN) {
*aState |= nsIAccessibleStates::STATE_OFFSCREEN;
}
else if (selectState & nsIAccessibleStates::STATE_COLLAPSED) {
// <select> is COLLAPSED: add STATE_OFFSCREEN, if not the currently
// visible option
if (focusedOptionNode != mDOMNode) {
*aState |= nsIAccessibleStates::STATE_OFFSCREEN;
}
else {
// Clear offscreen and invisible for currently showing option
*aState &= ~nsIAccessibleStates::STATE_OFFSCREEN;
*aState &= ~nsIAccessibleStates::STATE_INVISIBLE;
}
}
else {
// XXX list frames are weird, don't rely on nsAccessible's general
// visibility implementation unless they get reimplemented in layout