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
parent 0b580ac505
commit d63f6da5c7

View File

@ -604,6 +604,10 @@ nsHTMLSelectOptionAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
PRUint32 selectState; PRUint32 selectState;
nsCOMPtr<nsIContent> selectContent = GetSelectState(&selectState); nsCOMPtr<nsIContent> selectContent = GetSelectState(&selectState);
if (selectState & nsIAccessibleStates::STATE_INVISIBLE) {
return NS_OK;
}
nsCOMPtr<nsIDOMNode> selectNode = do_QueryInterface(selectContent); nsCOMPtr<nsIDOMNode> selectNode = do_QueryInterface(selectContent);
NS_ENSURE_TRUE(selectNode, NS_ERROR_FAILURE); NS_ENSURE_TRUE(selectNode, NS_ERROR_FAILURE);
@ -625,10 +629,21 @@ nsHTMLSelectOptionAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
*aState |= nsIAccessibleStates::STATE_FOCUSABLE; *aState |= nsIAccessibleStates::STATE_FOCUSABLE;
if (selectState & nsIAccessibleStates::STATE_COLLAPSED) { if (selectState & nsIAccessibleStates::STATE_OFFSCREEN) {
// <select> is COLLAPSED: add STATE_OFFSCREEN
*aState |= 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 { else {
// XXX list frames are weird, don't rely on nsAccessible's general // XXX list frames are weird, don't rely on nsAccessible's general
// visibility implementation unless they get reimplemented in layout // visibility implementation unless they get reimplemented in layout