mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-14 13:55:43 +00:00
Bug 393657. GetARIAState() called twice when we get a state. r=surkov, a=dsicore
This commit is contained in:
parent
352518a027
commit
77dadd7d29
@ -993,7 +993,7 @@ PRBool nsAccessible::IsVisible(PRBool *aIsOffscreen)
|
||||
return isVisible;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsresult
|
||||
nsAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
|
||||
{
|
||||
*aState = 0;
|
||||
@ -1051,45 +1051,6 @@ nsAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
|
||||
*aState |= nsIAccessibleStates::STATE_OFFSCREEN;
|
||||
}
|
||||
|
||||
if (!aExtraState)
|
||||
return NS_OK;
|
||||
|
||||
PRUint32 state = *aState;
|
||||
nsresult rv = GetARIAState(&state);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsIFrame *frame = GetFrame();
|
||||
if (frame) {
|
||||
const nsStyleDisplay* display = frame->GetStyleDisplay();
|
||||
if (display && display->mOpacity == 1.0f &&
|
||||
!(state & nsIAccessibleStates::STATE_INVISIBLE)) {
|
||||
*aExtraState |= nsIAccessibleStates::EXT_STATE_OPAQUE;
|
||||
}
|
||||
|
||||
const nsStyleXUL *xulStyle = frame->GetStyleXUL();
|
||||
if (xulStyle) {
|
||||
// In XUL all boxes are either vertical or horizontal
|
||||
if (xulStyle->mBoxOrient == NS_STYLE_BOX_ORIENT_VERTICAL) {
|
||||
*aExtraState |= nsIAccessibleStates::EXT_STATE_VERTICAL;
|
||||
}
|
||||
else {
|
||||
*aExtraState |= nsIAccessibleStates::EXT_STATE_HORIZONTAL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// XXX We can remove this hack once we support RDF-based role & state maps
|
||||
if (mRoleMapEntry && (mRoleMapEntry->role == nsIAccessibleRole::ROLE_ENTRY ||
|
||||
mRoleMapEntry->role == nsIAccessibleRole::ROLE_PASSWORD_TEXT)) {
|
||||
if (content->AttrValueIs(kNameSpaceID_WAIProperties , nsAccessibilityAtoms::multiline,
|
||||
nsAccessibilityAtoms::_true, eCaseMatters)) {
|
||||
*aExtraState |= nsIAccessibleStates::EXT_STATE_MULTI_LINE;
|
||||
}
|
||||
else {
|
||||
*aExtraState |= nsIAccessibleStates::EXT_STATE_SINGLE_LINE;
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -2048,7 +2009,7 @@ NS_IMETHODIMP nsAccessible::GetFinalRole(PRUint32 *aRole)
|
||||
if (*aRole == nsIAccessibleRole::ROLE_ENTRY) {
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(mDOMNode);
|
||||
if (content &&
|
||||
content->AttrValueIs(kNameSpaceID_WAIProperties , nsAccessibilityAtoms::secret,
|
||||
content->AttrValueIs(kNameSpaceID_WAIProperties, nsAccessibilityAtoms::secret,
|
||||
nsAccessibilityAtoms::_true, eCaseMatters)) {
|
||||
// For entry field with aaa:secret="true"
|
||||
*aRole = nsIAccessibleRole::ROLE_PASSWORD_TEXT;
|
||||
@ -2306,6 +2267,39 @@ nsAccessible::GetFinalState(PRUint32 *aState, PRUint32 *aExtraState)
|
||||
*aExtraState &= ~nsIAccessibleStates::STATE_COLLAPSED;
|
||||
}
|
||||
}
|
||||
nsIFrame *frame = GetFrame();
|
||||
if (frame) {
|
||||
const nsStyleDisplay* display = frame->GetStyleDisplay();
|
||||
if (display && display->mOpacity == 1.0f &&
|
||||
!(*aState & nsIAccessibleStates::STATE_INVISIBLE)) {
|
||||
*aExtraState |= nsIAccessibleStates::EXT_STATE_OPAQUE;
|
||||
}
|
||||
|
||||
const nsStyleXUL *xulStyle = frame->GetStyleXUL();
|
||||
if (xulStyle) {
|
||||
// In XUL all boxes are either vertical or horizontal
|
||||
if (xulStyle->mBoxOrient == NS_STYLE_BOX_ORIENT_VERTICAL) {
|
||||
*aExtraState |= nsIAccessibleStates::EXT_STATE_VERTICAL;
|
||||
}
|
||||
else {
|
||||
*aExtraState |= nsIAccessibleStates::EXT_STATE_HORIZONTAL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// XXX We can remove this hack once we support RDF-based role & state maps
|
||||
if (mRoleMapEntry && (mRoleMapEntry->role == nsIAccessibleRole::ROLE_ENTRY ||
|
||||
mRoleMapEntry->role == nsIAccessibleRole::ROLE_PASSWORD_TEXT)) {
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(mDOMNode);
|
||||
NS_ENSURE_TRUE(content, NS_ERROR_FAILURE);
|
||||
if (content->AttrValueIs(kNameSpaceID_WAIProperties, nsAccessibilityAtoms::multiline,
|
||||
nsAccessibilityAtoms::_true, eCaseMatters)) {
|
||||
*aExtraState |= nsIAccessibleStates::EXT_STATE_MULTI_LINE;
|
||||
}
|
||||
else {
|
||||
*aExtraState |= nsIAccessibleStates::EXT_STATE_SINGLE_LINE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -123,7 +123,7 @@ public:
|
||||
* second argument is omitted then second bit field of accessible state won't
|
||||
* be calculated.
|
||||
*/
|
||||
NS_IMETHOD GetState(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
nsresult GetState(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
|
||||
/**
|
||||
* Returns attributes for accessible without explicitly setted ARIA
|
||||
|
Loading…
Reference in New Issue
Block a user