Bug 343150 Use AtkHyperlinkImpl

patch by nian.liu at sun.com r=ginn.chen
This commit is contained in:
ginn.chen%sun.com 2006-08-30 09:03:45 +00:00
Родитель d9a41ba187
Коммит dfbad4762b
4 изменённых файлов: 39 добавлений и 26 удалений

Просмотреть файл

@ -76,6 +76,7 @@ CPPSRCS = \
nsMaiInterfaceValue.cpp \ nsMaiInterfaceValue.cpp \
nsMaiHyperlink.cpp \ nsMaiHyperlink.cpp \
nsMaiInterfaceHypertext.cpp \ nsMaiInterfaceHypertext.cpp \
nsMaiInterfaceHyperlinkImpl.cpp \
nsMaiInterfaceTable.cpp \ nsMaiInterfaceTable.cpp \
nsMaiInterfaceDocument.cpp \ nsMaiInterfaceDocument.cpp \
$(NULL) $(NULL)

Просмотреть файл

@ -53,9 +53,12 @@
#include "nsMaiInterfaceSelection.h" #include "nsMaiInterfaceSelection.h"
#include "nsMaiInterfaceValue.h" #include "nsMaiInterfaceValue.h"
#include "nsMaiInterfaceHypertext.h" #include "nsMaiInterfaceHypertext.h"
#include "nsMaiInterfaceHyperlinkImpl.h"
#include "nsMaiInterfaceTable.h" #include "nsMaiInterfaceTable.h"
#include "nsMaiInterfaceDocument.h" #include "nsMaiInterfaceDocument.h"
extern "C" GType g_atk_hyperlink_impl_type; //defined in nsAppRootAccessible.cpp
/* MaiAtkObject */ /* MaiAtkObject */
enum { enum {
@ -76,10 +79,11 @@ enum MaiInterfaceType {
MAI_INTERFACE_VALUE, MAI_INTERFACE_VALUE,
MAI_INTERFACE_EDITABLE_TEXT, MAI_INTERFACE_EDITABLE_TEXT,
MAI_INTERFACE_HYPERTEXT, MAI_INTERFACE_HYPERTEXT,
MAI_INTERFACE_HYPERLINK_IMPL,
MAI_INTERFACE_SELECTION, MAI_INTERFACE_SELECTION,
MAI_INTERFACE_TABLE, MAI_INTERFACE_TABLE,
MAI_INTERFACE_TEXT, MAI_INTERFACE_TEXT,
MAI_INTERFACE_DOCUMENT /* 8 */ MAI_INTERFACE_DOCUMENT /* 9 */
}; };
static GType GetAtkTypeForMai(MaiInterfaceType type) static GType GetAtkTypeForMai(MaiInterfaceType type)
@ -95,6 +99,8 @@ static GType GetAtkTypeForMai(MaiInterfaceType type)
return ATK_TYPE_EDITABLE_TEXT; return ATK_TYPE_EDITABLE_TEXT;
case MAI_INTERFACE_HYPERTEXT: case MAI_INTERFACE_HYPERTEXT:
return ATK_TYPE_HYPERTEXT; return ATK_TYPE_HYPERTEXT;
case MAI_INTERFACE_HYPERLINK_IMPL:
return g_atk_hyperlink_impl_type;
case MAI_INTERFACE_SELECTION: case MAI_INTERFACE_SELECTION:
return ATK_TYPE_SELECTION; return ATK_TYPE_SELECTION;
case MAI_INTERFACE_TABLE: case MAI_INTERFACE_TABLE:
@ -118,6 +124,8 @@ static const GInterfaceInfo atk_if_infos[] = {
(GInterfaceFinalizeFunc) NULL, NULL}, (GInterfaceFinalizeFunc) NULL, NULL},
{(GInterfaceInitFunc)hypertextInterfaceInitCB, {(GInterfaceInitFunc)hypertextInterfaceInitCB,
(GInterfaceFinalizeFunc) NULL, NULL}, (GInterfaceFinalizeFunc) NULL, NULL},
{(GInterfaceInitFunc)hyperlinkImplInterfaceInitCB,
(GInterfaceFinalizeFunc) NULL, NULL},
{(GInterfaceInitFunc)selectionInterfaceInitCB, {(GInterfaceInitFunc)selectionInterfaceInitCB,
(GInterfaceFinalizeFunc) NULL, NULL}, (GInterfaceFinalizeFunc) NULL, NULL},
{(GInterfaceInitFunc)tableInterfaceInitCB, {(GInterfaceInitFunc)tableInterfaceInitCB,
@ -368,6 +376,14 @@ nsAccessibleWrap::CreateMaiInterfaces(void)
} }
} }
//nsIAccessibleHyperLink
nsCOMPtr<nsIAccessibleHyperLink> accessInterfaceHyperlink;
QueryInterface(NS_GET_IID(nsIAccessibleHyperLink),
getter_AddRefs(accessInterfaceHyperlink));
if (accessInterfaceHyperlink) {
interfacesBits |= 1 << MAI_INTERFACE_HYPERLINK_IMPL;
}
//nsIAccessibleTable //nsIAccessibleTable
nsCOMPtr<nsIAccessibleTable> accessInterfaceTable; nsCOMPtr<nsIAccessibleTable> accessInterfaceTable;
QueryInterface(NS_GET_IID(nsIAccessibleTable), QueryInterface(NS_GET_IID(nsIAccessibleTable),

Просмотреть файл

@ -48,6 +48,12 @@
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include <atk/atk.h> #include <atk/atk.h>
typedef GType (* AtkGetTypeType) (void);
GType g_atk_hyperlink_impl_type = G_TYPE_INVALID;
static PRBool sATKChecked = PR_FALSE;
static const char sATKLibName[] = "libatk-1.0.so";
static const char sATKHyperlinkImplGetTypeSymbol[] = "atk_hyperlink_impl_get_type";
/* app root accessible */ /* app root accessible */
static nsAppRootAccessible *sAppRoot = nsnull; static nsAppRootAccessible *sAppRoot = nsnull;
@ -88,9 +94,6 @@ static void value_destroy_func(gpointer data);
static GHashTable *listener_list = NULL; static GHashTable *listener_list = NULL;
static gint listener_idx = 1; static gint listener_idx = 1;
typedef struct _MaiUtilListenerInfo MaiUtilListenerInfo;
#define MAI_TYPE_UTIL (mai_util_get_type ()) #define MAI_TYPE_UTIL (mai_util_get_type ())
#define MAI_UTIL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ #define MAI_UTIL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
MAI_TYPE_UTIL, MaiUtil)) MAI_TYPE_UTIL, MaiUtil))
@ -103,9 +106,6 @@ typedef struct _MaiUtilListenerInfo MaiUtilListenerInfo;
#define MAI_UTIL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \ #define MAI_UTIL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
MAI_TYPE_UTIL, MaiUtilClass)) MAI_TYPE_UTIL, MaiUtilClass))
typedef struct _MaiUtil MaiUtil;
typedef struct _MaiUtilClass MaiUtilClass;
static GHashTable *key_listener_list = NULL; static GHashTable *key_listener_list = NULL;
static guint key_snooper_id = 0; static guint key_snooper_id = 0;
@ -114,7 +114,7 @@ typedef void (*GnomeAccessibilityInit) (void);
typedef void (*GnomeAccessibilityShutdown) (void); typedef void (*GnomeAccessibilityShutdown) (void);
G_END_DECLS G_END_DECLS
struct _MaiUtil struct MaiUtil
{ {
AtkUtil parent; AtkUtil parent;
GList *listener_list; GList *listener_list;
@ -136,21 +136,21 @@ struct GnomeAccessibilityModule
GnomeAccessibilityShutdown shutdown; GnomeAccessibilityShutdown shutdown;
}; };
GType mai_util_get_type (void); struct MaiUtilClass
static void mai_util_class_init(MaiUtilClass *klass);
struct _MaiUtilClass
{ {
AtkUtilClass parent_class; AtkUtilClass parent_class;
}; };
GType mai_util_get_type (void);
static void mai_util_class_init(MaiUtilClass *klass);
/* supporting */ /* supporting */
PRLogModuleInfo *gMaiLog = NULL; PRLogModuleInfo *gMaiLog = NULL;
#define MAI_VERSION MOZILLA_VERSION #define MAI_VERSION MOZILLA_VERSION
#define MAI_NAME "Gecko" #define MAI_NAME "Gecko"
struct _MaiUtilListenerInfo struct MaiUtilListenerInfo
{ {
gint key; gint key;
guint signal_id; guint signal_id;
@ -499,18 +499,11 @@ add_listener (GSignalEmissionHook listener,
return rc; return rc;
} }
// currently support one child
nsRootAccessibleWrap *sOnlyChild = nsnull;
static nsresult LoadGtkModule(GnomeAccessibilityModule& aModule); static nsresult LoadGtkModule(GnomeAccessibilityModule& aModule);
nsAppRootAccessible::nsAppRootAccessible(): nsAppRootAccessible::nsAppRootAccessible():
nsAccessibleWrap(nsnull, nsnull), nsAccessibleWrap(nsnull, nsnull),
mChildren(nsnull), mChildren(nsnull)
mInitialized(PR_FALSE)
{ {
MAI_LOG_DEBUG(("======Create AppRootAcc=%p\n", (void*)this)); MAI_LOG_DEBUG(("======Create AppRootAcc=%p\n", (void*)this));
} }
@ -555,10 +548,6 @@ nsAppRootAccessible::DumpMaiObjectInfo(int aDepth)
NS_IMETHODIMP nsAppRootAccessible::Init() NS_IMETHODIMP nsAppRootAccessible::Init()
{ {
NS_ASSERTION((mInitialized == FALSE), "Init AppRoot Again!!");
if (mInitialized == PR_TRUE)
return NS_OK;
// load and initialize gail library // load and initialize gail library
nsresult rv = LoadGtkModule(sGail); nsresult rv = LoadGtkModule(sGail);
if (NS_SUCCEEDED(rv)) { if (NS_SUCCEEDED(rv)) {
@ -820,6 +809,14 @@ nsAppRootAccessible::RemoveRootAccessible(nsIAccessible *aRootAccWrap)
nsAppRootAccessible * nsAppRootAccessible *
nsAppRootAccessible::Create() nsAppRootAccessible::Create()
{ {
if (!sATKChecked) {
PRLibrary *atkLib = PR_LoadLibrary(sATKLibName);
AtkGetTypeType pfn_atk_hyperlink_impl_get_type = (AtkGetTypeType) PR_FindFunctionSymbol(atkLib, sATKHyperlinkImplGetTypeSymbol);
if (pfn_atk_hyperlink_impl_get_type) {
g_atk_hyperlink_impl_type = pfn_atk_hyperlink_impl_get_type();
}
sATKChecked = PR_TRUE;
}
if (!sAppRoot) { if (!sAppRoot) {
sAppRoot = new nsAppRootAccessible(); sAppRoot = new nsAppRootAccessible();
NS_ASSERTION(sAppRoot, "OUT OF MEMORY"); NS_ASSERTION(sAppRoot, "OUT OF MEMORY");

Просмотреть файл

@ -96,7 +96,6 @@ public:
nsresult RemoveRootAccessible(nsIAccessible *aRootAccWrap); nsresult RemoveRootAccessible(nsIAccessible *aRootAccWrap);
private: private:
nsCOMPtr<nsIMutableArray> mChildren; nsCOMPtr<nsIMutableArray> mChildren;
PRBool mInitialized;
}; };
#endif /* __NS_APP_ROOT_ACCESSIBLE_H__ */ #endif /* __NS_APP_ROOT_ACCESSIBLE_H__ */