зеркало из https://github.com/mozilla/pjs.git
Bug 168624. Microsoft Narrator hanging Mozilla. r=pkw, sr=bryner
This commit is contained in:
Родитель
cb1458d0c2
Коммит
237ed8dc35
|
@ -493,9 +493,6 @@ NS_IMETHODIMP nsAccessibleHyperText::GetSelectedLinkIndex(PRInt32 *aSelectedLink
|
|||
|
||||
nsCOMPtr<nsIDOMNode> curNode(do_QueryInterface(mTextChildren->ElementAt(0)));
|
||||
|
||||
nsCOMPtr<nsIDOMNode> focusedNode;
|
||||
nsAccessible::GetFocusedNode(curNode, getter_AddRefs(focusedNode));
|
||||
|
||||
PRUint32 index, linkCount = 0;
|
||||
for (index = 0; index < count; index++) {
|
||||
nsCOMPtr<nsIDOMNode> domNode(do_QueryInterface(mTextChildren->ElementAt(index)));
|
||||
|
@ -509,7 +506,7 @@ NS_IMETHODIMP nsAccessibleHyperText::GetSelectedLinkIndex(PRInt32 *aSelectedLink
|
|||
} while (domNode && link == nsnull);
|
||||
|
||||
if (link) {
|
||||
if (parentNode == focusedNode) {
|
||||
if (parentNode == nsAccessNode::gLastFocusedNode) {
|
||||
*aSelectedLinkIndex = linkCount;
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -116,9 +116,7 @@ NS_IMETHODIMP nsHTMLLinkAccessibleWrap::IsValid(PRBool *aIsValid)
|
|||
/* boolean isSelected (); */
|
||||
NS_IMETHODIMP nsHTMLLinkAccessibleWrap::IsSelected(PRBool *aIsSelected)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> focusedNode;
|
||||
GetFocusedNode(mDOMNode, getter_AddRefs(focusedNode));
|
||||
*aIsSelected = (focusedNode == mDOMNode);
|
||||
*aIsSelected = (gLastFocusedNode == mDOMNode);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -117,7 +117,9 @@ class nsAccessNode: public nsIAccessNode, public nsPIAccessNode
|
|||
static void GetDocAccessibleFor(nsIWeakReference *aPresShell,
|
||||
nsIAccessibleDocument **aDocAccessible);
|
||||
|
||||
protected:
|
||||
static nsIDOMNode *gLastFocusedNode;
|
||||
|
||||
protected:
|
||||
nsresult MakeAccessNode(nsIDOMNode *aNode, nsIAccessNode **aAccessNode);
|
||||
already_AddRefed<nsIPresShell> GetPresShell();
|
||||
already_AddRefed<nsIPresContext> GetPresContext();
|
||||
|
@ -138,7 +140,6 @@ class nsAccessNode: public nsIAccessNode, public nsPIAccessNode
|
|||
// Static data, we do our own refcounting for our static data
|
||||
static nsIStringBundle *gStringBundle;
|
||||
static nsIStringBundle *gKeyStringBundle;
|
||||
static nsIDOMNode *gLastFocusedNode;
|
||||
static PRBool gIsAccessibilityActive;
|
||||
static PRBool gIsCacheDisabled;
|
||||
|
||||
|
|
|
@ -70,3 +70,4 @@ ACCESSIBILITY_ATOM(ul, "ul")
|
|||
|
||||
// Alphabetical list of attributes
|
||||
ACCESSIBILITY_ATOM(id, "id")
|
||||
ACCESSIBILITY_ATOM(tabindex, "tabindex")
|
||||
|
|
|
@ -62,6 +62,7 @@
|
|||
#include "nsIDocShell.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsILink.h"
|
||||
#include "nsINamespaceManager.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsIPluginInstance.h"
|
||||
#include "nsIPresContext.h"
|
||||
|
|
|
@ -509,47 +509,6 @@ PRBool nsAccessible::IsPartiallyVisible(PRBool *aIsOffscreen)
|
|||
return PR_FALSE;
|
||||
}
|
||||
|
||||
nsresult nsAccessible::GetFocusedNode(nsIDOMNode *aCurrentNode, nsIDOMNode **aFocusedNode)
|
||||
{
|
||||
nsIFocusController *focusController = nsnull;
|
||||
nsCOMPtr<nsIDocument> document;
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(aCurrentNode));
|
||||
if (content)
|
||||
document = content->GetDocument();
|
||||
|
||||
if (!document)
|
||||
document = do_QueryInterface(aCurrentNode);
|
||||
if (document) {
|
||||
nsCOMPtr<nsPIDOMWindow> ourWindow(do_QueryInterface(document->GetScriptGlobalObject()));
|
||||
if (ourWindow)
|
||||
focusController = ourWindow->GetRootFocusController();
|
||||
}
|
||||
|
||||
if (focusController) {
|
||||
nsCOMPtr<nsIDOMNode> focusedNode;
|
||||
nsCOMPtr<nsIDOMElement> focusedElement;
|
||||
focusController->GetFocusedElement(getter_AddRefs(focusedElement));
|
||||
if (!focusedElement) {
|
||||
nsCOMPtr<nsIDOMWindowInternal> windowInternal;
|
||||
focusController->GetFocusedWindow(getter_AddRefs(windowInternal));
|
||||
nsCOMPtr<nsIDOMWindow> window(do_QueryInterface(windowInternal));
|
||||
if (window) {
|
||||
nsCOMPtr<nsIDOMDocument> domDoc;
|
||||
window->GetDocument(getter_AddRefs(domDoc));
|
||||
focusedNode = do_QueryInterface(domDoc);
|
||||
}
|
||||
}
|
||||
else
|
||||
focusedNode = do_QueryInterface(focusedElement);
|
||||
if (focusedNode) {
|
||||
*aFocusedNode = focusedNode;
|
||||
NS_ADDREF(*aFocusedNode);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
/* readonly attribute wstring state; */
|
||||
NS_IMETHODIMP nsAccessible::GetState(PRUint32 *aState)
|
||||
{
|
||||
|
@ -569,8 +528,7 @@ NS_IMETHODIMP nsAccessible::GetState(PRUint32 *aState)
|
|||
else {
|
||||
*aState |= STATE_FOCUSABLE;
|
||||
nsCOMPtr<nsIDOMNode> focusedNode;
|
||||
if (gLastFocusedNode == mDOMNode ||
|
||||
(NS_SUCCEEDED(GetFocusedNode(mDOMNode, getter_AddRefs(focusedNode))) && focusedNode == mDOMNode)) {
|
||||
if (gLastFocusedNode == mDOMNode) {
|
||||
*aState |= STATE_FOCUSED;
|
||||
}
|
||||
}
|
||||
|
@ -592,22 +550,13 @@ NS_IMETHODIMP nsAccessible::GetFocusedChild(nsIAccessible **aFocusedChild)
|
|||
{
|
||||
*aFocusedChild = nsnull;
|
||||
|
||||
nsCOMPtr<nsIAccessibilityService> accService(do_GetService("@mozilla.org/accessibilityService;1"));
|
||||
|
||||
nsCOMPtr<nsIDOMNode> focusedNode;
|
||||
if (accService &&
|
||||
NS_SUCCEEDED(GetFocusedNode(mDOMNode, getter_AddRefs(focusedNode)))) {
|
||||
nsCOMPtr<nsIAccessible> accessible;
|
||||
if (NS_SUCCEEDED(accService->GetAccessibleInWeakShell(focusedNode,
|
||||
mWeakShell,
|
||||
getter_AddRefs(accessible)))) {
|
||||
*aFocusedChild = accessible;
|
||||
NS_ADDREF(*aFocusedChild);
|
||||
return NS_OK;
|
||||
}
|
||||
if (!gLastFocusedNode) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIAccessibilityService> accService(do_GetService("@mozilla.org/accessibilityService;1"));
|
||||
return accService->GetAccessibleInWeakShell(gLastFocusedNode, mWeakShell,
|
||||
aFocusedChild);
|
||||
}
|
||||
|
||||
/* nsIAccessible getChildAtPoint (in long x, in long y); */
|
||||
|
|
|
@ -73,8 +73,6 @@ public:
|
|||
NS_DECL_NSIACCESSIBLE
|
||||
NS_DECL_NSPIACCESSIBLE
|
||||
|
||||
static nsresult GetFocusedNode(nsIDOMNode *aCurrentNode, nsIDOMNode **aFocusedNode);
|
||||
|
||||
// nsIAccessNode
|
||||
NS_IMETHOD Shutdown();
|
||||
|
||||
|
|
|
@ -347,18 +347,14 @@ STDMETHODIMP nsAccessibleWrap::get_accKeyboardShortcut(
|
|||
STDMETHODIMP nsAccessibleWrap::get_accFocus(
|
||||
/* [retval][out] */ VARIANT __RPC_FAR *pvarChild)
|
||||
{
|
||||
// Return the current nsIAccessible that has focus
|
||||
// Unless we manage a child's focus we return VT_EMPTY.
|
||||
// Since documents manage the child focus in Mozilla, we
|
||||
// only return a focused IAccessible in
|
||||
// nsDocAccessibleWrap::get_accFocus)()
|
||||
|
||||
VariantInit(pvarChild);
|
||||
|
||||
nsCOMPtr<nsIAccessible> focusedAccessible;
|
||||
if (NS_SUCCEEDED(GetFocusedChild(getter_AddRefs(focusedAccessible)))) {
|
||||
pvarChild->vt = VT_DISPATCH;
|
||||
pvarChild->pdispVal = NativeAccessible(focusedAccessible);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
pvarChild->vt = VT_EMPTY;
|
||||
return E_FAIL;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -152,6 +152,27 @@ 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,6 +88,9 @@ 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.
|
||||
|
|
|
@ -498,19 +498,10 @@ NS_IMETHODIMP nsXULRadioButtonAccessible::GetState(PRUint32 *_retval)
|
|||
PRBool selected = PR_FALSE; // Radio buttons can be selected
|
||||
|
||||
nsCOMPtr<nsIDOMXULSelectControlItemElement> radioButton(do_QueryInterface(mDOMNode));
|
||||
if (radioButton)
|
||||
if (radioButton) {
|
||||
radioButton->GetSelected(&selected);
|
||||
|
||||
if (selected) {
|
||||
*_retval |= STATE_CHECKED;
|
||||
// If our parent radio group is focused, then consider this radio button focused
|
||||
nsCOMPtr<nsIDOMNode> parentNode;
|
||||
mDOMNode->GetParentNode(getter_AddRefs(parentNode));
|
||||
if (parentNode) {
|
||||
nsCOMPtr<nsIDOMNode> focusedNode;
|
||||
GetFocusedNode(mDOMNode, getter_AddRefs(focusedNode));
|
||||
if (focusedNode == parentNode)
|
||||
*_retval |= STATE_FOCUSED;
|
||||
if (selected) {
|
||||
*_retval |= STATE_CHECKED;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -526,10 +517,15 @@ NS_IMETHODIMP nsXULRadioButtonAccessible::GetParent(nsIAccessible ** aParent)
|
|||
if (! mParent) {
|
||||
nsCOMPtr<nsIAccessible> tempParent;
|
||||
nsAccessible::GetParent(getter_AddRefs(tempParent));
|
||||
if (tempParent)
|
||||
if (tempParent) {
|
||||
tempParent->GetParent(getter_AddRefs(mParent));
|
||||
if (!mParent) {
|
||||
*aParent = nsnull;
|
||||
return NS_ERROR_FAILURE; // Shutting down
|
||||
}
|
||||
}
|
||||
}
|
||||
NS_ASSERTION(mParent,"Whoa! This RadioButtonAcc doesn't have a parent! Better find out why.");
|
||||
|
||||
*aParent = mParent;
|
||||
NS_ADDREF(*aParent);
|
||||
return NS_OK;
|
||||
|
|
Загрузка…
Ссылка в новой задаче