зеркало из https://github.com/mozilla/gecko-dev.git
Bug 282502. Tree items not returned in get_accFocus(). r=pkw, sr=jst
This commit is contained in:
Родитель
03a8934271
Коммит
06db8fa144
|
@ -637,15 +637,26 @@ NS_IMETHODIMP nsAccessible::GetState(PRUint32 *aState)
|
|||
/* readonly attribute boolean focusedChild; */
|
||||
NS_IMETHODIMP nsAccessible::GetFocusedChild(nsIAccessible **aFocusedChild)
|
||||
{
|
||||
*aFocusedChild = nsnull;
|
||||
|
||||
if (!gLastFocusedNode) {
|
||||
return NS_ERROR_FAILURE;
|
||||
nsCOMPtr<nsIAccessible> focusedChild;
|
||||
if (gLastFocusedNode == mDOMNode) {
|
||||
NS_ADDREF(*aFocusedChild = this);
|
||||
}
|
||||
else if (gLastFocusedNode) {
|
||||
nsCOMPtr<nsIAccessibilityService> accService =
|
||||
do_GetService("@mozilla.org/accessibilityService;1");
|
||||
accService->GetAccessibleInWeakShell(gLastFocusedNode, mWeakShell,
|
||||
getter_AddRefs(focusedChild));
|
||||
if (focusedChild) {
|
||||
nsCOMPtr<nsIAccessible> focusedParentAccessible;
|
||||
focusedChild->GetParent(getter_AddRefs(focusedParentAccessible));
|
||||
if (focusedParentAccessible != this) {
|
||||
focusedChild = nsnull;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIAccessibilityService> accService(do_GetService("@mozilla.org/accessibilityService;1"));
|
||||
return accService->GetAccessibleInWeakShell(gLastFocusedNode, mWeakShell,
|
||||
aFocusedChild);
|
||||
NS_IF_ADDREF(*aFocusedChild = focusedChild);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* nsIAccessible getChildAtPoint (in long x, in long y); */
|
||||
|
@ -1342,7 +1353,7 @@ nsRoleMapEntry nsAccessible::gWAIRoleMap[] =
|
|||
{"checkbox-tristate", ROLE_CHECKBUTTON, eAggregateSubtree, 0, {"checked", "true", STATE_CHECKED}, {"checked", "mixed", STATE_MIXED}, {"readonly", 0, STATE_READONLY}},
|
||||
{"columnheader", ROLE_COLUMNHEADER, eAggregateSubtree, STATE_SELECTABLE, {"selected", 0, STATE_SELECTED}, {0, 0, 0}, {0, 0, 0}},
|
||||
{"icon", ROLE_ICON, eAggregateSubtree, 0, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}},
|
||||
{"menu", ROLE_MENUPOPUP, eTitleOnly, 0, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}},
|
||||
{"menugroup", ROLE_MENUPOPUP, eTitleOnly, 0, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}},
|
||||
{"menupopup", ROLE_MENUPOPUP, eTitleOnly, 0, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}},
|
||||
{"menubar", ROLE_MENUBAR, eTitleOnly, 0, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}},
|
||||
{"menuitem", ROLE_MENUITEM, eAggregateSubtree, 0, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}},
|
||||
|
|
|
@ -180,6 +180,19 @@ NS_IMETHODIMP nsDocAccessible::GetState(PRUint32 *aState)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocAccessible::GetFocusedChild(nsIAccessible **aFocusedChild)
|
||||
{
|
||||
if (!gLastFocusedNode) {
|
||||
*aFocusedChild = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIAccessibilityService> accService =
|
||||
do_GetService("@mozilla.org/accessibilityService;1");
|
||||
return accService->GetAccessibleInWeakShell(gLastFocusedNode, mWeakShell,
|
||||
aFocusedChild);
|
||||
}
|
||||
|
||||
// ------- nsIAccessibleDocument Methods (5) ---------------
|
||||
|
||||
NS_IMETHODIMP nsDocAccessible::GetURL(nsAString& aURL)
|
||||
|
@ -530,17 +543,6 @@ nsresult nsDocAccessible::AddEventListeners()
|
|||
mIsNewDocument = PR_TRUE;
|
||||
mBusy = eBusyStateLoading;
|
||||
|
||||
if (!isLoading) {
|
||||
// If already loaded, fire "done loading" event after short timeout
|
||||
// If we fired the event here, we'd get reentrancy problems
|
||||
// Otherwise, if the doc is still loading,
|
||||
// the event will be fired from OnStateChange when the load is done
|
||||
mDocLoadTimer = do_CreateInstance("@mozilla.org/timer;1");
|
||||
if (mDocLoadTimer) {
|
||||
mDocLoadTimer->InitWithFuncCallback(DocLoadCallback, this, 1,
|
||||
nsITimer::TYPE_ONE_SHOT);
|
||||
}
|
||||
}
|
||||
// add ourself as a mutation event listener
|
||||
// (this slows down mozilla about 3%, but only used when accessibility APIs active)
|
||||
nsCOMPtr<nsIDOMEventTarget> target(do_QueryInterface(mDocument));
|
||||
|
|
|
@ -80,6 +80,7 @@ class nsDocAccessible : public nsBlockAccessible,
|
|||
NS_IMETHOD GetName(nsAString& aName);
|
||||
NS_IMETHOD GetValue(nsAString& aValue);
|
||||
NS_IMETHOD GetState(PRUint32 *aState);
|
||||
NS_IMETHOD GetFocusedChild(nsIAccessible **aFocusedChild);
|
||||
|
||||
// ----- nsIScrollPositionListener ---------------------------
|
||||
NS_IMETHOD ScrollPositionWillChange(nsIScrollableView *aView, nscoord aX, nscoord aY);
|
||||
|
|
|
@ -397,22 +397,20 @@ STDMETHODIMP nsAccessibleWrap::get_accFocus(
|
|||
}
|
||||
|
||||
VariantInit(pvarChild);
|
||||
if (mDOMNode == gLastFocusedNode) {
|
||||
pvarChild->vt = VT_I4;
|
||||
pvarChild->lVal = CHILDID_SELF;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
// Return the current IAccessible child that has focus
|
||||
pvarChild->vt = VT_EMPTY; // Fallback when focus isn't a child of this
|
||||
nsCOMPtr<nsIAccessible> focusedAccessible;
|
||||
if (NS_SUCCEEDED(GetFocusedChild(getter_AddRefs(focusedAccessible)))) {
|
||||
nsCOMPtr<nsIAccessible> parentAccessible;
|
||||
focusedAccessible->GetParent(getter_AddRefs(parentAccessible));
|
||||
if (parentAccessible == this) {
|
||||
pvarChild->vt = VT_DISPATCH;
|
||||
pvarChild->pdispVal = NativeAccessible(focusedAccessible);
|
||||
}
|
||||
GetFocusedChild(getter_AddRefs(focusedAccessible));
|
||||
if (focusedAccessible == this) {
|
||||
pvarChild->vt = VT_I4;
|
||||
pvarChild->lVal = CHILDID_SELF;
|
||||
}
|
||||
else if (focusedAccessible) {
|
||||
pvarChild->vt = VT_DISPATCH;
|
||||
pvarChild->pdispVal = NativeAccessible(focusedAccessible);
|
||||
}
|
||||
else {
|
||||
pvarChild->vt = VT_EMPTY; // No focus or focus is not a child
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
|
|
|
@ -161,27 +161,6 @@ STDMETHODIMP nsDocAccessibleWrap::get_accChild(
|
|||
return nsAccessibleWrap::get_accChild(varChild, ppdispChild);
|
||||
}
|
||||
|
||||
STDMETHODIMP nsDocAccessibleWrap::get_accFocus(
|
||||
/* [retval][out] */ VARIANT __RPC_FAR *pvarChild)
|
||||
{
|
||||
// Return the current IAccessible child that has focus
|
||||
VariantInit(pvarChild);
|
||||
pvarChild->vt = VT_EMPTY;
|
||||
|
||||
nsCOMPtr<nsIAccessible> accessible;
|
||||
if (NS_SUCCEEDED(GetFocusedChild(getter_AddRefs(accessible)))) {
|
||||
if (accessible == (nsIAccessible*)this) {
|
||||
pvarChild->vt = VT_I4;
|
||||
pvarChild->lVal = CHILDID_SELF;
|
||||
}
|
||||
else {
|
||||
pvarChild->vt = VT_DISPATCH;
|
||||
pvarChild->pdispVal = NativeAccessible(accessible);
|
||||
}
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsDocAccessibleWrap::get_accParent( IDispatch __RPC_FAR *__RPC_FAR *ppdispParent)
|
||||
{
|
||||
// MSAA expects that client area accessibles return the native accessible for
|
||||
|
|
|
@ -88,9 +88,6 @@ public:
|
|||
/* [in] */ VARIANT varChild,
|
||||
/* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *ppdispChild);
|
||||
|
||||
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accFocus(
|
||||
/* [retval][out] */ VARIANT __RPC_FAR *pvarChild);
|
||||
|
||||
// Override get_accParent so that native accessible for window is
|
||||
// returned as parent, otherwise WindowFromAccessibleObject() doesn't work.
|
||||
// Also necessary for MSAA SDK's accexplore.exe testing tool to work.
|
||||
|
|
|
@ -222,6 +222,24 @@ NS_IMETHODIMP nsXULTreeAccessible::GetChildCount(PRInt32 *aAccChildCount)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsXULTreeAccessible::GetFocusedChild(nsIAccessible **aFocusedChild)
|
||||
{
|
||||
nsCOMPtr<nsIDOMXULMultiSelectControlElement> multiSelect =
|
||||
do_QueryInterface(mDOMNode);
|
||||
if (multiSelect) {
|
||||
PRInt32 row;
|
||||
multiSelect->GetCurrentIndex(&row);
|
||||
if (row >= 0) {
|
||||
GetCachedTreeitemAccessible(row, nsnull, aFocusedChild);
|
||||
if (*aFocusedChild) {
|
||||
return NS_OK; // Already addref'd by getter
|
||||
}
|
||||
}
|
||||
}
|
||||
NS_ADDREF(*aFocusedChild = this);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Ask treeselection to get all selected children
|
||||
NS_IMETHODIMP nsXULTreeAccessible::GetSelectedChildren(nsIArray **_retval)
|
||||
{
|
||||
|
@ -374,8 +392,9 @@ NS_IMETHODIMP nsXULTreeAccessible::SelectAllSelection(PRBool *_retval)
|
|||
|
||||
NS_IMETHODIMP nsXULTreeAccessible::GetCachedTreeitemAccessible(PRInt32 aRow, nsITreeColumn* aColumn, nsIAccessible** aAccessible)
|
||||
{
|
||||
NS_ASSERTION(mAccessNodeCache, "No accessibility cache for tree");
|
||||
*aAccessible = nsnull;
|
||||
|
||||
NS_ASSERTION(mAccessNodeCache, "No accessibility cache for tree");
|
||||
NS_ASSERTION(mTree && mTreeView, "Can't get mTree or mTreeView!\n");
|
||||
|
||||
nsCOMPtr<nsITreeColumn> col = aColumn;
|
||||
|
|
|
@ -71,6 +71,7 @@ public:
|
|||
NS_IMETHOD GetFirstChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetChildCount(PRInt32 *_retval);
|
||||
NS_IMETHOD GetFocusedChild(nsIAccessible **aFocusedChild);
|
||||
|
||||
static void GetTreeBoxObject(nsIDOMNode* aDOMNode, nsITreeBoxObject** aBoxObject);
|
||||
static nsresult GetColumnCount(nsITreeBoxObject* aBoxObject, PRInt32 *aCount);
|
||||
|
|
Загрузка…
Ссылка в новой задаче