зеркало из https://github.com/mozilla/pjs.git
Bug 210782. Separate public and private accessibility interfaces. r=kyle, sr=jst
This commit is contained in:
Родитель
c94df0d9d2
Коммит
2003aecfd7
|
@ -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);
|
||||
|
|
|
@ -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 \
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
||||
%}
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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();
|
||||
};
|
||||
|
|
|
@ -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 } }
|
||||
|
||||
%}
|
|
@ -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);
|
||||
};
|
|
@ -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();
|
||||
};
|
|
@ -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<nsPIAccessibleDocument> privateDocAccessible =
|
||||
do_QueryInterface(docAccessible);
|
||||
NS_ASSERTION(privateDocAccessible, "No private docaccessible for docaccessible");
|
||||
privateDocAccessible->CacheAccessNode(uniqueID, this);
|
||||
#ifdef DEBUG
|
||||
mIsInitialized = PR_TRUE;
|
||||
#endif
|
||||
|
|
|
@ -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<nsIDOMDocument> domDoc;
|
||||
{
|
||||
nsCOMPtr<nsIDOMDocument> domDoc;
|
||||
aNode->GetOwnerDocument(getter_AddRefs(domDoc));
|
||||
nsCOMPtr<nsIDocument> 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<nsIWeakReference> 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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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__ */
|
||||
|
|
|
@ -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<nsIAccessible> current(mFirstChild), next;
|
||||
while (current) {
|
||||
current->SetAccParent(nsnull);
|
||||
nsCOMPtr<nsPIAccessible> 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<nsPIAccessible> 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<nsPIAccessible> 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<nsPIAccessible> 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<nsIAccessible> prevAccessible;
|
||||
nsCOMPtr<nsPIAccessible> 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<nsIAccessibleDocument> docAccessible(GetDocAccessible());
|
||||
nsCOMPtr<nsIAccessible> eventHandlingAccessible(do_QueryInterface(docAccessible));
|
||||
nsCOMPtr<nsPIAccessible> eventHandlingAccessible(do_QueryInterface(docAccessible));
|
||||
if (eventHandlingAccessible) {
|
||||
return eventHandlingAccessible->FireToolkitEvent(aEvent, aTarget, aData);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -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<nsIDOMNode> 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<nsIWeakReference> mDomSelectionWeak;
|
||||
};
|
||||
|
||||
|
|
|
@ -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<nsIAccessible> accParent;
|
||||
accService->GetAccessibleFor(ownerNode, getter_AddRefs(accParent));
|
||||
if (accParent) {
|
||||
nsCOMPtr<nsPIAccessible> 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<nsIAccessibleDocument> docAccessible;
|
||||
GetEventDocAccessible(subTreeToInvalidate, getter_AddRefs(docAccessible));
|
||||
nsCOMPtr<nsPIAccessibleDocument> 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<nsIAccessible> accessible;
|
||||
docAccessible->GetAccessibleInParentChain(targetNode, getter_AddRefs(accessible));
|
||||
accessible->InvalidateChildren();
|
||||
nsCOMPtr<nsPIAccessible> 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)
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -123,5 +123,7 @@ NS_IMETHODIMP nsOuterDocAccessible::Init()
|
|||
NS_ENSURE_TRUE(innerAccessible, NS_ERROR_FAILURE);
|
||||
|
||||
SetAccFirstChild(innerAccessible); // weak ref
|
||||
return innerAccessible->SetAccParent(this);
|
||||
nsCOMPtr<nsPIAccessible> privateInnerAccessible =
|
||||
do_QueryInterface(innerAccessible);
|
||||
return privateInnerAccessible->SetAccParent(this);
|
||||
}
|
||||
|
|
|
@ -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<nsPIAccessible> 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<nsPIAccessible> 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<nsIAccessibleDocument> accDoc(do_QueryInterface(accessible));
|
||||
NS_ASSERTION(accDoc, "No document for unload event target");
|
||||
accDoc->Destroy();
|
||||
nsCOMPtr<nsPIAccessibleDocument> 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<nsIAccessibleHyperText> 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 <tree>
|
||||
// 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 <checkbox>
|
||||
eventType.EqualsIgnoreCase("RadioStateChange")) { // it's a XUL <radio>
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -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<nsPIAccessible> privChildAcc = do_QueryInterface(mFirstChild);
|
||||
privChildAcc->SetAccNextSibling(nsnull);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче