From 3e0c33e5dac0a27bf5313d5529751d602e406f6b Mon Sep 17 00:00:00 2001 From: "aaronl%netscape.com" Date: Wed, 9 Jul 2003 07:01:46 +0000 Subject: [PATCH] Bug 210782. Separate public and private accessibility interfaces. r=kyle, sr=jst --- accessible/build/nsAccessibilityFactory.cpp | 10 ++- accessible/public/Makefile.in | 3 + accessible/public/nsIAccessNode.idl | 2 +- accessible/public/nsIAccessibilityService.idl | 20 +----- accessible/public/nsIAccessible.idl | 62 +++++++++-------- accessible/public/nsIAccessibleDocument.idl | 60 ++++++++++------- accessible/public/nsIAccessibleRetrieval.idl | 67 +++++++++++++++++++ accessible/public/nsPIAccessible.idl | 51 ++++++++++++++ accessible/public/nsPIAccessibleDocument.idl | 50 ++++++++++++++ accessible/src/base/nsAccessNode.cpp | 6 +- .../src/base/nsAccessibilityService.cpp | 45 ++++++------- accessible/src/base/nsAccessibilityService.h | 3 + accessible/src/base/nsAccessible.cpp | 24 ++++--- accessible/src/base/nsAccessible.h | 9 ++- accessible/src/base/nsCaretAccessible.cpp | 2 +- accessible/src/base/nsCaretAccessible.h | 6 +- accessible/src/base/nsDocAccessible.cpp | 22 ++++-- accessible/src/base/nsDocAccessible.h | 3 + accessible/src/base/nsOuterDocAccessible.cpp | 4 +- accessible/src/base/nsRootAccessible.cpp | 58 ++++++++++------ .../src/xul/nsXULFormControlAccessible.cpp | 3 +- 21 files changed, 369 insertions(+), 141 deletions(-) create mode 100644 accessible/public/nsIAccessibleRetrieval.idl create mode 100644 accessible/public/nsPIAccessible.idl create mode 100644 accessible/public/nsPIAccessibleDocument.idl diff --git a/accessible/build/nsAccessibilityFactory.cpp b/accessible/build/nsAccessibilityFactory.cpp index 619676e4bcbc..c6d522130e9a 100644 --- a/accessible/build/nsAccessibilityFactory.cpp +++ b/accessible/build/nsAccessibilityFactory.cpp @@ -43,6 +43,7 @@ #include "nsIServiceManager.h" #include "nsIComponentManager.h" #include "nsIAccessibilityService.h" +#include "nsIAccessibleRetrieval.h" #include "nscore.h" static NS_IMETHODIMP @@ -51,9 +52,9 @@ NS_ConstructAccessibilityService(nsISupports *aOuter, REFNSIID aIID, void **aRes nsresult rv; NS_ASSERTION(aOuter == nsnull, "no aggregation"); nsIAccessibilityService* accessibility; - rv = NS_NewAccessibilityService(&accessibility); + rv = NS_GetAccessibilityService(&accessibility); if (NS_FAILED(rv)) { - NS_ERROR("Unable to construct chrome registry"); + NS_ERROR("Unable to construct accessibility service"); return rv; } rv = accessibility->QueryInterface(aIID, aResult); @@ -70,6 +71,11 @@ static const nsModuleComponentInfo components[] = "@mozilla.org/accessibilityService;1", NS_ConstructAccessibilityService }, + { "AccessibleRetrieval", + NS_ACCESSIBLE_RETRIEVAL_CID, + "@mozilla.org/accessibleRetrieval;1", + NS_ConstructAccessibilityService + }, }; NS_IMPL_NSGETMODULE(nsAccessibilityModule, components); diff --git a/accessible/public/Makefile.in b/accessible/public/Makefile.in index 1dab41080ccd..6ef31fc849c3 100644 --- a/accessible/public/Makefile.in +++ b/accessible/public/Makefile.in @@ -40,9 +40,12 @@ GRE_MODULE = 1 XPIDLSRCS = \ nsIAccessibilityService.idl \ + nsIAccessibleRetrieval.idl \ nsIAccessible.idl \ + nsPIAccessible.idl \ nsIAccessibleCaret.idl \ nsIAccessibleDocument.idl \ + nsPIAccessibleDocument.idl \ nsIAccessibleEventReceiver.idl \ nsIAccessibleProvider.idl \ nsIAccessibleSelectable.idl \ diff --git a/accessible/public/nsIAccessNode.idl b/accessible/public/nsIAccessNode.idl index 90d73cf7d2fb..1c1bd737816e 100644 --- a/accessible/public/nsIAccessNode.idl +++ b/accessible/public/nsIAccessNode.idl @@ -19,8 +19,8 @@ * Portions created by the Initial Developer are Copyright (C) 2003 * the Initial Developer. All Rights Reserved. * - * Contributor(s): * Original Author: Aaron Leventhal (aaronl@netscape.com) + * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or diff --git a/accessible/public/nsIAccessibilityService.idl b/accessible/public/nsIAccessibilityService.idl index 36834cc88013..22df77582126 100644 --- a/accessible/public/nsIAccessibilityService.idl +++ b/accessible/public/nsIAccessibilityService.idl @@ -23,24 +23,17 @@ */ #include "nsISupports.idl" +#include "nsIAccessibleRetrieval.idl" -interface nsIDOMNode; -interface nsIAccessible; -interface nsIAccessibleCaret; -interface nsIWeakReference; interface nsIAccessibleEventListener; interface nsIDocument; -interface nsIPresShell; -interface nsIDOMWindow; -interface nsIAccessNode; interface nsObjectFrame; [scriptable, uuid(68D9720A-0984-42b6-A3F5-8237ED925727)] -interface nsIAccessibilityService : nsISupports +interface nsIAccessibilityService : nsIAccessibleRetrieval { nsIAccessible createOuterDocAccessible(in nsIDOMNode aNode); nsIAccessible createRootAccessible(in nsIPresShell aShell, in nsIDocument aDocument); - nsIAccessibleCaret createCaretAccessible(in nsIDOMNode aNode, in nsIAccessible aRootAccessible); nsIAccessible createHTML4ButtonAccessible(in nsISupports aFrame); nsIAccessible createHTMLAreaAccessible(in nsIWeakReference aPresShell, in nsIDOMNode aDOMNode, in nsIAccessible aAccParent); @@ -98,13 +91,6 @@ interface nsIAccessibilityService : nsISupports nsIAccessible createXULToolbarAccessible(in nsIDOMNode aNode); nsIAccessible createXULToolbarSeparatorAccessible(in nsIDOMNode aNode); nsIAccessible createXULTooltipAccessible(in nsIDOMNode aNode); - - nsIAccessible getAccessibleFor(in nsIDOMNode aNode); - nsIAccessible getAccessibleInWindow(in nsIDOMNode aNode, in nsIDOMWindow aDOMWin); - nsIAccessible getAccessibleInWeakShell(in nsIDOMNode aNode, in nsIWeakReference aPresShell); - nsIAccessible getAccessibleInShell(in nsIDOMNode aNode, in nsIPresShell aPresShell); - [noscript] nsIAccessNode getCachedAccessNode(in nsIDOMNode aNode, in nsIWeakReference aShell); - [noscript] nsIAccessible getCachedAccessible(in nsIDOMNode aNode, in nsIWeakReference aShell); }; @@ -116,6 +102,6 @@ interface nsIAccessibilityService : nsISupports { 0xde401c37, 0x9a7f, 0x4278, { 0xa6, 0xf8, 0x3d, 0xe2, 0x83, 0x39, 0x89, 0xef } } extern nsresult -NS_NewAccessibilityService(nsIAccessibilityService** aResult); +NS_GetAccessibilityService(nsIAccessibilityService** aResult); %} diff --git a/accessible/public/nsIAccessible.idl b/accessible/public/nsIAccessible.idl index c76a5ae63964..49f0b2706dd0 100644 --- a/accessible/public/nsIAccessible.idl +++ b/accessible/public/nsIAccessible.idl @@ -1,28 +1,41 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 2003 + * the Initial Developer. All Rights Reserved. * - * The contents of this file are subject to the Mozilla Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is the Mozilla browser. - * - * The Initial Developer of the Original Code is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1999 Netscape Communications Corporation. All - * Rights Reserved. - * * Original Author: Eric D Vaughan (evaughan@netscape.com) - * - * Contributor(s): - * Aaron Leventhal - * John Gaunt - */ + * Contributor(s): Aaron Leventhal (aaronl@netscape.com) + * John Gaunt (jgaunt@netscape.com) + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ #include "nsISupports.idl" #include "nsIDOMNode.idl" @@ -77,11 +90,6 @@ interface nsIAccessible : nsISupports nsIDOMNode accGetDOMNode(); - [noscript] void setAccParent(in nsIAccessible aAccParent); - [noscript] void setAccFirstChild(in nsIAccessible aAccFirstChild); - [noscript] void setAccNextSibling(in nsIAccessible aAccNextSibling); - [noscript] void invalidateChildren(); - [noscript] void fireToolkitEvent(in unsigned long aEvent, in nsIAccessible aTarget, in voidPtr aData); [noscript] void getNativeInterface(out voidPtr aOutAccessible); // MSAA State flags - used for bitfield. More than 1 allowed. diff --git a/accessible/public/nsIAccessibleDocument.idl b/accessible/public/nsIAccessibleDocument.idl index 96d9e295df41..6730e66b3b24 100644 --- a/accessible/public/nsIAccessibleDocument.idl +++ b/accessible/public/nsIAccessibleDocument.idl @@ -1,27 +1,40 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * - * The contents of this file are subject to the Mozilla Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is the Mozilla browser. - * - * The Initial Developer of the Original Code is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1999 Netscape Communications Corporation. All - * Rights Reserved. - * - * Original Author: Aaron Leventhal - * - * Contributor(s): - * John Gaunt - */ + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 2002 + * the Initial Developer. All Rights Reserved. + * + * Original Author: Aaron Leventhal (aaronl@netscape.com) + * Contributor(s): John Gaunt (jgaunt@netscape.com) + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ #include "nsISupports.idl" @@ -46,8 +59,5 @@ interface nsIAccessibleDocument : nsISupports readonly attribute nsIAccessibleCaret caretAccessible; [noscript] readonly attribute voidPtr windowHandle; [noscript] nsIAccessNode getCachedAccessNode(in voidPtr aUniqueID); - [noscript] void invalidateCacheSubtree(in nsIDOMNode aStartNode); [noscript] nsIAccessible getAccessibleInParentChain(in nsIDOMNode aDOMNode); - [noscript] void cacheAccessNode(in voidPtr aUniqueID, in nsIAccessNode aAccessNode); - [noscript] void destroy(); }; diff --git a/accessible/public/nsIAccessibleRetrieval.idl b/accessible/public/nsIAccessibleRetrieval.idl new file mode 100644 index 000000000000..7d4d09f4f3d7 --- /dev/null +++ b/accessible/public/nsIAccessibleRetrieval.idl @@ -0,0 +1,67 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 2003 + * the Initial Developer. All Rights Reserved. + * + * Original Author: Aaron Leventhal (aaronl@netscape.com) + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include "nsISupports.idl" + +interface nsIDOMNode; +interface nsIAccessible; +interface nsIWeakReference; +interface nsIPresShell; +interface nsIDOMWindow; +interface nsIAccessNode; + +[scriptable, uuid(663CA4A8-D219-4000-925D-D8F66406B626)] +interface nsIAccessibleRetrieval : nsISupports +{ + nsIAccessible getAccessibleFor(in nsIDOMNode aNode); + nsIAccessible getAccessibleInWindow(in nsIDOMNode aNode, in nsIDOMWindow aDOMWin); + nsIAccessible getAccessibleInWeakShell(in nsIDOMNode aNode, in nsIWeakReference aPresShell); + nsIAccessible getAccessibleInShell(in nsIDOMNode aNode, in nsIPresShell aPresShell); + nsIAccessNode getCachedAccessNode(in nsIDOMNode aNode, in nsIWeakReference aShell); + nsIAccessible getCachedAccessible(in nsIDOMNode aNode, in nsIWeakReference aShell); +}; + + +%{ C++ + +// for component registration +// {663CA4A8-D219-4000-925D-D8F66406B626} +#define NS_ACCESSIBLE_RETRIEVAL_CID \ +{ 0x663ca4a8, 0xd219, 0x4000, { 0x92, 0x5d, 0xd8, 0xf6, 0x64, 0x6, 0xb6, 0x26 } } + +%} diff --git a/accessible/public/nsPIAccessible.idl b/accessible/public/nsPIAccessible.idl new file mode 100644 index 000000000000..4ce27ebb8f1d --- /dev/null +++ b/accessible/public/nsPIAccessible.idl @@ -0,0 +1,51 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 2003 + * the Initial Developer. All Rights Reserved. + * + * Original Author: Aaron Leventhal (aaronl@netscape.com) + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include "nsISupports.idl" + +interface nsIAccessible; + +[scriptable, uuid(52F1BE88-84F7-4f7f-B31C-062AFE7DF15D)] +interface nsPIAccessible : nsISupports +{ + [noscript] void setAccParent(in nsIAccessible aAccParent); + [noscript] void setAccFirstChild(in nsIAccessible aAccFirstChild); + [noscript] void setAccNextSibling(in nsIAccessible aAccNextSibling); + [noscript] void invalidateChildren(); + [noscript] void fireToolkitEvent(in unsigned long aEvent, in nsIAccessible aTarget, in voidPtr aData); +}; diff --git a/accessible/public/nsPIAccessibleDocument.idl b/accessible/public/nsPIAccessibleDocument.idl new file mode 100644 index 000000000000..e1a67401887d --- /dev/null +++ b/accessible/public/nsPIAccessibleDocument.idl @@ -0,0 +1,50 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 2003 + * the Initial Developer. All Rights Reserved. + * + * Original Author: Aaron Leventhal (aaronl@netscape.com) + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include "nsISupports.idl" + +interface nsIAccessNode; +interface nsIDOMNode; + +[scriptable, uuid(F0809603-74E8-4284-8366-B293A5D0B758)] +interface nsPIAccessibleDocument : nsISupports +{ + [noscript] void invalidateCacheSubtree(in nsIDOMNode aStartNode); + [noscript] void cacheAccessNode(in voidPtr aUniqueID, in nsIAccessNode aAccessNode); + [noscript] void destroy(); +}; diff --git a/accessible/src/base/nsAccessNode.cpp b/accessible/src/base/nsAccessNode.cpp index 1c564d9ddfc6..469e19323246 100755 --- a/accessible/src/base/nsAccessNode.cpp +++ b/accessible/src/base/nsAccessNode.cpp @@ -42,6 +42,7 @@ #include "nsHashtable.h" #include "nsIAccessibilityService.h" #include "nsIAccessibleDocument.h" +#include "nsPIAccessibleDocument.h" #include "nsIDocument.h" #include "nsIDOMCSSStyleDeclaration.h" #include "nsIDOMElement.h" @@ -136,7 +137,10 @@ NS_IMETHODIMP nsAccessNode::Init() } void* uniqueID; GetUniqueID(&uniqueID); - docAccessible->CacheAccessNode(uniqueID, this); + nsCOMPtr privateDocAccessible = + do_QueryInterface(docAccessible); + NS_ASSERTION(privateDocAccessible, "No private docaccessible for docaccessible"); + privateDocAccessible->CacheAccessNode(uniqueID, this); #ifdef DEBUG mIsInitialized = PR_TRUE; #endif diff --git a/accessible/src/base/nsAccessibilityService.cpp b/accessible/src/base/nsAccessibilityService.cpp index be045eb0fd92..7aedb64268a9 100644 --- a/accessible/src/base/nsAccessibilityService.cpp +++ b/accessible/src/base/nsAccessibilityService.cpp @@ -101,6 +101,8 @@ #include "nsXULTreeAccessibleWrap.h" #endif +nsAccessibilityService *nsAccessibilityService::gAccessibilityService = nsnull; + /** * nsAccessibilityService */ @@ -123,10 +125,11 @@ nsAccessibilityService::nsAccessibilityService() nsAccessibilityService::~nsAccessibilityService() { + nsAccessibilityService::gAccessibilityService = nsnull; nsAccessNodeWrap::ShutdownAccessibility(); } -NS_IMPL_THREADSAFE_ISUPPORTS4(nsAccessibilityService, nsIAccessibilityService, +NS_IMPL_THREADSAFE_ISUPPORTS5(nsAccessibilityService, nsIAccessibilityService, nsIAccessibleRetrieval, nsIObserver, nsIWebProgressListener, nsISupportsWeakReference); // nsIObserver @@ -242,7 +245,8 @@ nsAccessibilityService::GetInfo(nsISupports* aFrame, nsIFrame** aRealFrame, nsIW nsresult nsAccessibilityService::GetShellFromNode(nsIDOMNode *aNode, nsIWeakReference **aWeakShell) -{ nsCOMPtr domDoc; +{ + nsCOMPtr domDoc; aNode->GetOwnerDocument(getter_AddRefs(domDoc)); nsCOMPtr doc(do_QueryInterface(domDoc)); if (!doc) @@ -328,22 +332,6 @@ nsAccessibilityService::CreateRootAccessible(nsIPresShell *aShell, return NS_OK; } -NS_IMETHODIMP -nsAccessibilityService::CreateCaretAccessible(nsIDOMNode *aNode, - nsIAccessible *aRootAccessible, - nsIAccessibleCaret **_retval) -{ - nsCOMPtr weakShell; - GetShellFromNode(aNode, getter_AddRefs(weakShell)); - - *_retval = new nsCaretAccessible(aNode, weakShell, aRootAccessible); - if (! *_retval) - return NS_ERROR_OUT_OF_MEMORY; - - NS_ADDREF(*_retval); - return NS_OK; -} - /** * HTML widget creation */ @@ -1708,19 +1696,28 @@ nsresult nsAccessibilityService::GetAccessible(nsIDOMNode *aNode, ////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// -nsresult -NS_NewAccessibilityService(nsIAccessibilityService** aResult) +nsresult +nsAccessibilityService::GetAccessibilityService(nsIAccessibilityService** aResult) { NS_PRECONDITION(aResult != nsnull, "null ptr"); if (! aResult) return NS_ERROR_NULL_POINTER; - nsAccessibilityService* accService = new nsAccessibilityService(); - if (!accService) + *aResult = nsnull; + if (!nsAccessibilityService::gAccessibilityService) { + gAccessibilityService = new nsAccessibilityService(); + if (!gAccessibilityService ) { return NS_ERROR_OUT_OF_MEMORY; - NS_ADDREF(accService); - *aResult = accService; + } + } + *aResult = nsAccessibilityService::gAccessibilityService; + NS_ADDREF(*aResult); return NS_OK; } +nsresult +NS_GetAccessibilityService(nsIAccessibilityService** aResult) +{ + return nsAccessibilityService::GetAccessibilityService(aResult); +} diff --git a/accessible/src/base/nsAccessibilityService.h b/accessible/src/base/nsAccessibilityService.h index 976372afb128..3772072e1559 100644 --- a/accessible/src/base/nsAccessibilityService.h +++ b/accessible/src/base/nsAccessibilityService.h @@ -62,11 +62,13 @@ public: virtual ~nsAccessibilityService(); NS_DECL_ISUPPORTS + NS_DECL_NSIACCESSIBLERETRIEVAL NS_DECL_NSIACCESSIBILITYSERVICE NS_DECL_NSIOBSERVER NS_DECL_NSIWEBPROGRESSLISTENER static nsresult GetShellFromNode(nsIDOMNode *aNode, nsIWeakReference **weakShell); + static nsresult GetAccessibilityService(nsIAccessibilityService** aResult); private: nsresult GetInfo(nsISupports* aFrame, nsIFrame** aRealFrame, nsIWeakReference** aShell, nsIDOMNode** aContent); @@ -74,6 +76,7 @@ private: nsIContent* FindContentForDocShell(nsIPresShell* aPresShell, nsIContent* aContent, nsIDocShell* aDocShell); nsresult GetAccessible(nsIDOMNode *aNode, nsIPresShell *aPresShell, nsIWeakReference *aWeakShell, nsIAccessible **aAccessible); + static nsAccessibilityService *gAccessibilityService; }; #endif /* __nsIAccessibilityService_h__ */ diff --git a/accessible/src/base/nsAccessible.cpp b/accessible/src/base/nsAccessible.cpp index 1e613c642307..4aa7db0621e5 100644 --- a/accessible/src/base/nsAccessible.cpp +++ b/accessible/src/base/nsAccessible.cpp @@ -96,7 +96,7 @@ //----------------------------------------------------- // construction //----------------------------------------------------- -NS_IMPL_ISUPPORTS_INHERITED1(nsAccessible, nsAccessNode, nsIAccessible) +NS_IMPL_ISUPPORTS_INHERITED2(nsAccessible, nsAccessNode, nsIAccessible, nsPIAccessible) nsAccessible::nsAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell): nsAccessNodeWrap(aNode, aShell), mParent(nsnull), mFirstChild(nsnull), mNextSibling(nsnull) @@ -217,7 +217,8 @@ NS_IMETHODIMP nsAccessible::Shutdown() if (mFirstChild) { nsCOMPtr current(mFirstChild), next; while (current) { - current->SetAccParent(nsnull); + nsCOMPtr privateAcc(do_QueryInterface(current)); + privateAcc->SetAccParent(nsnull); current->GetAccNextSibling(getter_AddRefs(next)); current = next; } @@ -225,7 +226,8 @@ NS_IMETHODIMP nsAccessible::Shutdown() // Now invalidate the child count and pointers to other accessibles InvalidateChildren(); if (mParent) { - mParent->InvalidateChildren(); + nsCOMPtr privateParent(do_QueryInterface(mParent)); + privateParent->InvalidateChildren(); mParent = nsnull; } @@ -287,7 +289,8 @@ NS_IMETHODIMP nsAccessible::GetAccNextSibling(nsIAccessible * *aAccNextSibling) if (NS_SUCCEEDED(walker.GetNextSibling())) { *aAccNextSibling = walker.mState.accessible; NS_ADDREF(*aAccNextSibling); - (*aAccNextSibling)->SetAccParent(mParent); + nsCOMPtr privateAcc(do_QueryInterface(*aAccNextSibling)); + privateAcc->SetAccParent(mParent); mNextSibling = *aAccNextSibling; } @@ -314,7 +317,8 @@ NS_IMETHODIMP nsAccessible::GetAccPreviousSibling(nsIAccessible * *aAccPreviousS *aAccPreviousSibling = walker.mState.accessible; NS_ADDREF(*aAccPreviousSibling); // Use last walker state to cache data on prev accessible - (*aAccPreviousSibling)->SetAccParent(mParent); + nsCOMPtr privateAcc(do_QueryInterface(*aAccPreviousSibling)); + privateAcc->SetAccParent(mParent); } return NS_OK; @@ -377,16 +381,16 @@ void nsAccessible::CacheChildren(PRBool aWalkAnonContent) if (mAccChildCount == eChildCountUninitialized) { nsAccessibleTreeWalker walker(mWeakShell, mDOMNode, aWalkAnonContent); - nsCOMPtr prevAccessible; + nsCOMPtr privatePrevAccessible; mAccChildCount = 0; walker.GetFirstChild(); SetAccFirstChild(walker.mState.accessible); while (walker.mState.accessible) { - walker.mState.accessible->SetAccParent(this); ++mAccChildCount; - prevAccessible = walker.mState.accessible; + privatePrevAccessible = do_QueryInterface(walker.mState.accessible); + privatePrevAccessible->SetAccParent(this); walker.GetNextSibling(); - prevAccessible->SetAccNextSibling(walker.mState.accessible); + privatePrevAccessible->SetAccNextSibling(walker.mState.accessible); } } } @@ -1352,7 +1356,7 @@ NS_IMETHODIMP nsAccessible::FireToolkitEvent(PRUint32 aEvent, nsIAccessible *aTa if (!mWeakShell) return NS_ERROR_FAILURE; // Don't fire event for accessible that has been shut down nsCOMPtr docAccessible(GetDocAccessible()); - nsCOMPtr eventHandlingAccessible(do_QueryInterface(docAccessible)); + nsCOMPtr eventHandlingAccessible(do_QueryInterface(docAccessible)); if (eventHandlingAccessible) { return eventHandlingAccessible->FireToolkitEvent(aEvent, aTarget, aData); } diff --git a/accessible/src/base/nsAccessible.h b/accessible/src/base/nsAccessible.h index 3a176d9efee7..6b1e083637f8 100644 --- a/accessible/src/base/nsAccessible.h +++ b/accessible/src/base/nsAccessible.h @@ -33,8 +33,7 @@ * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under - * the terms of any one of the NPL, the GPL or the LGPL. - * + * the terms of any one of the NPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #ifndef _nsAccessible_H_ @@ -42,6 +41,7 @@ #include "nsAccessNodeWrap.h" #include "nsIAccessible.h" +#include "nsPIAccessible.h" #include "nsWeakReference.h" #include "nsIDOMNodeList.h" #include "nsString.h" @@ -56,7 +56,9 @@ class nsIAtom; // When mNextSibling is set to this, it indicates there ar eno more siblings #define DEAD_END_ACCESSIBLE NS_STATIC_CAST(nsIAccessible*, (void*)1) -class nsAccessible : public nsAccessNodeWrap, public nsIAccessible +class nsAccessible : public nsAccessNodeWrap, + public nsIAccessible, + public nsPIAccessible { public: // to eliminate the confusion of "magic numbers" -- if ( 0 ){ foo; } @@ -69,6 +71,7 @@ public: NS_DECL_ISUPPORTS_INHERITED NS_DECL_NSIACCESSIBLE + NS_DECL_NSPIACCESSIBLE NS_IMETHOD GetFocusedNode(nsIDOMNode **aFocusedNode); diff --git a/accessible/src/base/nsCaretAccessible.cpp b/accessible/src/base/nsCaretAccessible.cpp index 58d6a7f5eed3..3360072bf3ab 100644 --- a/accessible/src/base/nsCaretAccessible.cpp +++ b/accessible/src/base/nsCaretAccessible.cpp @@ -60,7 +60,7 @@ NS_IMPL_ISUPPORTS_INHERITED2(nsCaretAccessible, nsLeafAccessible, nsIAccessibleCaret, nsISelectionListener) -nsCaretAccessible::nsCaretAccessible(nsIDOMNode* aDocumentNode, nsIWeakReference* aShell, nsIAccessible *aRootAccessible): +nsCaretAccessible::nsCaretAccessible(nsIDOMNode* aDocumentNode, nsIWeakReference* aShell, nsRootAccessible *aRootAccessible): nsLeafAccessible(aDocumentNode, aShell), mVisible(PR_TRUE), mCurrentDOMNode(nsnull), mRootAccessible(aRootAccessible) { } diff --git a/accessible/src/base/nsCaretAccessible.h b/accessible/src/base/nsCaretAccessible.h index 2e1413f404a9..3a0d5046ba8a 100644 --- a/accessible/src/base/nsCaretAccessible.h +++ b/accessible/src/base/nsCaretAccessible.h @@ -45,6 +45,8 @@ #include "nsISelectionListener.h" #include "nsRect.h" +class nsRootAccessible; + /* * This special accessibility class is for the caret, which is really the currently focused selection. * There is only 1 visible caret per top level window (nsRootAccessible) @@ -59,7 +61,7 @@ class nsCaretAccessible : public nsLeafAccessible, public nsIAccessibleCaret, pu public: NS_DECL_ISUPPORTS_INHERITED - nsCaretAccessible(nsIDOMNode* aDocumentNode, nsIWeakReference* aShell, nsIAccessible *aRootAccessible); + nsCaretAccessible(nsIDOMNode* aDocumentNode, nsIWeakReference* aShell, nsRootAccessible *aRootAccessible); /* ----- nsIAccessible ----- */ NS_IMETHOD GetAccParent(nsIAccessible **_retval); @@ -85,7 +87,7 @@ private: nsCOMPtr mCurrentDOMNode; // mListener is not a com pointer. It's a copy of the listener in the nsRootAccessible owner. //See nsRootAccessible.h for details of the lifetime if this listener - nsIAccessible *mRootAccessible; + nsRootAccessible *mRootAccessible; nsCOMPtr mDomSelectionWeak; }; diff --git a/accessible/src/base/nsDocAccessible.cpp b/accessible/src/base/nsDocAccessible.cpp index 78ec8eaec904..774c2e4fc15e 100644 --- a/accessible/src/base/nsDocAccessible.cpp +++ b/accessible/src/base/nsDocAccessible.cpp @@ -121,6 +121,7 @@ nsDocAccessible::~nsDocAccessible() NS_INTERFACE_MAP_BEGIN(nsDocAccessible) NS_INTERFACE_MAP_ENTRY(nsIAccessibleDocument) + NS_INTERFACE_MAP_ENTRY(nsPIAccessibleDocument) NS_INTERFACE_MAP_ENTRY(nsIAccessibleEventReceiver) NS_INTERFACE_MAP_ENTRY(nsIWebProgressListener) NS_INTERFACE_MAP_ENTRY(nsIDOMMutationListener) @@ -356,9 +357,10 @@ NS_IMETHODIMP nsDocAccessible::Init() // It should be changed to use GetAccessibleInWeakShell() nsCOMPtr accParent; accService->GetAccessibleFor(ownerNode, getter_AddRefs(accParent)); - if (accParent) { + nsCOMPtr privateAccParent(do_QueryInterface(accParent)); + if (privateAccParent) { SetAccParent(accParent); - accParent->SetAccFirstChild(this); + privateAccParent->SetAccFirstChild(this); } } } @@ -968,6 +970,11 @@ nsDocAccessible::GetAccessibleInParentChain(nsIDOMNode *aNode, NS_ASSERTION(parentNode, "Impossible! Crawled up parent chain without " "finding accessible. There should have at least " "been a document accessible at the root."); + if (!parentNode) { + // XXX Todo We need to figure out why this is happening. + // For now, return safely. + return NS_ERROR_FAILURE; + } currentNode = parentNode; } @@ -1001,8 +1008,10 @@ void nsDocAccessible::HandleMutationEvent(nsIDOMEvent *aEvent, PRUint32 aAccessi nsCOMPtr docAccessible; GetEventDocAccessible(subTreeToInvalidate, getter_AddRefs(docAccessible)); + nsCOMPtr privateDocAccessible = + do_QueryInterface(docAccessible); - docAccessible->InvalidateCacheSubtree(subTreeToInvalidate); + privateDocAccessible->InvalidateCacheSubtree(subTreeToInvalidate); // We need to get an accessible for the mutation event's target node // If there is no accessible for that node, we need to keep moving up the parent @@ -1013,13 +1022,16 @@ void nsDocAccessible::HandleMutationEvent(nsIDOMEvent *aEvent, PRUint32 aAccessi nsCOMPtr accessible; docAccessible->GetAccessibleInParentChain(targetNode, getter_AddRefs(accessible)); - accessible->InvalidateChildren(); + nsCOMPtr privateAccessible(do_QueryInterface(accessible)); + if (!privateAccessible) + return; + privateAccessible->InvalidateChildren(); #ifdef XP_WIN // Windows MSAA clients crash if they listen to create or destroy events aAccessibleEventType = nsIAccessibleEventReceiver::EVENT_REORDER; #endif - accessible->FireToolkitEvent(aAccessibleEventType, accessible, nsnull); + privateAccessible->FireToolkitEvent(aAccessibleEventType, accessible, nsnull); } NS_IMETHODIMP nsDocAccessible::FireToolkitEvent(PRUint32 aEvent, nsIAccessible* aAccessible, void* aData) diff --git a/accessible/src/base/nsDocAccessible.h b/accessible/src/base/nsDocAccessible.h index bde0f4be4853..8fb67757f89a 100644 --- a/accessible/src/base/nsDocAccessible.h +++ b/accessible/src/base/nsDocAccessible.h @@ -41,6 +41,7 @@ #include "nsBaseWidgetAccessible.h" #include "nsIAccessibleDocument.h" +#include "nsPIAccessibleDocument.h" #include "nsIAccessibleEventReceiver.h" #include "nsIDocument.h" #include "nsIDOMMutationListener.h" @@ -58,6 +59,7 @@ const PRUint32 kDefaultCacheSize = 256; class nsDocAccessible : public nsBlockAccessible, public nsIAccessibleDocument, + public nsPIAccessibleDocument, public nsIAccessibleEventReceiver, public nsIWebProgressListener, public nsIObserver, @@ -69,6 +71,7 @@ class nsDocAccessible : public nsBlockAccessible, NS_DECL_ISUPPORTS_INHERITED NS_DECL_NSIACCESSIBLEDOCUMENT + NS_DECL_NSPIACCESSIBLEDOCUMENT NS_DECL_NSIACCESSIBLEEVENTRECEIVER NS_DECL_NSIOBSERVER diff --git a/accessible/src/base/nsOuterDocAccessible.cpp b/accessible/src/base/nsOuterDocAccessible.cpp index 0921294473d3..54f46196fafe 100644 --- a/accessible/src/base/nsOuterDocAccessible.cpp +++ b/accessible/src/base/nsOuterDocAccessible.cpp @@ -123,5 +123,7 @@ NS_IMETHODIMP nsOuterDocAccessible::Init() NS_ENSURE_TRUE(innerAccessible, NS_ERROR_FAILURE); SetAccFirstChild(innerAccessible); // weak ref - return innerAccessible->SetAccParent(this); + nsCOMPtr privateInnerAccessible = + do_QueryInterface(innerAccessible); + return privateInnerAccessible->SetAccParent(this); } diff --git a/accessible/src/base/nsRootAccessible.cpp b/accessible/src/base/nsRootAccessible.cpp index 40e055ad08b9..9c484c329c46 100644 --- a/accessible/src/base/nsRootAccessible.cpp +++ b/accessible/src/base/nsRootAccessible.cpp @@ -39,6 +39,7 @@ // NOTE: alphabetically ordered #include "nsAccessibilityService.h" #include "nsAccessibleEventData.h" +#include "nsCaretAccessible.h" #include "nsHTMLSelectAccessible.h" #include "nsIAccessibleCaret.h" #include "nsIChromeEventHandler.h" @@ -206,7 +207,7 @@ NS_IMETHODIMP nsRootAccessible::AddEventListeners() } if (!mCaretAccessible) - mAccService->CreateCaretAccessible(mDOMNode, this, getter_AddRefs(mCaretAccessible)); + mCaretAccessible = new nsCaretAccessible(mDOMNode, mWeakShell, this); return NS_OK; } @@ -254,7 +255,8 @@ NS_IMETHODIMP nsRootAccessible::GetCaretAccessible(nsIAccessibleCaret **aCaretAc void nsRootAccessible::FireAccessibleFocusEvent(nsIAccessible *focusAccessible, nsIDOMNode *focusNode) { if (focusAccessible && focusNode && gLastFocusedNode != focusNode) { - focusAccessible->FireToolkitEvent(nsIAccessibleEventReceiver::EVENT_FOCUS, focusAccessible, nsnull); + nsCOMPtr privateFocusAcc(do_QueryInterface(focusAccessible)); + privateFocusAcc->FireToolkitEvent(nsIAccessibleEventReceiver::EVENT_FOCUS, focusAccessible, nsnull); NS_IF_RELEASE(gLastFocusedNode); PRUint32 role = ROLE_NOTHING; focusAccessible->GetAccRole(&role); @@ -355,21 +357,26 @@ NS_IMETHODIMP nsRootAccessible::HandleEvent(nsIDOMEvent* aEvent) nsAutoString eventType; aEvent->GetType(eventType); + nsCOMPtr privAcc(do_QueryInterface(accessible)); #ifndef MOZ_ACCESSIBILITY_ATK #ifdef MOZ_XUL // tree event - if (treeItemAccessible && - (eventType.EqualsIgnoreCase("DOMMenuItemActive") || eventType.EqualsIgnoreCase("select"))) { - treeItemAccessible->FireToolkitEvent(nsIAccessibleEventReceiver::EVENT_FOCUS, treeItemAccessible, nsnull); + if (treeItemAccessible && (eventType.EqualsIgnoreCase("DOMMenuItemActive") || + eventType.EqualsIgnoreCase("select"))) { + privAcc = do_QueryInterface(treeItemAccessible); + privAcc->FireToolkitEvent(nsIAccessibleEventReceiver::EVENT_FOCUS, + treeItemAccessible, nsnull); return NS_OK; } #endif - + if (eventType.EqualsIgnoreCase("unload")) { - nsCOMPtr accDoc(do_QueryInterface(accessible)); - NS_ASSERTION(accDoc, "No document for unload event target"); - accDoc->Destroy(); + nsCOMPtr privateAccDoc = + do_QueryInterface(accessible); + if (privateAccDoc) { + privateAccDoc->Destroy(); + } } else if (eventType.EqualsIgnoreCase("focus") || eventType.EqualsIgnoreCase("DOMMenuItemActive")) { @@ -390,24 +397,27 @@ NS_IMETHODIMP nsRootAccessible::HandleEvent(nsIDOMEvent* aEvent) FireAccessibleFocusEvent(accessible, targetNode); } else if (eventType.EqualsIgnoreCase("CheckboxStateChange")) { - accessible->FireToolkitEvent(nsIAccessibleEventReceiver::EVENT_STATE_CHANGE, accessible, nsnull); + privAcc->FireToolkitEvent(nsIAccessibleEventReceiver::EVENT_STATE_CHANGE, + accessible, nsnull); } else if (eventType.EqualsIgnoreCase("RadioStateChange") ) { // first the XUL radio buttons if (targetNode && NS_SUCCEEDED(mAccService->GetAccessibleInShell(targetNode, eventShell, getter_AddRefs(accessible)))) { - accessible->FireToolkitEvent(nsIAccessibleEventReceiver::EVENT_STATE_CHANGE, accessible, nsnull); + privAcc->FireToolkitEvent(nsIAccessibleEventReceiver::EVENT_STATE_CHANGE, + accessible, nsnull); FireAccessibleFocusEvent(accessible, targetNode); } else { // for the html radio buttons -- apparently the focus code just works. :-) - accessible->FireToolkitEvent(nsIAccessibleEventReceiver::EVENT_STATE_CHANGE, accessible, nsnull); + privAcc->FireToolkitEvent(nsIAccessibleEventReceiver::EVENT_STATE_CHANGE, + accessible, nsnull); } } else if (eventType.EqualsIgnoreCase("DOMMenuBarActive")) - accessible->FireToolkitEvent(nsIAccessibleEventReceiver::EVENT_MENUSTART, accessible, nsnull); + privAcc->FireToolkitEvent(nsIAccessibleEventReceiver::EVENT_MENUSTART, accessible, nsnull); else if (eventType.EqualsIgnoreCase("DOMMenuBarInactive")) { - accessible->FireToolkitEvent(nsIAccessibleEventReceiver::EVENT_MENUEND, accessible, nsnull); + privAcc->FireToolkitEvent(nsIAccessibleEventReceiver::EVENT_MENUEND, accessible, nsnull); GetAccFocused(getter_AddRefs(accessible)); if (accessible) { accessible->AccGetDOMNode(getter_AddRefs(targetNode)); @@ -425,20 +435,24 @@ NS_IMETHODIMP nsRootAccessible::HandleEvent(nsIDOMEvent* aEvent) PRUint32 role = ROLE_NOTHING; accessible->GetAccRole(&role); if (role == ROLE_MENUPOPUP) - accessible->FireToolkitEvent(menuEvent, accessible, nsnull); + privAcc->FireToolkitEvent(menuEvent, accessible, nsnull); } } #else AtkStateChange stateData; - if (eventType.EqualsIgnoreCase("focus") || eventType.EqualsIgnoreCase("DOMMenuItemActive")) { - if (treeItemAccessible) // use focused treeitem - treeItemAccessible->FireToolkitEvent(nsIAccessibleEventReceiver::EVENT_FOCUS, treeItemAccessible, nsnull); + if (eventType.EqualsIgnoreCase("focus") || + eventType.EqualsIgnoreCase("DOMMenuItemActive")) { + if (treeItemAccessible) { // use focused treeitem + privAcc = do_QueryInterface(treeItemAccessible); + privAcc->FireToolkitEvent(nsIAccessibleEventReceiver::EVENT_FOCUS, + treeItemAccessible, nsnull); + } else if (anchorElement) { nsCOMPtr hyperText(do_QueryInterface(accessible)); if (hyperText) { PRInt32 selectedLink; hyperText->GetSelectedLinkIndex(&selectedLink); - accessible->FireToolkitEvent(nsIAccessibleEventReceiver::EVENT_ATK_LINK_SELECTED, accessible, &selectedLink); + privAcc->FireToolkitEvent(nsIAccessibleEventReceiver::EVENT_ATK_LINK_SELECTED, accessible, &selectedLink); } } else if (optionTargetNode && // use focused option @@ -451,14 +465,16 @@ NS_IMETHODIMP nsRootAccessible::HandleEvent(nsIDOMEvent* aEvent) else if (eventType.EqualsIgnoreCase("select")) { if (treeBox && treeIndex >= 0) // it's a XUL // use EVENT_FOCUS instead of EVENT_ATK_SELECTION_CHANGE - treeItemAccessible->FireToolkitEvent(nsIAccessibleEventReceiver::EVENT_FOCUS, treeItemAccessible, nsnull); + privAcc = do_QueryInterface(treeItemAccessible); + privAcc->FireToolkitEvent(nsIAccessibleEventReceiver::EVENT_FOCUS, + treeItemAccessible, nsnull); } else if (eventType.EqualsIgnoreCase("CheckboxStateChange") || // it's a XUL eventType.EqualsIgnoreCase("RadioStateChange")) { // it's a XUL accessible->GetAccState(&stateData.state); stateData.enable = (stateData.state & STATE_CHECKED) != 0; stateData.state = STATE_CHECKED; - accessible->FireToolkitEvent(nsIAccessibleEventReceiver::EVENT_STATE_CHANGE, accessible, &stateData); + privAcc->FireToolkitEvent(nsIAccessibleEventReceiver::EVENT_STATE_CHANGE, accessible, &stateData); if (eventType.EqualsIgnoreCase("RadioStateChange")) { FireAccessibleFocusEvent(accessible, targetNode); } diff --git a/accessible/src/xul/nsXULFormControlAccessible.cpp b/accessible/src/xul/nsXULFormControlAccessible.cpp index 04c44d24ef9b..1e41bab575b6 100644 --- a/accessible/src/xul/nsXULFormControlAccessible.cpp +++ b/accessible/src/xul/nsXULFormControlAccessible.cpp @@ -171,7 +171,8 @@ NS_IMETHODIMP nsXULButtonAccessible::GetAccFirstChild(nsIAccessible **aResult) PRUint32 role; if (NS_SUCCEEDED(walker.mState.accessible->GetAccRole(&role)) && role == ROLE_PUSHBUTTON) { mFirstChild = walker.mState.accessible; - mFirstChild->SetAccNextSibling(nsnull); + nsCOMPtr privChildAcc = do_QueryInterface(mFirstChild); + privChildAcc->SetAccNextSibling(nsnull); } } }