mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 07:42:04 +00:00
Accessibility APIs: give visibility hidden/collapsed STATE_HIDDEN. r=kyle, sr=alecf
This commit is contained in:
parent
89f9ca5c7f
commit
19199aa3e8
@ -700,11 +700,13 @@ nsresult nsAccessible::GetFullKeyName(const nsAString& aModifierName, const nsAS
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRBool nsAccessible::IsPartiallyVisible()
|
||||
PRBool nsAccessible::IsPartiallyVisible(PRBool *aIsOffscreen)
|
||||
{
|
||||
// We need to know if at least a kMinPixels around the object is visible
|
||||
// Otherwise it will be marked STATE_OFFSCREEN and STATE_INVISIBLE
|
||||
|
||||
*aIsOffscreen = PR_FALSE;
|
||||
|
||||
const PRUint16 kMinPixels = 12;
|
||||
|
||||
// Set up the variables we need, return false if we can't get at them all
|
||||
@ -726,6 +728,16 @@ PRBool nsAccessible::IsPartiallyVisible()
|
||||
if (!frame)
|
||||
return PR_FALSE;
|
||||
|
||||
// If visibility:hidden or visibility:collapsed then mark with STATE_INVISIBLE
|
||||
nsCOMPtr<nsIStyleContext> styleContext;
|
||||
frame->GetStyleContext(getter_AddRefs(styleContext));
|
||||
if (styleContext) {
|
||||
const nsStyleVisibility* vis =
|
||||
(const nsStyleVisibility*)styleContext->GetStyleData(eStyleStruct_Visibility);
|
||||
if (!vis || !vis->IsVisible())
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPresContext> presContext;
|
||||
shell->GetPresContext(getter_AddRefs(presContext));
|
||||
if (!presContext)
|
||||
@ -754,7 +766,11 @@ PRBool nsAccessible::IsPartiallyVisible()
|
||||
NS_STATIC_CAST(PRUint16, (kMinPixels * p2t)),
|
||||
&rectVisibility);
|
||||
|
||||
return rectVisibility == nsRectVisibility_kVisible;
|
||||
if (rectVisibility == nsRectVisibility_kVisible)
|
||||
return PR_TRUE;
|
||||
|
||||
*aIsOffscreen = PR_TRUE;
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAccessible::GetFocusedNode(nsIDOMNode **aFocusedNode)
|
||||
@ -825,8 +841,12 @@ NS_IMETHODIMP nsAccessible::GetAccState(PRUint32 *aAccState)
|
||||
}
|
||||
|
||||
// Check if STATE_OFFSCREEN bitflag should be turned on for this object
|
||||
if (!IsPartiallyVisible())
|
||||
*aAccState |= STATE_OFFSCREEN | STATE_INVISIBLE;
|
||||
PRBool isOffscreen;
|
||||
if (!IsPartiallyVisible(&isOffscreen)) {
|
||||
*aAccState |= STATE_INVISIBLE;
|
||||
if (isOffscreen)
|
||||
*aAccState |= STATE_OFFSCREEN;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ protected:
|
||||
virtual nsIFrame* GetBoundsFrame();
|
||||
virtual void GetBounds(nsRect& aRect, nsIFrame** aRelativeFrame);
|
||||
virtual void GetPresContext(nsCOMPtr<nsIPresContext>& aContext);
|
||||
PRBool IsPartiallyVisible();
|
||||
PRBool IsPartiallyVisible(PRBool *aIsOffscreen);
|
||||
NS_IMETHOD AppendLabelText(nsIDOMNode *aLabelNode, nsAString& _retval);
|
||||
NS_IMETHOD AppendLabelFor(nsIContent *aLookNode, const nsAString *aId, nsAString *aLabel);
|
||||
NS_IMETHOD GetHTMLAccName(nsAString& _retval);
|
||||
|
Loading…
Reference in New Issue
Block a user