mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 381302 - move application accessible to cross platform code, r=aaronlev, ginn.chen, sr=neil
This commit is contained in:
parent
80e306831e
commit
aa70f77f2e
@ -74,5 +74,5 @@ void nsAccessNodeWrap::ShutdownAccessibility()
|
||||
nsAccessNode::ShutdownXPAccessibility();
|
||||
|
||||
// Shutdown accessibility for ATK
|
||||
nsAppRootAccessible::Unload();
|
||||
nsApplicationAccessibleWrap::Unload();
|
||||
}
|
||||
|
@ -41,8 +41,9 @@
|
||||
|
||||
#include "nsMai.h"
|
||||
#include "nsAccessibleWrap.h"
|
||||
#include "nsAppRootAccessible.h"
|
||||
#include "nsAccessibleEventData.h"
|
||||
#include "nsString.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "prprf.h"
|
||||
#include "nsRoleMap.h"
|
||||
#include "nsStateMap.h"
|
||||
@ -61,6 +62,8 @@
|
||||
#include "nsMaiInterfaceDocument.h"
|
||||
#include "nsMaiInterfaceImage.h"
|
||||
|
||||
#include "nsAppRootAccessible.h"
|
||||
|
||||
extern "C" GType g_atk_hyperlink_impl_type; //defined in nsAppRootAccessible.cpp
|
||||
|
||||
/* MaiAtkObject */
|
||||
@ -1086,7 +1089,12 @@ CheckMaiAtkObject(AtkObject *aAtkObj)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
if (tmpAccWrap != nsAppRootAccessible::Create() && !tmpAccWrap->IsValidObject())
|
||||
nsRefPtr<nsApplicationAccessibleWrap> appAccWrap =
|
||||
nsAccessNode::GetApplicationAccessible();
|
||||
nsAccessibleWrap* tmpAppAccWrap =
|
||||
NS_STATIC_CAST(nsAccessibleWrap*, appAccWrap.get());
|
||||
|
||||
if (tmpAppAccWrap != tmpAccWrap && !tmpAccWrap->IsValidObject())
|
||||
return NS_ERROR_INVALID_POINTER;
|
||||
|
||||
NS_ENSURE_TRUE(tmpAccWrap->GetAtkObject() == aAtkObj, NS_ERROR_FAILURE);
|
||||
|
@ -44,6 +44,7 @@
|
||||
#include "nsAppRootAccessible.h"
|
||||
#include "prlink.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsAutoPtr.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <atk/atk.h>
|
||||
@ -55,9 +56,6 @@ static PRLibrary *sATKLib = nsnull;
|
||||
static const char sATKLibName[] = "libatk-1.0.so.0";
|
||||
static const char sATKHyperlinkImplGetTypeSymbol[] = "atk_hyperlink_impl_get_type";
|
||||
|
||||
/* app root accessible */
|
||||
static nsAppRootAccessible *sAppRoot = nsnull;
|
||||
|
||||
/* gail function pointer */
|
||||
static guint (* gail_add_global_event_listener) (GSignalEmissionHook listener,
|
||||
const gchar *event_type);
|
||||
@ -434,7 +432,8 @@ mai_util_remove_key_event_listener (guint remove_listener)
|
||||
AtkObject *
|
||||
mai_util_get_root(void)
|
||||
{
|
||||
nsAppRootAccessible *root = nsAppRootAccessible::Create();
|
||||
nsRefPtr<nsApplicationAccessibleWrap> root =
|
||||
nsAccessNode::GetApplicationAccessible();
|
||||
|
||||
if (root)
|
||||
return root->GetAtkObject();
|
||||
@ -510,21 +509,21 @@ add_listener (GSignalEmissionHook listener,
|
||||
|
||||
static nsresult LoadGtkModule(GnomeAccessibilityModule& aModule);
|
||||
|
||||
nsAppRootAccessible::nsAppRootAccessible():
|
||||
nsAccessibleWrap(nsnull, nsnull),
|
||||
mChildren(nsnull)
|
||||
// nsApplicationAccessibleWrap
|
||||
|
||||
nsApplicationAccessibleWrap::nsApplicationAccessibleWrap():
|
||||
nsApplicationAccessible()
|
||||
{
|
||||
MAI_LOG_DEBUG(("======Create AppRootAcc=%p\n", (void*)this));
|
||||
}
|
||||
|
||||
nsAppRootAccessible::~nsAppRootAccessible()
|
||||
nsApplicationAccessibleWrap::~nsApplicationAccessibleWrap()
|
||||
{
|
||||
MAI_LOG_DEBUG(("======Destory AppRootAcc=%p\n", (void*)this));
|
||||
}
|
||||
|
||||
/* virtual functions */
|
||||
|
||||
NS_IMETHODIMP nsAppRootAccessible::Init()
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessibleWrap::Init()
|
||||
{
|
||||
// load and initialize gail library
|
||||
nsresult rv = LoadGtkModule(sGail);
|
||||
@ -549,13 +548,12 @@ NS_IMETHODIMP nsAppRootAccessible::Init()
|
||||
else
|
||||
MAI_LOG_DEBUG(("Fail to load lib: %s\n", sAtkBridge.libName));
|
||||
|
||||
mChildren = do_CreateInstance(NS_ARRAY_CONTRACTID, &rv);
|
||||
return rv;
|
||||
return nsApplicationAccessible::Init();
|
||||
}
|
||||
|
||||
/* static */ void nsAppRootAccessible::Unload()
|
||||
void
|
||||
nsApplicationAccessibleWrap::Unload()
|
||||
{
|
||||
NS_IF_RELEASE(sAppRoot);
|
||||
if (sAtkBridge.lib) {
|
||||
// Do not shutdown/unload atk-bridge,
|
||||
// an exit function registered will take care of it
|
||||
@ -583,150 +581,8 @@ NS_IMETHODIMP nsAppRootAccessible::Init()
|
||||
// }
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAppRootAccessible::GetName(nsAString& _retval)
|
||||
{
|
||||
nsCOMPtr<nsIStringBundleService> bundleService =
|
||||
do_GetService(NS_STRINGBUNDLE_CONTRACTID);
|
||||
|
||||
NS_ASSERTION(bundleService, "String bundle service must be present!");
|
||||
|
||||
nsCOMPtr<nsIStringBundle> bundle;
|
||||
bundleService->CreateBundle("chrome://branding/locale/brand.properties",
|
||||
getter_AddRefs(bundle));
|
||||
nsXPIDLString appName;
|
||||
|
||||
if (bundle) {
|
||||
bundle->GetStringFromName(NS_LITERAL_STRING("brandShortName").get(),
|
||||
getter_Copies(appName));
|
||||
} else {
|
||||
NS_WARNING("brand.properties not present, using default app name");
|
||||
appName.AssignLiteral("Mozilla");
|
||||
}
|
||||
|
||||
_retval.Assign(appName);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAppRootAccessible::GetDescription(nsAString& aDescription)
|
||||
{
|
||||
GetName(aDescription);
|
||||
aDescription.AppendLiteral(" Root Accessible");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAppRootAccessible::GetRole(PRUint32 *aRole)
|
||||
{
|
||||
*aRole = nsIAccessibleRole::ROLE_APP_ROOT;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAppRootAccessible::GetFinalRole(PRUint32 *aFinalRole)
|
||||
{
|
||||
return GetRole(aFinalRole);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAppRootAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
|
||||
{
|
||||
*aState = 0;
|
||||
if (aExtraState)
|
||||
*aExtraState = 0;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAppRootAccessible::GetParent(nsIAccessible ** aParent)
|
||||
{
|
||||
*aParent = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAppRootAccessible::GetChildAt(PRInt32 aChildNum,
|
||||
nsIAccessible **aChild)
|
||||
{
|
||||
PRUint32 count = 0;
|
||||
nsresult rv = NS_OK;
|
||||
*aChild = nsnull;
|
||||
if (mChildren)
|
||||
rv = mChildren->GetLength(&count);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (aChildNum >= NS_STATIC_CAST(PRInt32, count) || count == 0)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
if (aChildNum < 0)
|
||||
aChildNum = count - 1;
|
||||
|
||||
nsCOMPtr<nsIWeakReference> childWeakRef;
|
||||
rv = mChildren->QueryElementAt(aChildNum, NS_GET_IID(nsIWeakReference),
|
||||
getter_AddRefs(childWeakRef));
|
||||
if (childWeakRef) {
|
||||
MAI_LOG_DEBUG(("GetChildAt(%d), has weak ref\n", aChildNum));
|
||||
nsCOMPtr<nsIAccessible> childAcc = do_QueryReferent(childWeakRef);
|
||||
if (childAcc) {
|
||||
MAI_LOG_DEBUG(("GetChildAt(%d), has Acc Child ref\n", aChildNum));
|
||||
NS_IF_ADDREF(*aChild = childAcc);
|
||||
}
|
||||
else
|
||||
MAI_LOG_DEBUG(("GetChildAt(%d), NOT has Acc Child ref\n",
|
||||
aChildNum));
|
||||
|
||||
}
|
||||
else
|
||||
MAI_LOG_DEBUG(("GetChildAt(%d), NOT has weak ref\n", aChildNum));
|
||||
return rv;
|
||||
}
|
||||
|
||||
void nsAppRootAccessible::CacheChildren()
|
||||
{
|
||||
if (!mChildren) {
|
||||
mAccChildCount = eChildCountUninitialized;
|
||||
return;
|
||||
}
|
||||
|
||||
if (mAccChildCount == eChildCountUninitialized) {
|
||||
nsCOMPtr<nsISimpleEnumerator> enumerator;
|
||||
mChildren->Enumerate(getter_AddRefs(enumerator));
|
||||
|
||||
nsCOMPtr<nsIWeakReference> childWeakRef;
|
||||
nsCOMPtr<nsIAccessible> accessible;
|
||||
nsCOMPtr<nsPIAccessible> previousAccessible;
|
||||
PRBool hasMoreElements;
|
||||
while(NS_SUCCEEDED(enumerator->HasMoreElements(&hasMoreElements))
|
||||
&& hasMoreElements) {
|
||||
enumerator->GetNext(getter_AddRefs(childWeakRef));
|
||||
accessible = do_QueryReferent(childWeakRef);
|
||||
if (accessible) {
|
||||
if (previousAccessible) {
|
||||
previousAccessible->SetNextSibling(accessible);
|
||||
}
|
||||
else {
|
||||
SetFirstChild(accessible);
|
||||
}
|
||||
previousAccessible = do_QueryInterface(accessible);
|
||||
previousAccessible->SetParent(this);
|
||||
}
|
||||
}
|
||||
|
||||
PRUint32 count = 0;
|
||||
mChildren->GetLength(&count);
|
||||
mAccChildCount = NS_STATIC_CAST(PRInt32, count);
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAppRootAccessible::GetNextSibling(nsIAccessible * *aNextSibling)
|
||||
{
|
||||
*aNextSibling = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAppRootAccessible::GetPreviousSibling(nsIAccessible * *aPreviousSibling)
|
||||
{
|
||||
*aPreviousSibling = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAppRootAccessible::GetNativeInterface(void **aOutAccessible)
|
||||
nsApplicationAccessibleWrap::GetNativeInterface(void **aOutAccessible)
|
||||
{
|
||||
*aOutAccessible = nsnull;
|
||||
|
||||
@ -746,15 +602,13 @@ NS_IMETHODIMP nsAppRootAccessible::GetNativeInterface(void **aOutAccessible)
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsAppRootAccessible::AddRootAccessible(nsIAccessible *aRootAccWrap)
|
||||
nsApplicationAccessibleWrap::AddRootAccessible(nsIAccessible *aRootAccWrap)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aRootAccWrap);
|
||||
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
|
||||
// add by weak reference
|
||||
rv = mChildren->AppendElement(aRootAccWrap, PR_TRUE);
|
||||
InvalidateChildren();
|
||||
nsresult rv = nsApplicationAccessible::AddRootAccessible(aRootAccWrap);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
void* atkAccessible;
|
||||
aRootAccWrap->GetNativeInterface(&atkAccessible);
|
||||
@ -778,7 +632,7 @@ nsAppRootAccessible::AddRootAccessible(nsIAccessible *aRootAccWrap)
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsAppRootAccessible::RemoveRootAccessible(nsIAccessible *aRootAccWrap)
|
||||
nsApplicationAccessibleWrap::RemoveRootAccessible(nsIAccessible *aRootAccWrap)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aRootAccWrap);
|
||||
|
||||
@ -816,8 +670,8 @@ nsAppRootAccessible::RemoveRootAccessible(nsIAccessible *aRootAccWrap)
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsAppRootAccessible *
|
||||
nsAppRootAccessible::Create()
|
||||
void
|
||||
nsApplicationAccessibleWrap::PreCreate()
|
||||
{
|
||||
if (!sATKChecked) {
|
||||
sATKLib = PR_LoadLibrary(sATKLibName);
|
||||
@ -829,19 +683,6 @@ nsAppRootAccessible::Create()
|
||||
}
|
||||
sATKChecked = PR_TRUE;
|
||||
}
|
||||
if (!sAppRoot && gIsAccessibilityActive) {
|
||||
sAppRoot = new nsAppRootAccessible();
|
||||
NS_ASSERTION(sAppRoot, "OUT OF MEMORY");
|
||||
if (sAppRoot) {
|
||||
if (NS_FAILED(sAppRoot->Init())) {
|
||||
delete sAppRoot;
|
||||
sAppRoot = nsnull;
|
||||
}
|
||||
else
|
||||
NS_IF_ADDREF(sAppRoot);
|
||||
}
|
||||
}
|
||||
return sAppRoot;
|
||||
}
|
||||
|
||||
static nsresult
|
||||
|
@ -42,59 +42,27 @@
|
||||
#ifndef __NS_APP_ROOT_ACCESSIBLE_H__
|
||||
#define __NS_APP_ROOT_ACCESSIBLE_H__
|
||||
|
||||
#include "nsIMutableArray.h"
|
||||
#include "nsIAccessibleDocument.h"
|
||||
#include "nsAccessibilityService.h"
|
||||
#include "nsAccessibleWrap.h"
|
||||
#include "nsRootAccessibleWrap.h"
|
||||
#include "nsApplicationAccessible.h"
|
||||
|
||||
#define MAI_TYPE_APP_ROOT (MAI_TYPE_ATK_OBJECT)
|
||||
|
||||
/* nsAppRootAccessible is for the whole application of Mozilla.
|
||||
* Only one instance of nsAppRootAccessible exists for one Mozilla instance.
|
||||
* And this one should be created when Mozilla Startup (if accessibility
|
||||
* feature has been enabled) and destroyed when Mozilla Shutdown.
|
||||
*
|
||||
* All the accessibility objects for toplevel windows are direct children of
|
||||
* the nsAppRootAccessible instance.
|
||||
*/
|
||||
class nsAppRootAccessible;
|
||||
class nsAppRootAccessible: public nsAccessibleWrap
|
||||
class nsApplicationAccessibleWrap: public nsApplicationAccessible
|
||||
{
|
||||
public:
|
||||
virtual ~nsAppRootAccessible();
|
||||
|
||||
static nsAppRootAccessible *Create();
|
||||
static void Unload();
|
||||
static void PreCreate();
|
||||
|
||||
public:
|
||||
nsAppRootAccessible();
|
||||
nsApplicationAccessibleWrap();
|
||||
virtual ~nsApplicationAccessibleWrap();
|
||||
|
||||
/* virtual function from nsAccessNode */
|
||||
// nsPIAccessNode
|
||||
NS_IMETHOD Init();
|
||||
|
||||
/* virtual functions from nsAccessible */
|
||||
NS_IMETHOD GetName(nsAString & aName);
|
||||
NS_IMETHOD GetDescription(nsAString & aDescription);
|
||||
NS_IMETHOD GetRole(PRUint32 *aRole);
|
||||
NS_IMETHOD GetFinalRole(PRUint32 *aFinalRole);
|
||||
NS_IMETHOD GetState(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
NS_IMETHOD GetParent(nsIAccessible * *aParent);
|
||||
NS_IMETHOD GetNextSibling(nsIAccessible * *aNextSibling);
|
||||
NS_IMETHOD GetPreviousSibling(nsIAccessible **aPreviousSibling);
|
||||
NS_IMETHOD GetChildAt(PRInt32 aChildNum, nsIAccessible **aChild);
|
||||
|
||||
// return the atk object for app root accessible
|
||||
NS_IMETHOD GetNativeInterface(void **aOutAccessible);
|
||||
|
||||
nsresult AddRootAccessible(nsIAccessible *aRootAccWrap);
|
||||
nsresult RemoveRootAccessible(nsIAccessible *aRootAccWrap);
|
||||
|
||||
protected:
|
||||
virtual void CacheChildren();
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsIMutableArray> mChildren;
|
||||
// nsApplicationAccessible
|
||||
virtual nsresult AddRootAccessible(nsIAccessible *aRootAccWrap);
|
||||
virtual nsresult RemoveRootAccessible(nsIAccessible *aRootAccWrap);
|
||||
};
|
||||
|
||||
#endif /* __NS_APP_ROOT_ACCESSIBLE_H__ */
|
||||
|
@ -41,61 +41,6 @@
|
||||
|
||||
#include "nsMai.h"
|
||||
#include "nsRootAccessibleWrap.h"
|
||||
#include "nsAppRootAccessible.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIDOMXULMultSelectCntrlEl.h"
|
||||
#include "nsIFocusController.h"
|
||||
|
||||
#ifdef MOZ_XUL
|
||||
#include "nsIAccessibleTreeCache.h"
|
||||
#endif
|
||||
|
||||
nsRootAccessibleWrap::nsRootAccessibleWrap(nsIDOMNode *aDOMNode,
|
||||
nsIWeakReference* aShell):
|
||||
nsRootAccessible(aDOMNode, aShell)
|
||||
{
|
||||
MAI_LOG_DEBUG(("New Root Acc=%p\n", (void*)this));
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRootAccessibleWrap::Init()
|
||||
{
|
||||
nsresult rv = nsRootAccessible::Init();
|
||||
nsAppRootAccessible *root = nsAppRootAccessible::Create();
|
||||
if (root) {
|
||||
root->AddRootAccessible(this);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsRootAccessibleWrap::~nsRootAccessibleWrap()
|
||||
{
|
||||
MAI_LOG_DEBUG(("Delete Root Acc=%p\n", (void*)this));
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRootAccessibleWrap::Shutdown()
|
||||
{
|
||||
nsAppRootAccessible *root = nsAppRootAccessible::Create();
|
||||
if (root) {
|
||||
root->RemoveRootAccessible(this);
|
||||
root = nsnull;
|
||||
}
|
||||
return nsRootAccessible::Shutdown();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRootAccessibleWrap::GetParent(nsIAccessible ** aParent)
|
||||
{
|
||||
nsAppRootAccessible *root = nsAppRootAccessible::Create();
|
||||
nsresult rv = NS_OK;
|
||||
if (root) {
|
||||
NS_IF_ADDREF(*aParent = root);
|
||||
}
|
||||
else {
|
||||
*aParent = nsnull;
|
||||
rv = NS_ERROR_FAILURE;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsNativeRootAccessibleWrap::nsNativeRootAccessibleWrap(AtkObject *aAccessible):
|
||||
nsRootAccessible(nsnull, nsnull)
|
||||
|
@ -44,24 +44,13 @@
|
||||
|
||||
#include "nsRootAccessible.h"
|
||||
|
||||
/* nsRootAccessibleWrap is the accessible class for toplevel Window.
|
||||
* The instance of nsRootAccessibleWrap will be child of MaiAppRoot instance.
|
||||
typedef nsRootAccessible nsRootAccessibleWrap;
|
||||
|
||||
/* nsNativeRootAccessibleWrap is the accessible class for gtk+ native window.
|
||||
* The instance of nsNativeRootAccessibleWrap is a child of MaiAppRoot instance.
|
||||
* It is added into root when the toplevel window is created, and removed
|
||||
* from root when the toplevel window is destroyed.
|
||||
*/
|
||||
|
||||
class nsRootAccessibleWrap: public nsRootAccessible
|
||||
{
|
||||
public:
|
||||
nsRootAccessibleWrap(nsIDOMNode *aDOMNode, nsIWeakReference* aShell);
|
||||
virtual ~nsRootAccessibleWrap();
|
||||
|
||||
NS_IMETHOD Init();
|
||||
NS_IMETHOD Shutdown();
|
||||
NS_IMETHOD GetParent(nsIAccessible ** aParent);
|
||||
};
|
||||
|
||||
// For gtk+ native window
|
||||
class nsNativeRootAccessibleWrap: public nsRootAccessible
|
||||
{
|
||||
public:
|
||||
|
@ -85,6 +85,7 @@ CPPSRCS = \
|
||||
nsBaseWidgetAccessible.cpp \
|
||||
nsFormControlAccessible.cpp \
|
||||
nsRootAccessible.cpp \
|
||||
nsApplicationAccessible.cpp \
|
||||
nsCaretAccessible.cpp \
|
||||
nsTextAccessible.cpp \
|
||||
$(NULL)
|
||||
|
@ -70,6 +70,12 @@
|
||||
#include "nsIFocusController.h"
|
||||
#include "nsIObserverService.h"
|
||||
|
||||
#ifdef MOZ_ACCESSIBILITY_ATK
|
||||
#include "nsAppRootAccessible.h"
|
||||
#else
|
||||
#include "nsApplicationAccessibleWrap.h"
|
||||
#endif
|
||||
|
||||
/* For documentation of the accessibility architecture,
|
||||
* see http://lxr.mozilla.org/seamonkey/source/accessible/accessible-docs.html
|
||||
*/
|
||||
@ -83,6 +89,8 @@ PRBool nsAccessNode::gIsCacheDisabled = PR_FALSE;
|
||||
PRBool nsAccessNode::gIsFormFillEnabled = PR_FALSE;
|
||||
nsInterfaceHashtable<nsVoidHashKey, nsIAccessNode> nsAccessNode::gGlobalDocAccessibleCache;
|
||||
|
||||
nsApplicationAccessibleWrap *nsAccessNode::gApplicationAccessible = nsnull;
|
||||
|
||||
nsIAccessibilityService *nsAccessNode::sAccService = nsnull;
|
||||
nsIAccessibilityService *nsAccessNode::GetAccService()
|
||||
{
|
||||
@ -201,6 +209,29 @@ NS_IMETHODIMP nsAccessNode::GetOwnerWindow(void **aWindow)
|
||||
return docAccessible->GetWindowHandle(aWindow);
|
||||
}
|
||||
|
||||
already_AddRefed<nsApplicationAccessibleWrap>
|
||||
nsAccessNode::GetApplicationAccessible()
|
||||
{
|
||||
if (!gApplicationAccessible && gIsAccessibilityActive) {
|
||||
nsApplicationAccessibleWrap::PreCreate();
|
||||
|
||||
gApplicationAccessible = new nsApplicationAccessibleWrap();
|
||||
if (!gApplicationAccessible)
|
||||
return nsnull;
|
||||
|
||||
NS_ADDREF(gApplicationAccessible);
|
||||
|
||||
nsresult rv = gApplicationAccessible->Init();
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_RELEASE(gApplicationAccessible);
|
||||
return nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
NS_ADDREF(gApplicationAccessible);
|
||||
return gApplicationAccessible;
|
||||
}
|
||||
|
||||
void nsAccessNode::InitXPAccessibility()
|
||||
{
|
||||
if (gIsAccessibilityActive) {
|
||||
@ -258,6 +289,7 @@ void nsAccessNode::ShutdownXPAccessibility()
|
||||
NS_IF_RELEASE(gDoCommandTimer);
|
||||
NS_IF_RELEASE(gLastFocusedNode);
|
||||
NS_IF_RELEASE(sAccService);
|
||||
NS_IF_RELEASE(gApplicationAccessible);
|
||||
|
||||
ClearCache(gGlobalDocAccessibleCache);
|
||||
|
||||
|
@ -64,6 +64,7 @@ class nsIFrame;
|
||||
class nsIDOMNodeList;
|
||||
class nsITimer;
|
||||
class nsRootAccessible;
|
||||
class nsApplicationAccessibleWrap;
|
||||
|
||||
#define ACCESSIBLE_BUNDLE_URL "chrome://global-platform/locale/accessible.properties"
|
||||
#define PLATFORM_KEYS_BUNDLE_URL "chrome://global-platform/locale/platformKeys.properties"
|
||||
@ -106,6 +107,11 @@ class nsAccessNode: public nsIAccessNode, public nsPIAccessNode
|
||||
static void InitXPAccessibility();
|
||||
static void ShutdownXPAccessibility();
|
||||
|
||||
/**
|
||||
* Return an application accessible.
|
||||
*/
|
||||
static already_AddRefed<nsApplicationAccessibleWrap> GetApplicationAccessible();
|
||||
|
||||
// Static methods for handling per-document cache
|
||||
static void PutCacheEntry(nsInterfaceHashtable<nsVoidHashKey, nsIAccessNode>& aCache,
|
||||
void* aUniqueID, nsIAccessNode *aAccessNode);
|
||||
@ -182,6 +188,7 @@ protected:
|
||||
|
||||
private:
|
||||
static nsIAccessibilityService *sAccService;
|
||||
static nsApplicationAccessibleWrap *gApplicationAccessible;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -98,15 +98,17 @@
|
||||
#include "nsHTMLWin32ObjectAccessible.h"
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_ACCESSIBILITY_ATK
|
||||
#include "nsAppRootAccessible.h"
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_XFORMS_HOOKS
|
||||
#include "nsXFormsFormControlsAccessible.h"
|
||||
#include "nsXFormsWidgetsAccessible.h"
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_ACCESSIBILITY_ATK
|
||||
#include "nsAppRootAccessible.h"
|
||||
#else
|
||||
#include "nsApplicationAccessibleWrap.h"
|
||||
#endif
|
||||
|
||||
nsAccessibilityService *nsAccessibilityService::gAccessibilityService = nsnull;
|
||||
|
||||
/**
|
||||
@ -1599,7 +1601,10 @@ NS_IMETHODIMP nsAccessibilityService::AddNativeRootAccessible(void * aAtkAccessi
|
||||
*aRootAccessible = NS_STATIC_CAST(nsIAccessible*, rootAccWrap);
|
||||
NS_ADDREF(*aRootAccessible);
|
||||
|
||||
nsAppRootAccessible *appRoot = nsAppRootAccessible::Create();
|
||||
nsRefPtr<nsApplicationAccessibleWrap> appRoot =
|
||||
nsAccessNode::GetApplicationAccessible();
|
||||
NS_ENSURE_STATE(appRoot);
|
||||
|
||||
appRoot->AddRootAccessible(*aRootAccessible);
|
||||
|
||||
return NS_OK;
|
||||
@ -1614,7 +1619,10 @@ NS_IMETHODIMP nsAccessibilityService::RemoveNativeRootAccessible(nsIAccessible *
|
||||
void* atkAccessible;
|
||||
aRootAccessible->GetNativeInterface(&atkAccessible);
|
||||
|
||||
nsAppRootAccessible *appRoot = nsAppRootAccessible::Create();
|
||||
nsRefPtr<nsApplicationAccessibleWrap> appRoot =
|
||||
nsAccessNode::GetApplicationAccessible();
|
||||
NS_ENSURE_STATE(appRoot);
|
||||
|
||||
appRoot->RemoveRootAccessible(aRootAccessible);
|
||||
|
||||
return NS_OK;
|
||||
|
@ -50,6 +50,7 @@
|
||||
#include "nsIAccessibleRole.h"
|
||||
#include "nsIAccessibleStates.h"
|
||||
#include "nsAccessibleRelationWrap.h"
|
||||
#include "nsIAccessibleEvent.h"
|
||||
|
||||
#include "nsIDOMNodeList.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
|
253
accessible/src/base/nsApplicationAccessible.cpp
Executable file
253
accessible/src/base/nsApplicationAccessible.cpp
Executable file
@ -0,0 +1,253 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* vim:expandtab:shiftwidth=4:tabstop=4:
|
||||
*/
|
||||
/* ***** 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
|
||||
* Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2007
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Bolian Yin <bolian.yin@sun.com>
|
||||
* Ginn Chen <ginn.chen@sun.com>
|
||||
* Alexander Surkov <surkov.alexander@gmail.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 "nsApplicationAccessible.h"
|
||||
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
nsApplicationAccessible::nsApplicationAccessible():
|
||||
nsAccessibleWrap(nsnull, nsnull), mChildren(nsnull)
|
||||
{
|
||||
}
|
||||
|
||||
// nsISupports
|
||||
NS_IMPL_ISUPPORTS_INHERITED0(nsApplicationAccessible,
|
||||
nsAccessible)
|
||||
|
||||
// nsIAccessNode
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessible::Init()
|
||||
{
|
||||
nsresult rv;
|
||||
mChildren = do_CreateInstance(NS_ARRAY_CONTRACTID, &rv);
|
||||
return rv;
|
||||
}
|
||||
|
||||
// nsIAccessible
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessible::GetName(nsAString& aName)
|
||||
{
|
||||
nsCOMPtr<nsIStringBundleService> bundleService =
|
||||
do_GetService(NS_STRINGBUNDLE_CONTRACTID);
|
||||
|
||||
NS_ASSERTION(bundleService, "String bundle service must be present!");
|
||||
NS_ENSURE_STATE(bundleService);
|
||||
|
||||
nsCOMPtr<nsIStringBundle> bundle;
|
||||
bundleService->CreateBundle("chrome://branding/locale/brand.properties",
|
||||
getter_AddRefs(bundle));
|
||||
|
||||
nsXPIDLString appName;
|
||||
if (bundle) {
|
||||
bundle->GetStringFromName(NS_LITERAL_STRING("brandShortName").get(),
|
||||
getter_Copies(appName));
|
||||
} else {
|
||||
NS_WARNING("brand.properties not present, using default app name");
|
||||
appName.AssignLiteral("Mozilla");
|
||||
}
|
||||
|
||||
aName.Assign(appName);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessible::GetDescription(nsAString& aDescription)
|
||||
{
|
||||
GetName(aDescription);
|
||||
aDescription.AppendLiteral(" Application Accessible");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessible::GetRole(PRUint32 *aRole)
|
||||
{
|
||||
*aRole = nsIAccessibleRole::ROLE_APP_ROOT;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessible::GetFinalRole(PRUint32 *aFinalRole)
|
||||
{
|
||||
return GetRole(aFinalRole);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
|
||||
{
|
||||
*aState = 0;
|
||||
if (aExtraState)
|
||||
*aExtraState = 0;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessible::GetParent(nsIAccessible **aParent)
|
||||
{
|
||||
*aParent = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessible::GetChildAt(PRInt32 aChildNum, nsIAccessible **aChild)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aChild);
|
||||
*aChild = nsnull;
|
||||
|
||||
PRUint32 count = 0;
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
if (mChildren) {
|
||||
rv = mChildren->GetLength(&count);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
if (aChildNum >= NS_STATIC_CAST(PRInt32, count) || count == 0)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
if (aChildNum < 0)
|
||||
aChildNum = count - 1;
|
||||
|
||||
nsCOMPtr<nsIWeakReference> childWeakRef;
|
||||
rv = mChildren->QueryElementAt(aChildNum, NS_GET_IID(nsIWeakReference),
|
||||
getter_AddRefs(childWeakRef));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (childWeakRef) {
|
||||
nsCOMPtr<nsIAccessible> childAcc(do_QueryReferent(childWeakRef));
|
||||
NS_IF_ADDREF(*aChild = childAcc);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessible::GetNextSibling(nsIAccessible **aNextSibling)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aNextSibling);
|
||||
|
||||
*aNextSibling = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessible::GetPreviousSibling(nsIAccessible **aPreviousSibling)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aPreviousSibling);
|
||||
|
||||
*aPreviousSibling = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsApplicationAccessible::CacheChildren()
|
||||
{
|
||||
if (!mChildren) {
|
||||
mAccChildCount = eChildCountUninitialized;
|
||||
return;
|
||||
}
|
||||
|
||||
if (mAccChildCount == eChildCountUninitialized) {
|
||||
nsCOMPtr<nsISimpleEnumerator> enumerator;
|
||||
mChildren->Enumerate(getter_AddRefs(enumerator));
|
||||
|
||||
nsCOMPtr<nsIWeakReference> childWeakRef;
|
||||
nsCOMPtr<nsIAccessible> accessible;
|
||||
nsCOMPtr<nsPIAccessible> previousAccessible;
|
||||
PRBool hasMoreElements;
|
||||
while(NS_SUCCEEDED(enumerator->HasMoreElements(&hasMoreElements))
|
||||
&& hasMoreElements) {
|
||||
enumerator->GetNext(getter_AddRefs(childWeakRef));
|
||||
accessible = do_QueryReferent(childWeakRef);
|
||||
if (accessible) {
|
||||
if (previousAccessible)
|
||||
previousAccessible->SetNextSibling(accessible);
|
||||
else
|
||||
SetFirstChild(accessible);
|
||||
|
||||
previousAccessible = do_QueryInterface(accessible);
|
||||
previousAccessible->SetParent(this);
|
||||
}
|
||||
}
|
||||
|
||||
PRUint32 count = 0;
|
||||
mChildren->GetLength(&count);
|
||||
mAccChildCount = NS_STATIC_CAST(PRInt32, count);
|
||||
}
|
||||
}
|
||||
|
||||
// nsApplicationAccessible
|
||||
|
||||
nsresult
|
||||
nsApplicationAccessible::AddRootAccessible(nsIAccessible *aRootAccessible)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aRootAccessible);
|
||||
|
||||
// add by weak reference
|
||||
nsresult rv = mChildren->AppendElement(aRootAccessible, PR_TRUE);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
InvalidateChildren();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsApplicationAccessible::RemoveRootAccessible(nsIAccessible *aRootAccessible)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aRootAccessible);
|
||||
|
||||
PRUint32 index = 0;
|
||||
|
||||
// we must use weak ref to get the index
|
||||
nsCOMPtr<nsIWeakReference> weakPtr = do_GetWeakReference(aRootAccessible);
|
||||
nsresult rv = mChildren->IndexOf(0, weakPtr, &index);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = mChildren->RemoveElementAt(index);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
InvalidateChildren();
|
||||
return NS_OK;
|
||||
}
|
||||
|
93
accessible/src/base/nsApplicationAccessible.h
Executable file
93
accessible/src/base/nsApplicationAccessible.h
Executable file
@ -0,0 +1,93 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* vim:expandtab:shiftwidth=4:tabstop=4:
|
||||
*/
|
||||
/* ***** 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
|
||||
* Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2007
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Bolian Yin <bolian.yin@sun.com>
|
||||
* Ginn Chen <ginn.chen@sun.com>
|
||||
* Alexander Surkov <surkov.alexander@gmail.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 ***** */
|
||||
|
||||
#ifndef __NS_APPLICATION_ACCESSIBLE_H__
|
||||
#define __NS_APPLICATION_ACCESSIBLE_H__
|
||||
|
||||
#include "nsAccessibleWrap.h"
|
||||
#include "nsIMutableArray.h"
|
||||
|
||||
/**
|
||||
* nsApplicationAccessible is for the whole application of Mozilla.
|
||||
* Only one instance of nsAppRootAccessible exists for one Mozilla instance.
|
||||
* And this one should be created when Mozilla Startup (if accessibility
|
||||
* feature has been enabled) and destroyed when Mozilla Shutdown.
|
||||
*
|
||||
* All the accessibility objects for toplevel windows are direct children of
|
||||
* the nsApplicationAccessible instance.
|
||||
*/
|
||||
|
||||
class nsApplicationAccessible: public nsAccessibleWrap
|
||||
{
|
||||
public:
|
||||
nsApplicationAccessible();
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
// nsPIAccessNode
|
||||
NS_IMETHOD Init();
|
||||
|
||||
// nsIAccessible
|
||||
NS_IMETHOD GetName(nsAString & aName);
|
||||
NS_IMETHOD GetDescription(nsAString & aDescription);
|
||||
NS_IMETHOD GetRole(PRUint32 *aRole);
|
||||
NS_IMETHOD GetFinalRole(PRUint32 *aFinalRole);
|
||||
NS_IMETHOD GetState(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
NS_IMETHOD GetParent(nsIAccessible * *aParent);
|
||||
NS_IMETHOD GetNextSibling(nsIAccessible * *aNextSibling);
|
||||
NS_IMETHOD GetPreviousSibling(nsIAccessible **aPreviousSibling);
|
||||
NS_IMETHOD GetChildAt(PRInt32 aChildNum, nsIAccessible **aChild);
|
||||
|
||||
// nsApplicationAccessible
|
||||
virtual nsresult AddRootAccessible(nsIAccessible *aRootAccWrap);
|
||||
virtual nsresult RemoveRootAccessible(nsIAccessible *aRootAccWrap);
|
||||
|
||||
protected:
|
||||
// nsAccessible
|
||||
virtual void CacheChildren();
|
||||
|
||||
nsCOMPtr<nsIMutableArray> mChildren;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -42,7 +42,6 @@
|
||||
#include "nsHyperTextAccessibleWrap.h"
|
||||
#include "nsIAccessibleDocument.h"
|
||||
#include "nsPIAccessibleDocument.h"
|
||||
#include "nsIAccessibleEvent.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDocumentObserver.h"
|
||||
#include "nsIEditor.h"
|
||||
|
@ -84,6 +84,12 @@
|
||||
#include "nsIXULWindow.h"
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_ACCESSIBILITY_ATK
|
||||
#include "nsAppRootAccessible.h"
|
||||
#else
|
||||
#include "nsApplicationAccessibleWrap.h"
|
||||
#endif
|
||||
|
||||
// Expanded version of NS_IMPL_ISUPPORTS_INHERITED2
|
||||
// so we can QI directly to concrete nsRootAccessible
|
||||
NS_IMPL_QUERY_HEAD(nsRootAccessible)
|
||||
@ -147,8 +153,13 @@ NS_IMETHODIMP nsRootAccessible::GetName(nsAString& aName)
|
||||
|
||||
/* readonly attribute nsIAccessible accParent; */
|
||||
NS_IMETHODIMP nsRootAccessible::GetParent(nsIAccessible * *aParent)
|
||||
{
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aParent);
|
||||
*aParent = nsnull;
|
||||
|
||||
nsRefPtr<nsApplicationAccessibleWrap> root = GetApplicationAccessible();
|
||||
NS_IF_ADDREF(*aParent = root);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -899,8 +910,26 @@ void nsRootAccessible::FireFocusCallback(nsITimer *aTimer, void *aClosure)
|
||||
rootAccessible->FireCurrentFocusEvent();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsRootAccessible::Init()
|
||||
{
|
||||
nsresult rv = nsDocAccessibleWrap::Init();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsRefPtr<nsApplicationAccessibleWrap> root = GetApplicationAccessible();
|
||||
NS_ENSURE_STATE(root);
|
||||
|
||||
root->AddRootAccessible(this);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRootAccessible::Shutdown()
|
||||
{
|
||||
nsRefPtr<nsApplicationAccessibleWrap> root = GetApplicationAccessible();
|
||||
NS_ENSURE_STATE(root);
|
||||
|
||||
root->RemoveRootAccessible(this);
|
||||
|
||||
// Called manually or by nsAccessNode::LastRelease()
|
||||
if (!mWeakShell) {
|
||||
return NS_OK; // Already shutdown
|
||||
|
@ -67,6 +67,7 @@ class nsRootAccessible : public nsDocAccessibleWrap,
|
||||
nsRootAccessible(nsIDOMNode *aDOMNode, nsIWeakReference* aShell);
|
||||
virtual ~nsRootAccessible();
|
||||
|
||||
// nsIAccessible
|
||||
NS_IMETHOD GetName(nsAString& aName);
|
||||
NS_IMETHOD GetParent(nsIAccessible * *aParent);
|
||||
NS_IMETHOD GetRole(PRUint32 *aRole);
|
||||
@ -84,6 +85,7 @@ class nsRootAccessible : public nsDocAccessibleWrap,
|
||||
NS_IMETHOD GetCaretAccessible(nsIAccessible **aAccessibleCaret);
|
||||
|
||||
// nsIAccessNode
|
||||
NS_IMETHOD Init();
|
||||
NS_IMETHOD Shutdown();
|
||||
|
||||
void ShutdownAll();
|
||||
|
@ -1,4 +1,4 @@
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# ***** 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
|
||||
@ -85,6 +85,7 @@ EXPORTS = \
|
||||
nsHTMLImageAccessibleWrap.h \
|
||||
nsHTMLTableAccessibleWrap.h \
|
||||
nsAccessibleRelationWrap.h \
|
||||
nsApplicationAccessibleWrap.h \
|
||||
mozDocAccessible.h \
|
||||
mozAccessible.h \
|
||||
mozAccessibleWrapper.h \
|
||||
|
53
accessible/src/mac/nsApplicationAccessibleWrap.h
Executable file
53
accessible/src/mac/nsApplicationAccessibleWrap.h
Executable file
@ -0,0 +1,53 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* vim:expandtab:shiftwidth=4:tabstop=4:
|
||||
*/
|
||||
/* ***** 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
|
||||
* Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2007
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Alexander Surkov <surkov.alexander@gmail.com> (original author)
|
||||
*
|
||||
* 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 ***** */
|
||||
|
||||
#ifndef __NS_APPLICATION_ACCESSIBLE_WRAP_H__
|
||||
#define __NS_APPLICATION_ACCESSIBLE_WRAP_H__
|
||||
|
||||
#include "nsApplicationAccessible.h"
|
||||
|
||||
class nsApplicationAccessibleWrap: public nsApplicationAccessible
|
||||
{
|
||||
public:
|
||||
static void PreCreate() {}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -79,6 +79,7 @@ CPPSRCS = \
|
||||
nsHTMLImageAccessibleWrap.cpp \
|
||||
nsHTMLTableAccessibleWrap.cpp \
|
||||
nsAccessibleRelationWrap.cpp \
|
||||
nsApplicationAccessibleWrap.cpp \
|
||||
CAccessibleAction.cpp \
|
||||
CAccessibleImage.cpp \
|
||||
CAccessibleComponent.cpp \
|
||||
@ -103,6 +104,7 @@ EXPORTS = \
|
||||
nsHTMLImageAccessibleWrap.h \
|
||||
nsHTMLTableAccessibleWrap.h \
|
||||
nsAccessibleRelationWrap.h \
|
||||
nsApplicationAccessibleWrap.h \
|
||||
CAccessibleAction.h \
|
||||
CAccessibleImage.h \
|
||||
CAccessibleComponent.h \
|
||||
|
97
accessible/src/msaa/nsApplicationAccessibleWrap.cpp
Executable file
97
accessible/src/msaa/nsApplicationAccessibleWrap.cpp
Executable file
@ -0,0 +1,97 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* vim:expandtab:shiftwidth=4:tabstop=4:
|
||||
*/
|
||||
/* ***** 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
|
||||
* Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2007
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Alexander Surkov <surkov.alexander@gmail.com> (original author)
|
||||
*
|
||||
* 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 "nsApplicationAccessibleWrap.h"
|
||||
|
||||
#include "AccessibleApplication_i.c"
|
||||
|
||||
// nsISupports
|
||||
NS_IMPL_ISUPPORTS_INHERITED0(nsApplicationAccessibleWrap,
|
||||
nsApplicationAccessible)
|
||||
|
||||
// IUnknown
|
||||
|
||||
STDMETHODIMP
|
||||
nsApplicationAccessibleWrap::QueryInterface(REFIID iid, void** ppv)
|
||||
{
|
||||
*ppv = NULL;
|
||||
|
||||
if (IID_IAccessibleApplication == iid) {
|
||||
*ppv = NS_STATIC_CAST(IAccessibleApplication*, this);
|
||||
(NS_REINTERPRET_CAST(IUnknown*, *ppv))->AddRef();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
return nsAccessibleWrap::QueryInterface(iid, ppv);
|
||||
}
|
||||
|
||||
// IAccessibleApplication
|
||||
|
||||
STDMETHODIMP
|
||||
nsApplicationAccessibleWrap::get_appName(BSTR *aName)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
STDMETHODIMP
|
||||
nsApplicationAccessibleWrap::get_appVersion(BSTR *aVersion)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
STDMETHODIMP
|
||||
nsApplicationAccessibleWrap::get_toolkitName(BSTR *aName)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
STDMETHODIMP
|
||||
nsApplicationAccessibleWrap::get_toolkitVersion(BSTR *aVersion)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
// nsApplicationAccessibleWrap
|
||||
|
||||
void
|
||||
nsApplicationAccessibleWrap::PreCreate()
|
||||
{
|
||||
}
|
||||
|
76
accessible/src/msaa/nsApplicationAccessibleWrap.h
Executable file
76
accessible/src/msaa/nsApplicationAccessibleWrap.h
Executable file
@ -0,0 +1,76 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* vim:expandtab:shiftwidth=4:tabstop=4:
|
||||
*/
|
||||
/* ***** 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
|
||||
* Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2007
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Alexander Surkov <surkov.alexander@gmail.com> (original author)
|
||||
*
|
||||
* 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 ***** */
|
||||
|
||||
#ifndef __NS_APPLICATION_ACCESSIBLE_WRAP_H__
|
||||
#define __NS_APPLICATION_ACCESSIBLE_WRAP_H__
|
||||
|
||||
#include "nsApplicationAccessible.h"
|
||||
|
||||
#include "AccessibleApplication.h"
|
||||
|
||||
class nsApplicationAccessibleWrap: public nsApplicationAccessible,
|
||||
public IAccessibleApplication
|
||||
{
|
||||
public:
|
||||
// nsISupporst
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
// IUnknown
|
||||
STDMETHODIMP QueryInterface(REFIID, void**);
|
||||
|
||||
// IAccessibleApplication
|
||||
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_appName(
|
||||
/* [retval][out] */ BSTR *name);
|
||||
|
||||
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_appVersion(
|
||||
/* [retval][out] */ BSTR *version);
|
||||
|
||||
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_toolkitName(
|
||||
/* [retval][out] */ BSTR *name);
|
||||
|
||||
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_toolkitVersion(
|
||||
/* [retval][out] */ BSTR *version);
|
||||
|
||||
public:
|
||||
static void PreCreate();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -85,6 +85,7 @@ EXPORTS = \
|
||||
nsHTMLImageAccessibleWrap.h \
|
||||
nsHTMLTableAccessibleWrap.h \
|
||||
nsAccessibleRelationWrap.h \
|
||||
nsApplicationAccessibleWrap.h \
|
||||
$(NULL)
|
||||
|
||||
# we don't want the shared lib, but we want to force the creation of a static lib.
|
||||
|
53
accessible/src/other/nsApplicationAccessibleWrap.h
Executable file
53
accessible/src/other/nsApplicationAccessibleWrap.h
Executable file
@ -0,0 +1,53 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* vim:expandtab:shiftwidth=4:tabstop=4:
|
||||
*/
|
||||
/* ***** 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
|
||||
* Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2007
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Alexander Surkov <surkov.alexander@gmail.com> (original author)
|
||||
*
|
||||
* 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 ***** */
|
||||
|
||||
#ifndef __NS_APPLICATION_ACCESSIBLE_WRAP_H__
|
||||
#define __NS_APPLICATION_ACCESSIBLE_WRAP_H__
|
||||
|
||||
#include "nsApplicationAccessible.h"
|
||||
|
||||
class nsApplicationAccessibleWrap: public nsApplicationAccessible
|
||||
{
|
||||
public:
|
||||
static void PreCreate() {}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user