2011-04-27 06:42:27 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2011-05-27 15:37:24 -07:00
|
|
|
/* vim: set ts=2 et sw=2 tw=80: */
|
2012-05-21 04:12:37 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-05-28 18:18:45 -07:00
|
|
|
#include "AccessibleWrap.h"
|
2010-04-26 23:52:03 -07:00
|
|
|
|
2012-04-17 02:56:02 -07:00
|
|
|
#include "Accessible-inl.h"
|
2012-04-25 04:29:40 -07:00
|
|
|
#include "ApplicationAccessibleWrap.h"
|
2012-03-19 21:02:50 -07:00
|
|
|
#include "InterfaceInitFuncs.h"
|
2010-04-26 23:52:03 -07:00
|
|
|
#include "nsAccUtils.h"
|
2014-10-24 02:29:48 -07:00
|
|
|
#include "mozilla/a11y/PDocAccessible.h"
|
2014-03-07 13:35:19 -08:00
|
|
|
#include "ProxyAccessible.h"
|
2012-05-03 23:09:22 -07:00
|
|
|
#include "RootAccessible.h"
|
2012-03-19 21:02:50 -07:00
|
|
|
#include "nsMai.h"
|
|
|
|
#include "nsMaiHyperlink.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsString.h"
|
2007-06-01 20:01:38 -07:00
|
|
|
#include "nsAutoPtr.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "prprf.h"
|
|
|
|
#include "nsStateMap.h"
|
2014-03-07 13:35:19 -08:00
|
|
|
#include "mozilla/a11y/Platform.h"
|
2011-08-09 18:44:00 -07:00
|
|
|
#include "Relation.h"
|
2012-05-03 23:09:22 -07:00
|
|
|
#include "RootAccessible.h"
|
2011-04-09 16:38:06 -07:00
|
|
|
#include "States.h"
|
2013-09-23 10:29:27 -07:00
|
|
|
#include "nsISimpleEnumerator.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-12-08 18:52:54 -08:00
|
|
|
#include "mozilla/ArrayUtils.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsXPCOMStrings.h"
|
|
|
|
#include "nsComponentManagerUtils.h"
|
2013-09-10 15:18:59 -07:00
|
|
|
#include "nsIPersistentProperties2.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-10-10 22:50:08 -07:00
|
|
|
using namespace mozilla;
|
2011-07-27 05:43:01 -07:00
|
|
|
using namespace mozilla::a11y;
|
|
|
|
|
2012-05-28 18:18:45 -07:00
|
|
|
AccessibleWrap::EAvailableAtkSignals AccessibleWrap::gAvailableAtkSignals =
|
2011-07-04 06:49:44 -07:00
|
|
|
eUnknown;
|
|
|
|
|
2012-04-25 04:29:40 -07:00
|
|
|
//defined in ApplicationAccessibleWrap.cpp
|
2009-08-21 05:33:31 -07:00
|
|
|
extern "C" GType g_atk_hyperlink_impl_type;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/* MaiAtkObject */
|
|
|
|
|
|
|
|
enum {
|
|
|
|
ACTIVATE,
|
|
|
|
CREATE,
|
|
|
|
DEACTIVATE,
|
|
|
|
DESTROY,
|
|
|
|
MAXIMIZE,
|
|
|
|
MINIMIZE,
|
|
|
|
RESIZE,
|
|
|
|
RESTORE,
|
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
|
|
|
enum MaiInterfaceType {
|
|
|
|
MAI_INTERFACE_COMPONENT, /* 0 */
|
|
|
|
MAI_INTERFACE_ACTION,
|
|
|
|
MAI_INTERFACE_VALUE,
|
|
|
|
MAI_INTERFACE_EDITABLE_TEXT,
|
|
|
|
MAI_INTERFACE_HYPERTEXT,
|
|
|
|
MAI_INTERFACE_HYPERLINK_IMPL,
|
|
|
|
MAI_INTERFACE_SELECTION,
|
|
|
|
MAI_INTERFACE_TABLE,
|
|
|
|
MAI_INTERFACE_TEXT,
|
|
|
|
MAI_INTERFACE_DOCUMENT,
|
|
|
|
MAI_INTERFACE_IMAGE /* 10 */
|
|
|
|
};
|
|
|
|
|
|
|
|
static GType GetAtkTypeForMai(MaiInterfaceType type)
|
|
|
|
{
|
|
|
|
switch (type) {
|
|
|
|
case MAI_INTERFACE_COMPONENT:
|
|
|
|
return ATK_TYPE_COMPONENT;
|
|
|
|
case MAI_INTERFACE_ACTION:
|
|
|
|
return ATK_TYPE_ACTION;
|
|
|
|
case MAI_INTERFACE_VALUE:
|
|
|
|
return ATK_TYPE_VALUE;
|
|
|
|
case MAI_INTERFACE_EDITABLE_TEXT:
|
|
|
|
return ATK_TYPE_EDITABLE_TEXT;
|
|
|
|
case MAI_INTERFACE_HYPERTEXT:
|
|
|
|
return ATK_TYPE_HYPERTEXT;
|
|
|
|
case MAI_INTERFACE_HYPERLINK_IMPL:
|
|
|
|
return g_atk_hyperlink_impl_type;
|
|
|
|
case MAI_INTERFACE_SELECTION:
|
|
|
|
return ATK_TYPE_SELECTION;
|
|
|
|
case MAI_INTERFACE_TABLE:
|
|
|
|
return ATK_TYPE_TABLE;
|
|
|
|
case MAI_INTERFACE_TEXT:
|
|
|
|
return ATK_TYPE_TEXT;
|
|
|
|
case MAI_INTERFACE_DOCUMENT:
|
|
|
|
return ATK_TYPE_DOCUMENT;
|
|
|
|
case MAI_INTERFACE_IMAGE:
|
|
|
|
return ATK_TYPE_IMAGE;
|
|
|
|
}
|
|
|
|
return G_TYPE_INVALID;
|
|
|
|
}
|
|
|
|
|
2007-09-18 14:40:04 -07:00
|
|
|
static const char* kNonUserInputEvent = ":system";
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
static const GInterfaceInfo atk_if_infos[] = {
|
|
|
|
{(GInterfaceInitFunc)componentInterfaceInitCB,
|
2013-04-02 17:33:43 -07:00
|
|
|
(GInterfaceFinalizeFunc) nullptr, nullptr},
|
2007-03-22 10:30:00 -07:00
|
|
|
{(GInterfaceInitFunc)actionInterfaceInitCB,
|
2013-04-02 17:33:43 -07:00
|
|
|
(GInterfaceFinalizeFunc) nullptr, nullptr},
|
2007-03-22 10:30:00 -07:00
|
|
|
{(GInterfaceInitFunc)valueInterfaceInitCB,
|
2013-04-02 17:33:43 -07:00
|
|
|
(GInterfaceFinalizeFunc) nullptr, nullptr},
|
2007-03-22 10:30:00 -07:00
|
|
|
{(GInterfaceInitFunc)editableTextInterfaceInitCB,
|
2013-04-02 17:33:43 -07:00
|
|
|
(GInterfaceFinalizeFunc) nullptr, nullptr},
|
2007-03-22 10:30:00 -07:00
|
|
|
{(GInterfaceInitFunc)hypertextInterfaceInitCB,
|
2013-04-02 17:33:43 -07:00
|
|
|
(GInterfaceFinalizeFunc) nullptr, nullptr},
|
2007-03-22 10:30:00 -07:00
|
|
|
{(GInterfaceInitFunc)hyperlinkImplInterfaceInitCB,
|
2013-04-02 17:33:43 -07:00
|
|
|
(GInterfaceFinalizeFunc) nullptr, nullptr},
|
2007-03-22 10:30:00 -07:00
|
|
|
{(GInterfaceInitFunc)selectionInterfaceInitCB,
|
2013-04-02 17:33:43 -07:00
|
|
|
(GInterfaceFinalizeFunc) nullptr, nullptr},
|
2007-03-22 10:30:00 -07:00
|
|
|
{(GInterfaceInitFunc)tableInterfaceInitCB,
|
2013-04-02 17:33:43 -07:00
|
|
|
(GInterfaceFinalizeFunc) nullptr, nullptr},
|
2007-03-22 10:30:00 -07:00
|
|
|
{(GInterfaceInitFunc)textInterfaceInitCB,
|
2013-04-02 17:33:43 -07:00
|
|
|
(GInterfaceFinalizeFunc) nullptr, nullptr},
|
2007-03-22 10:30:00 -07:00
|
|
|
{(GInterfaceInitFunc)documentInterfaceInitCB,
|
2013-04-02 17:33:43 -07:00
|
|
|
(GInterfaceFinalizeFunc) nullptr, nullptr},
|
2007-03-22 10:30:00 -07:00
|
|
|
{(GInterfaceInitFunc)imageInterfaceInitCB,
|
2013-04-02 17:33:43 -07:00
|
|
|
(GInterfaceFinalizeFunc) nullptr, nullptr}
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This MaiAtkObject is a thin wrapper, in the MAI namespace, for AtkObject
|
|
|
|
*/
|
|
|
|
struct MaiAtkObject
|
|
|
|
{
|
2012-05-28 18:18:45 -07:00
|
|
|
AtkObject parent;
|
|
|
|
/*
|
|
|
|
* The AccessibleWrap whose properties and features are exported
|
|
|
|
* via this object instance.
|
|
|
|
*/
|
2014-03-07 13:35:19 -08:00
|
|
|
uintptr_t accWrap;
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
2014-03-07 13:35:19 -08:00
|
|
|
// This is or'd with the pointer in MaiAtkObject::accWrap if the wrap-ee is a
|
|
|
|
// proxy.
|
|
|
|
static const uintptr_t IS_PROXY = 1;
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
struct MaiAtkObjectClass
|
|
|
|
{
|
|
|
|
AtkObjectClass parent_class;
|
|
|
|
};
|
|
|
|
|
|
|
|
static guint mai_atk_object_signals [LAST_SIGNAL] = { 0, };
|
|
|
|
|
2013-04-17 01:29:35 -07:00
|
|
|
static void MaybeFireNameChange(AtkObject* aAtkObj, const nsString& aNewName);
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
G_BEGIN_DECLS
|
|
|
|
/* callbacks for MaiAtkObject */
|
|
|
|
static void classInitCB(AtkObjectClass *aClass);
|
|
|
|
static void initializeCB(AtkObject *aAtkObj, gpointer aData);
|
|
|
|
static void finalizeCB(GObject *aObj);
|
|
|
|
|
|
|
|
/* callbacks for AtkObject virtual functions */
|
|
|
|
static const gchar* getNameCB (AtkObject *aAtkObj);
|
|
|
|
/* getDescriptionCB is also used by image interface */
|
|
|
|
const gchar* getDescriptionCB (AtkObject *aAtkObj);
|
|
|
|
static AtkRole getRoleCB(AtkObject *aAtkObj);
|
|
|
|
static AtkAttributeSet* getAttributesCB(AtkObject *aAtkObj);
|
2013-11-14 00:03:57 -08:00
|
|
|
static const gchar* GetLocaleCB(AtkObject*);
|
2007-03-22 10:30:00 -07:00
|
|
|
static AtkObject* getParentCB(AtkObject *aAtkObj);
|
|
|
|
static gint getChildCountCB(AtkObject *aAtkObj);
|
|
|
|
static AtkObject* refChildCB(AtkObject *aAtkObj, gint aChildIndex);
|
|
|
|
static gint getIndexInParentCB(AtkObject *aAtkObj);
|
|
|
|
static AtkStateSet* refStateSetCB(AtkObject *aAtkObj);
|
|
|
|
static AtkRelationSet* refRelationSetCB(AtkObject *aAtkObj);
|
|
|
|
|
|
|
|
/* the missing atkobject virtual functions */
|
|
|
|
/*
|
|
|
|
static AtkLayer getLayerCB(AtkObject *aAtkObj);
|
|
|
|
static gint getMdiZorderCB(AtkObject *aAtkObj);
|
|
|
|
static void SetNameCB(AtkObject *aAtkObj,
|
|
|
|
const gchar *name);
|
|
|
|
static void SetDescriptionCB(AtkObject *aAtkObj,
|
|
|
|
const gchar *description);
|
|
|
|
static void SetParentCB(AtkObject *aAtkObj,
|
|
|
|
AtkObject *parent);
|
|
|
|
static void SetRoleCB(AtkObject *aAtkObj,
|
|
|
|
AtkRole role);
|
|
|
|
static guint ConnectPropertyChangeHandlerCB(
|
|
|
|
AtkObject *aObj,
|
|
|
|
AtkPropertyChangeHandler *handler);
|
|
|
|
static void RemovePropertyChangeHandlerCB(
|
|
|
|
AtkObject *aAtkObj,
|
|
|
|
guint handler_id);
|
|
|
|
static void InitializeCB(AtkObject *aAtkObj,
|
|
|
|
gpointer data);
|
|
|
|
static void ChildrenChangedCB(AtkObject *aAtkObj,
|
|
|
|
guint change_index,
|
|
|
|
gpointer changed_child);
|
|
|
|
static void FocusEventCB(AtkObject *aAtkObj,
|
|
|
|
gboolean focus_in);
|
|
|
|
static void PropertyChangeCB(AtkObject *aAtkObj,
|
|
|
|
AtkPropertyValues *values);
|
|
|
|
static void StateChangeCB(AtkObject *aAtkObj,
|
|
|
|
const gchar *name,
|
|
|
|
gboolean state_set);
|
|
|
|
static void VisibleDataChangedCB(AtkObject *aAtkObj);
|
|
|
|
*/
|
|
|
|
G_END_DECLS
|
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
static GType GetMaiAtkType(uint16_t interfacesBits);
|
|
|
|
static const char * GetUniqueMaiAtkTypeName(uint16_t interfacesBits);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-04-02 17:33:43 -07:00
|
|
|
static gpointer parent_class = nullptr;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2007-05-28 23:41:14 -07:00
|
|
|
static GQuark quark_mai_hyperlink = 0;
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
GType
|
|
|
|
mai_atk_object_get_type(void)
|
|
|
|
{
|
|
|
|
static GType type = 0;
|
|
|
|
|
|
|
|
if (!type) {
|
|
|
|
static const GTypeInfo tinfo = {
|
|
|
|
sizeof(MaiAtkObjectClass),
|
2013-04-02 17:33:43 -07:00
|
|
|
(GBaseInitFunc)nullptr,
|
|
|
|
(GBaseFinalizeFunc)nullptr,
|
2007-03-22 10:30:00 -07:00
|
|
|
(GClassInitFunc)classInitCB,
|
2013-04-02 17:33:43 -07:00
|
|
|
(GClassFinalizeFunc)nullptr,
|
|
|
|
nullptr, /* class data */
|
2007-03-22 10:30:00 -07:00
|
|
|
sizeof(MaiAtkObject), /* instance size */
|
|
|
|
0, /* nb preallocs */
|
2013-04-02 17:33:43 -07:00
|
|
|
(GInstanceInitFunc)nullptr,
|
|
|
|
nullptr /* value table */
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
type = g_type_register_static(ATK_TYPE_OBJECT,
|
|
|
|
"MaiAtkObject", &tinfo, GTypeFlags(0));
|
2007-05-28 23:41:14 -07:00
|
|
|
quark_mai_hyperlink = g_quark_from_static_string("MaiHyperlink");
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
return type;
|
|
|
|
}
|
|
|
|
|
2012-05-28 18:18:45 -07:00
|
|
|
AccessibleWrap::
|
|
|
|
AccessibleWrap(nsIContent* aContent, DocAccessible* aDoc) :
|
2012-07-30 07:20:58 -07:00
|
|
|
Accessible(aContent, aDoc), mAtkObject(nullptr)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-05-28 18:18:45 -07:00
|
|
|
AccessibleWrap::~AccessibleWrap()
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2008-01-21 21:29:40 -08:00
|
|
|
NS_ASSERTION(!mAtkObject, "ShutdownAtkObject() is not called");
|
2007-05-28 23:41:14 -07:00
|
|
|
}
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-05-28 18:18:45 -07:00
|
|
|
void
|
|
|
|
AccessibleWrap::ShutdownAtkObject()
|
2007-05-28 23:41:14 -07:00
|
|
|
{
|
2007-03-22 10:30:00 -07:00
|
|
|
if (mAtkObject) {
|
|
|
|
if (IS_MAI_OBJECT(mAtkObject)) {
|
2014-03-07 13:35:19 -08:00
|
|
|
MAI_ATK_OBJECT(mAtkObject)->accWrap = 0;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
2012-07-30 07:20:58 -07:00
|
|
|
SetMaiHyperlink(nullptr);
|
2007-03-22 10:30:00 -07:00
|
|
|
g_object_unref(mAtkObject);
|
2012-07-30 07:20:58 -07:00
|
|
|
mAtkObject = nullptr;
|
2007-05-28 23:41:14 -07:00
|
|
|
}
|
2007-07-02 04:18:07 -07:00
|
|
|
}
|
|
|
|
|
2010-06-11 21:04:35 -07:00
|
|
|
void
|
2012-05-28 18:18:45 -07:00
|
|
|
AccessibleWrap::Shutdown()
|
2007-07-02 04:18:07 -07:00
|
|
|
{
|
2012-05-28 18:18:45 -07:00
|
|
|
ShutdownAtkObject();
|
|
|
|
Accessible::Shutdown();
|
2007-05-28 23:41:14 -07:00
|
|
|
}
|
|
|
|
|
2012-05-28 18:18:45 -07:00
|
|
|
MaiHyperlink*
|
|
|
|
AccessibleWrap::GetMaiHyperlink(bool aCreate /* = true */)
|
2007-05-28 23:41:14 -07:00
|
|
|
{
|
|
|
|
// make sure mAtkObject is created
|
|
|
|
GetAtkObject();
|
|
|
|
|
|
|
|
NS_ASSERTION(quark_mai_hyperlink, "quark_mai_hyperlink not initialized");
|
|
|
|
NS_ASSERTION(IS_MAI_OBJECT(mAtkObject), "Invalid AtkObject");
|
2012-07-30 07:20:58 -07:00
|
|
|
MaiHyperlink* maiHyperlink = nullptr;
|
2007-05-28 23:41:14 -07:00
|
|
|
if (quark_mai_hyperlink && IS_MAI_OBJECT(mAtkObject)) {
|
|
|
|
maiHyperlink = (MaiHyperlink*)g_object_get_qdata(G_OBJECT(mAtkObject),
|
|
|
|
quark_mai_hyperlink);
|
|
|
|
if (!maiHyperlink && aCreate) {
|
|
|
|
maiHyperlink = new MaiHyperlink(this);
|
|
|
|
SetMaiHyperlink(maiHyperlink);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return maiHyperlink;
|
|
|
|
}
|
|
|
|
|
2012-05-28 18:18:45 -07:00
|
|
|
void
|
|
|
|
AccessibleWrap::SetMaiHyperlink(MaiHyperlink* aMaiHyperlink)
|
2007-05-28 23:41:14 -07:00
|
|
|
{
|
|
|
|
NS_ASSERTION(quark_mai_hyperlink, "quark_mai_hyperlink not initialized");
|
|
|
|
NS_ASSERTION(IS_MAI_OBJECT(mAtkObject), "Invalid AtkObject");
|
|
|
|
if (quark_mai_hyperlink && IS_MAI_OBJECT(mAtkObject)) {
|
2011-10-17 07:59:28 -07:00
|
|
|
MaiHyperlink* maiHyperlink = GetMaiHyperlink(false);
|
2007-05-28 23:41:14 -07:00
|
|
|
if (!maiHyperlink && !aMaiHyperlink) {
|
|
|
|
return; // Never set and we're shutting down
|
|
|
|
}
|
2011-05-17 07:01:36 -07:00
|
|
|
delete maiHyperlink;
|
2007-05-28 23:41:14 -07:00
|
|
|
g_object_set_qdata(G_OBJECT(mAtkObject), quark_mai_hyperlink,
|
|
|
|
aMaiHyperlink);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-10-21 17:49:28 -07:00
|
|
|
void
|
2012-05-28 18:18:45 -07:00
|
|
|
AccessibleWrap::GetNativeInterface(void** aOutAccessible)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2014-10-21 17:49:28 -07:00
|
|
|
*aOutAccessible = nullptr;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2014-10-21 17:49:28 -07:00
|
|
|
if (!mAtkObject) {
|
|
|
|
if (IsDefunct() || !nsAccUtils::IsEmbeddedObject(this)) {
|
|
|
|
// We don't create ATK objects for node which has been shutdown or
|
|
|
|
// plain text leaves
|
|
|
|
return;
|
|
|
|
}
|
2007-06-04 01:37:33 -07:00
|
|
|
|
2014-10-21 17:49:28 -07:00
|
|
|
GType type = GetMaiAtkType(CreateMaiInterfaces());
|
|
|
|
if (!type)
|
|
|
|
return;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2014-10-21 17:49:28 -07:00
|
|
|
mAtkObject = reinterpret_cast<AtkObject*>(g_object_new(type, nullptr));
|
|
|
|
if (!mAtkObject)
|
|
|
|
return;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2014-10-21 17:49:28 -07:00
|
|
|
atk_object_initialize(mAtkObject, this);
|
|
|
|
mAtkObject->role = ATK_ROLE_INVALID;
|
|
|
|
mAtkObject->layer = ATK_LAYER_INVALID;
|
|
|
|
}
|
|
|
|
|
|
|
|
*aOutAccessible = mAtkObject;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
AtkObject *
|
2012-05-28 18:18:45 -07:00
|
|
|
AccessibleWrap::GetAtkObject(void)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2012-07-30 07:20:58 -07:00
|
|
|
void *atkObj = nullptr;
|
2007-03-22 10:30:00 -07:00
|
|
|
GetNativeInterface(&atkObj);
|
2007-07-08 00:08:04 -07:00
|
|
|
return static_cast<AtkObject *>(atkObj);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2014-10-21 17:49:28 -07:00
|
|
|
// Get AtkObject from Accessible interface
|
2007-06-08 02:09:24 -07:00
|
|
|
/* static */
|
|
|
|
AtkObject *
|
2014-10-21 17:49:28 -07:00
|
|
|
AccessibleWrap::GetAtkObject(Accessible* acc)
|
2007-06-08 02:09:24 -07:00
|
|
|
{
|
2012-07-30 07:20:58 -07:00
|
|
|
void *atkObjPtr = nullptr;
|
2007-06-08 02:09:24 -07:00
|
|
|
acc->GetNativeInterface(&atkObjPtr);
|
2012-07-30 07:20:58 -07:00
|
|
|
return atkObjPtr ? ATK_OBJECT(atkObjPtr) : nullptr;
|
2007-06-08 02:09:24 -07:00
|
|
|
}
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
/* private */
|
2012-08-22 08:56:38 -07:00
|
|
|
uint16_t
|
2012-05-28 18:18:45 -07:00
|
|
|
AccessibleWrap::CreateMaiInterfaces(void)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2012-08-22 08:56:38 -07:00
|
|
|
uint16_t interfacesBits = 0;
|
2014-10-21 17:49:28 -07:00
|
|
|
|
2012-05-22 09:40:56 -07:00
|
|
|
// The Component interface is supported by all accessibles.
|
|
|
|
interfacesBits |= 1 << MAI_INTERFACE_COMPONENT;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-06-05 12:35:43 -07:00
|
|
|
// Add Action interface if the action count is more than zero.
|
|
|
|
if (ActionCount() > 0)
|
|
|
|
interfacesBits |= 1 << MAI_INTERFACE_ACTION;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-05-22 09:40:56 -07:00
|
|
|
// Text, Editabletext, and Hypertext interface.
|
2012-05-31 01:04:41 -07:00
|
|
|
HyperTextAccessible* hyperText = AsHyperText();
|
2012-05-22 09:40:56 -07:00
|
|
|
if (hyperText && hyperText->IsTextRole()) {
|
|
|
|
interfacesBits |= 1 << MAI_INTERFACE_TEXT;
|
|
|
|
interfacesBits |= 1 << MAI_INTERFACE_EDITABLE_TEXT;
|
|
|
|
if (!nsAccUtils::MustPrune(this))
|
|
|
|
interfacesBits |= 1 << MAI_INTERFACE_HYPERTEXT;
|
|
|
|
}
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-05-22 09:40:56 -07:00
|
|
|
// Value interface.
|
2014-10-21 17:49:28 -07:00
|
|
|
if (HasNumericValue())
|
|
|
|
interfacesBits |= 1 << MAI_INTERFACE_VALUE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-05-22 09:40:56 -07:00
|
|
|
// Document interface.
|
|
|
|
if (IsDoc())
|
|
|
|
interfacesBits |= 1 << MAI_INTERFACE_DOCUMENT;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-05-22 09:40:56 -07:00
|
|
|
if (IsImage())
|
|
|
|
interfacesBits |= 1 << MAI_INTERFACE_IMAGE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-05-22 09:40:56 -07:00
|
|
|
// HyperLink interface.
|
2011-06-23 21:29:43 -07:00
|
|
|
if (IsLink())
|
|
|
|
interfacesBits |= 1 << MAI_INTERFACE_HYPERLINK_IMPL;
|
2007-08-03 19:15:52 -07:00
|
|
|
|
2012-05-22 09:40:56 -07:00
|
|
|
if (!nsAccUtils::MustPrune(this)) { // These interfaces require children
|
|
|
|
// Table interface.
|
2012-08-20 07:54:33 -07:00
|
|
|
if (AsTable())
|
2012-05-22 09:40:56 -07:00
|
|
|
interfacesBits |= 1 << MAI_INTERFACE_TABLE;
|
2012-08-20 07:54:33 -07:00
|
|
|
|
2012-05-22 09:40:56 -07:00
|
|
|
// Selection interface.
|
|
|
|
if (IsSelect()) {
|
|
|
|
interfacesBits |= 1 << MAI_INTERFACE_SELECTION;
|
2007-08-03 19:15:52 -07:00
|
|
|
}
|
2012-05-22 09:40:56 -07:00
|
|
|
}
|
2007-08-03 19:15:52 -07:00
|
|
|
|
2012-05-22 09:40:56 -07:00
|
|
|
return interfacesBits;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static GType
|
2012-08-22 08:56:38 -07:00
|
|
|
GetMaiAtkType(uint16_t interfacesBits)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
GType type;
|
|
|
|
static const GTypeInfo tinfo = {
|
|
|
|
sizeof(MaiAtkObjectClass),
|
2013-04-02 17:33:43 -07:00
|
|
|
(GBaseInitFunc) nullptr,
|
|
|
|
(GBaseFinalizeFunc) nullptr,
|
|
|
|
(GClassInitFunc) nullptr,
|
|
|
|
(GClassFinalizeFunc) nullptr,
|
|
|
|
nullptr, /* class data */
|
2007-03-22 10:30:00 -07:00
|
|
|
sizeof(MaiAtkObject), /* instance size */
|
|
|
|
0, /* nb preallocs */
|
2013-04-02 17:33:43 -07:00
|
|
|
(GInstanceInitFunc) nullptr,
|
|
|
|
nullptr /* value table */
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The members we use to register GTypes are GetAtkTypeForMai
|
|
|
|
* and atk_if_infos, which are constant values to each MaiInterface
|
|
|
|
* So we can reuse the registered GType when having
|
|
|
|
* the same MaiInterface types.
|
|
|
|
*/
|
|
|
|
const char *atkTypeName = GetUniqueMaiAtkTypeName(interfacesBits);
|
|
|
|
type = g_type_from_name(atkTypeName);
|
|
|
|
if (type) {
|
|
|
|
return type;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* gobject limits the number of types that can directly derive from any
|
|
|
|
* given object type to 4095.
|
|
|
|
*/
|
2012-08-22 08:56:38 -07:00
|
|
|
static uint16_t typeRegCount = 0;
|
2007-03-22 10:30:00 -07:00
|
|
|
if (typeRegCount++ >= 4095) {
|
|
|
|
return G_TYPE_INVALID;
|
|
|
|
}
|
|
|
|
type = g_type_register_static(MAI_TYPE_ATK_OBJECT,
|
|
|
|
atkTypeName,
|
|
|
|
&tinfo, GTypeFlags(0));
|
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
for (uint32_t index = 0; index < ArrayLength(atk_if_infos); index++) {
|
2007-03-22 10:30:00 -07:00
|
|
|
if (interfacesBits & (1 << index)) {
|
|
|
|
g_type_add_interface_static(type,
|
|
|
|
GetAtkTypeForMai((MaiInterfaceType)index),
|
|
|
|
&atk_if_infos[index]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return type;
|
|
|
|
}
|
|
|
|
|
2012-05-28 18:18:45 -07:00
|
|
|
static const char*
|
2012-08-22 08:56:38 -07:00
|
|
|
GetUniqueMaiAtkTypeName(uint16_t interfacesBits)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2012-08-22 08:56:38 -07:00
|
|
|
#define MAI_ATK_TYPE_NAME_LEN (30) /* 10+sizeof(uint16_t)*8/4+1 < 30 */
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
static gchar namePrefix[] = "MaiAtkType"; /* size = 10 */
|
|
|
|
static gchar name[MAI_ATK_TYPE_NAME_LEN + 1];
|
|
|
|
|
|
|
|
PR_snprintf(name, MAI_ATK_TYPE_NAME_LEN, "%s%x", namePrefix,
|
|
|
|
interfacesBits);
|
|
|
|
name[MAI_ATK_TYPE_NAME_LEN] = '\0';
|
|
|
|
|
|
|
|
return name;
|
|
|
|
}
|
|
|
|
|
2012-05-28 18:18:45 -07:00
|
|
|
bool
|
|
|
|
AccessibleWrap::IsValidObject()
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
// to ensure we are not shut down
|
2010-06-11 01:23:18 -07:00
|
|
|
return !IsDefunct();
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* static functions for ATK callbacks */
|
|
|
|
void
|
|
|
|
classInitCB(AtkObjectClass *aClass)
|
|
|
|
{
|
|
|
|
GObjectClass *gobject_class = G_OBJECT_CLASS(aClass);
|
|
|
|
|
|
|
|
parent_class = g_type_class_peek_parent(aClass);
|
|
|
|
|
|
|
|
aClass->get_name = getNameCB;
|
|
|
|
aClass->get_description = getDescriptionCB;
|
|
|
|
aClass->get_parent = getParentCB;
|
|
|
|
aClass->get_n_children = getChildCountCB;
|
|
|
|
aClass->ref_child = refChildCB;
|
|
|
|
aClass->get_index_in_parent = getIndexInParentCB;
|
|
|
|
aClass->get_role = getRoleCB;
|
|
|
|
aClass->get_attributes = getAttributesCB;
|
2013-11-14 00:03:57 -08:00
|
|
|
aClass->get_object_locale = GetLocaleCB;
|
2007-03-22 10:30:00 -07:00
|
|
|
aClass->ref_state_set = refStateSetCB;
|
|
|
|
aClass->ref_relation_set = refRelationSetCB;
|
|
|
|
|
|
|
|
aClass->initialize = initializeCB;
|
|
|
|
|
|
|
|
gobject_class->finalize = finalizeCB;
|
|
|
|
|
|
|
|
mai_atk_object_signals [ACTIVATE] =
|
|
|
|
g_signal_new ("activate",
|
|
|
|
MAI_TYPE_ATK_OBJECT,
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
0, /* default signal handler */
|
2013-04-02 17:33:43 -07:00
|
|
|
nullptr, nullptr,
|
2007-03-22 10:30:00 -07:00
|
|
|
g_cclosure_marshal_VOID__VOID,
|
|
|
|
G_TYPE_NONE, 0);
|
|
|
|
mai_atk_object_signals [CREATE] =
|
|
|
|
g_signal_new ("create",
|
|
|
|
MAI_TYPE_ATK_OBJECT,
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
0, /* default signal handler */
|
2013-04-02 17:33:43 -07:00
|
|
|
nullptr, nullptr,
|
2007-03-22 10:30:00 -07:00
|
|
|
g_cclosure_marshal_VOID__VOID,
|
|
|
|
G_TYPE_NONE, 0);
|
|
|
|
mai_atk_object_signals [DEACTIVATE] =
|
|
|
|
g_signal_new ("deactivate",
|
|
|
|
MAI_TYPE_ATK_OBJECT,
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
0, /* default signal handler */
|
2013-04-02 17:33:43 -07:00
|
|
|
nullptr, nullptr,
|
2007-03-22 10:30:00 -07:00
|
|
|
g_cclosure_marshal_VOID__VOID,
|
|
|
|
G_TYPE_NONE, 0);
|
|
|
|
mai_atk_object_signals [DESTROY] =
|
|
|
|
g_signal_new ("destroy",
|
|
|
|
MAI_TYPE_ATK_OBJECT,
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
0, /* default signal handler */
|
2013-04-02 17:33:43 -07:00
|
|
|
nullptr, nullptr,
|
2007-03-22 10:30:00 -07:00
|
|
|
g_cclosure_marshal_VOID__VOID,
|
|
|
|
G_TYPE_NONE, 0);
|
|
|
|
mai_atk_object_signals [MAXIMIZE] =
|
|
|
|
g_signal_new ("maximize",
|
|
|
|
MAI_TYPE_ATK_OBJECT,
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
0, /* default signal handler */
|
2013-04-02 17:33:43 -07:00
|
|
|
nullptr, nullptr,
|
2007-03-22 10:30:00 -07:00
|
|
|
g_cclosure_marshal_VOID__VOID,
|
|
|
|
G_TYPE_NONE, 0);
|
|
|
|
mai_atk_object_signals [MINIMIZE] =
|
|
|
|
g_signal_new ("minimize",
|
|
|
|
MAI_TYPE_ATK_OBJECT,
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
0, /* default signal handler */
|
2013-04-02 17:33:43 -07:00
|
|
|
nullptr, nullptr,
|
2007-03-22 10:30:00 -07:00
|
|
|
g_cclosure_marshal_VOID__VOID,
|
|
|
|
G_TYPE_NONE, 0);
|
|
|
|
mai_atk_object_signals [RESIZE] =
|
|
|
|
g_signal_new ("resize",
|
|
|
|
MAI_TYPE_ATK_OBJECT,
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
0, /* default signal handler */
|
2013-04-02 17:33:43 -07:00
|
|
|
nullptr, nullptr,
|
2007-03-22 10:30:00 -07:00
|
|
|
g_cclosure_marshal_VOID__VOID,
|
|
|
|
G_TYPE_NONE, 0);
|
|
|
|
mai_atk_object_signals [RESTORE] =
|
|
|
|
g_signal_new ("restore",
|
|
|
|
MAI_TYPE_ATK_OBJECT,
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
0, /* default signal handler */
|
2013-04-02 17:33:43 -07:00
|
|
|
nullptr, nullptr,
|
2007-03-22 10:30:00 -07:00
|
|
|
g_cclosure_marshal_VOID__VOID,
|
|
|
|
G_TYPE_NONE, 0);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
initializeCB(AtkObject *aAtkObj, gpointer aData)
|
|
|
|
{
|
|
|
|
NS_ASSERTION((IS_MAI_OBJECT(aAtkObj)), "Invalid AtkObject");
|
|
|
|
NS_ASSERTION(aData, "Invalid Data to init AtkObject");
|
|
|
|
if (!aAtkObj || !aData)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* call parent init function */
|
|
|
|
/* AtkObjectClass has not a "initialize" function now,
|
|
|
|
* maybe it has later
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (ATK_OBJECT_CLASS(parent_class)->initialize)
|
|
|
|
ATK_OBJECT_CLASS(parent_class)->initialize(aAtkObj, aData);
|
|
|
|
|
2012-05-28 18:18:45 -07:00
|
|
|
/* initialize object */
|
2014-03-07 13:35:19 -08:00
|
|
|
MAI_ATK_OBJECT(aAtkObj)->accWrap = reinterpret_cast<uintptr_t>(aData);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
finalizeCB(GObject *aObj)
|
|
|
|
{
|
|
|
|
if (!IS_MAI_OBJECT(aObj))
|
|
|
|
return;
|
2014-03-07 13:35:19 -08:00
|
|
|
NS_ASSERTION(MAI_ATK_OBJECT(aObj)->accWrap == 0, "AccWrap NOT null");
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// call parent finalize function
|
|
|
|
// finalize of GObjectClass will unref the accessible parent if has
|
|
|
|
if (G_OBJECT_CLASS (parent_class)->finalize)
|
|
|
|
G_OBJECT_CLASS (parent_class)->finalize(aObj);
|
|
|
|
}
|
|
|
|
|
2012-04-30 20:08:31 -07:00
|
|
|
const gchar*
|
|
|
|
getNameCB(AtkObject* aAtkObj)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2014-09-23 02:53:03 -07:00
|
|
|
nsAutoString name;
|
2012-05-28 18:18:45 -07:00
|
|
|
AccessibleWrap* accWrap = GetAccessibleWrap(aAtkObj);
|
2014-09-23 02:53:03 -07:00
|
|
|
if (accWrap)
|
|
|
|
accWrap->Name(name);
|
|
|
|
else if (ProxyAccessible* proxy = GetProxy(aAtkObj))
|
|
|
|
proxy->Name(name);
|
|
|
|
else
|
2012-07-30 07:20:58 -07:00
|
|
|
return nullptr;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-04-17 01:29:35 -07:00
|
|
|
// XXX Firing an event from here does not seem right
|
|
|
|
MaybeFireNameChange(aAtkObj, name);
|
2012-04-30 20:08:31 -07:00
|
|
|
|
|
|
|
return aAtkObj->name;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2013-04-17 01:29:35 -07:00
|
|
|
static void
|
|
|
|
MaybeFireNameChange(AtkObject* aAtkObj, const nsString& aNewName)
|
|
|
|
{
|
|
|
|
NS_ConvertUTF16toUTF8 newNameUTF8(aNewName);
|
|
|
|
if (aAtkObj->name && newNameUTF8.Equals(aAtkObj->name))
|
|
|
|
return;
|
|
|
|
|
|
|
|
// Below we duplicate the functionality of atk_object_set_name(),
|
|
|
|
// but without calling atk_object_get_name(). Instead of
|
|
|
|
// atk_object_get_name() we directly access aAtkObj->name. This is because
|
|
|
|
// atk_object_get_name() would call getNameCB() which would call
|
|
|
|
// MaybeFireNameChange() (or atk_object_set_name() before this problem was
|
|
|
|
// fixed) and we would get an infinite recursion.
|
|
|
|
// See http://bugzilla.mozilla.org/733712
|
|
|
|
|
|
|
|
// Do not notify for initial name setting.
|
|
|
|
// See bug http://bugzilla.gnome.org/665870
|
|
|
|
bool notify = !!aAtkObj->name;
|
|
|
|
|
|
|
|
free(aAtkObj->name);
|
|
|
|
aAtkObj->name = strdup(newNameUTF8.get());
|
|
|
|
|
|
|
|
if (notify)
|
|
|
|
g_object_notify(G_OBJECT(aAtkObj), "accessible-name");
|
|
|
|
}
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
const gchar *
|
|
|
|
getDescriptionCB(AtkObject *aAtkObj)
|
|
|
|
{
|
2014-10-23 20:21:44 -07:00
|
|
|
nsAutoString uniDesc;
|
|
|
|
AccessibleWrap* accWrap = GetAccessibleWrap(aAtkObj);
|
|
|
|
if (accWrap) {
|
|
|
|
if (accWrap->IsDefunct())
|
|
|
|
return nullptr;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-04-23 06:14:05 -07:00
|
|
|
accWrap->Description(uniDesc);
|
2014-10-23 20:21:44 -07:00
|
|
|
} else if (ProxyAccessible* proxy = GetProxy(aAtkObj)) {
|
|
|
|
proxy->Description(uniDesc);
|
|
|
|
} else {
|
|
|
|
return nullptr;
|
|
|
|
}
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2007-06-08 02:09:24 -07:00
|
|
|
NS_ConvertUTF8toUTF16 objDesc(aAtkObj->description);
|
2011-04-23 06:14:05 -07:00
|
|
|
if (!uniDesc.Equals(objDesc))
|
2007-06-08 02:09:24 -07:00
|
|
|
atk_object_set_description(aAtkObj,
|
|
|
|
NS_ConvertUTF16toUTF8(uniDesc).get());
|
2011-04-23 06:14:05 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
return aAtkObj->description;
|
|
|
|
}
|
|
|
|
|
|
|
|
AtkRole
|
|
|
|
getRoleCB(AtkObject *aAtkObj)
|
|
|
|
{
|
2014-03-07 13:35:19 -08:00
|
|
|
if (aAtkObj->role != ATK_ROLE_INVALID)
|
|
|
|
return aAtkObj->role;
|
2014-10-01 05:41:56 -07:00
|
|
|
|
2014-03-07 13:35:19 -08:00
|
|
|
AccessibleWrap* accWrap = GetAccessibleWrap(aAtkObj);
|
|
|
|
a11y::role role;
|
|
|
|
if (!accWrap) {
|
|
|
|
ProxyAccessible* proxy = GetProxy(aAtkObj);
|
|
|
|
if (!proxy)
|
|
|
|
return ATK_ROLE_INVALID;
|
|
|
|
|
|
|
|
role = proxy->Role();
|
|
|
|
} else {
|
2012-05-07 16:49:41 -07:00
|
|
|
#ifdef DEBUG
|
2014-03-07 13:35:19 -08:00
|
|
|
NS_ASSERTION(nsAccUtils::IsTextInterfaceSupportCorrect(accWrap),
|
2014-10-21 17:49:28 -07:00
|
|
|
"Does not support Text interface when it should");
|
2007-03-22 10:30:00 -07:00
|
|
|
#endif
|
|
|
|
|
2014-03-07 13:35:19 -08:00
|
|
|
role = accWrap->Role();
|
|
|
|
}
|
2012-04-26 11:25:33 -07:00
|
|
|
|
2012-07-21 11:32:25 -07:00
|
|
|
#define ROLE(geckoRole, stringRole, atkRole, macRole, \
|
|
|
|
msaaRole, ia2Role, nameRule) \
|
2012-05-02 04:13:34 -07:00
|
|
|
case roles::geckoRole: \
|
|
|
|
aAtkObj->role = atkRole; \
|
|
|
|
break;
|
|
|
|
|
2014-03-07 13:35:19 -08:00
|
|
|
switch (role) {
|
2012-05-02 04:13:34 -07:00
|
|
|
#include "RoleMap.h"
|
|
|
|
default:
|
2013-06-28 18:38:30 -07:00
|
|
|
MOZ_CRASH("Unknown role.");
|
2012-05-02 04:13:34 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
#undef ROLE
|
|
|
|
|
2014-02-04 13:29:12 -08:00
|
|
|
if (aAtkObj->role == ATK_ROLE_LIST_BOX && !IsAtkVersionAtLeast(2, 1))
|
|
|
|
aAtkObj->role = ATK_ROLE_LIST;
|
2014-02-12 07:07:48 -08:00
|
|
|
else if (aAtkObj->role == ATK_ROLE_TABLE_ROW && !IsAtkVersionAtLeast(2, 1))
|
|
|
|
aAtkObj->role = ATK_ROLE_LIST_ITEM;
|
2014-02-04 13:29:12 -08:00
|
|
|
|
2012-05-02 04:13:34 -07:00
|
|
|
return aAtkObj->role;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2013-11-18 10:52:21 -08:00
|
|
|
static AtkAttributeSet*
|
2008-07-17 05:06:24 -07:00
|
|
|
ConvertToAtkAttributeSet(nsIPersistentProperties* aAttributes)
|
|
|
|
{
|
|
|
|
if (!aAttributes)
|
2012-07-30 07:20:58 -07:00
|
|
|
return nullptr;
|
2008-07-17 05:06:24 -07:00
|
|
|
|
2012-07-30 07:20:58 -07:00
|
|
|
AtkAttributeSet *objAttributeSet = nullptr;
|
2008-07-17 05:06:24 -07:00
|
|
|
nsCOMPtr<nsISimpleEnumerator> propEnum;
|
|
|
|
nsresult rv = aAttributes->Enumerate(getter_AddRefs(propEnum));
|
2012-07-30 07:20:58 -07:00
|
|
|
NS_ENSURE_SUCCESS(rv, nullptr);
|
2008-07-17 05:06:24 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool hasMore;
|
2008-07-17 05:06:24 -07:00
|
|
|
while (NS_SUCCEEDED(propEnum->HasMoreElements(&hasMore)) && hasMore) {
|
|
|
|
nsCOMPtr<nsISupports> sup;
|
|
|
|
rv = propEnum->GetNext(getter_AddRefs(sup));
|
|
|
|
NS_ENSURE_SUCCESS(rv, objAttributeSet);
|
|
|
|
|
|
|
|
nsCOMPtr<nsIPropertyElement> propElem(do_QueryInterface(sup));
|
|
|
|
NS_ENSURE_TRUE(propElem, objAttributeSet);
|
|
|
|
|
2012-09-01 19:35:17 -07:00
|
|
|
nsAutoCString name;
|
2008-07-17 05:06:24 -07:00
|
|
|
rv = propElem->GetKey(name);
|
|
|
|
NS_ENSURE_SUCCESS(rv, objAttributeSet);
|
|
|
|
|
|
|
|
nsAutoString value;
|
|
|
|
rv = propElem->GetValue(value);
|
|
|
|
NS_ENSURE_SUCCESS(rv, objAttributeSet);
|
|
|
|
|
|
|
|
AtkAttribute *objAttr = (AtkAttribute *)g_malloc(sizeof(AtkAttribute));
|
|
|
|
objAttr->name = g_strdup(name.get());
|
|
|
|
objAttr->value = g_strdup(NS_ConvertUTF16toUTF8(value).get());
|
|
|
|
objAttributeSet = g_slist_prepend(objAttributeSet, objAttr);
|
|
|
|
}
|
|
|
|
|
|
|
|
//libspi will free it
|
|
|
|
return objAttributeSet;
|
|
|
|
}
|
|
|
|
|
2011-04-09 16:38:06 -07:00
|
|
|
AtkAttributeSet*
|
2012-05-28 18:18:45 -07:00
|
|
|
GetAttributeSet(Accessible* aAccessible)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2012-10-19 00:15:23 -07:00
|
|
|
nsCOMPtr<nsIPersistentProperties> attributes = aAccessible->Attributes();
|
|
|
|
if (attributes) {
|
|
|
|
// There is no ATK state for haspopup, must use object attribute to expose
|
|
|
|
// the same info.
|
|
|
|
if (aAccessible->State() & states::HASPOPUP) {
|
|
|
|
nsAutoString unused;
|
|
|
|
attributes->SetStringProperty(NS_LITERAL_CSTRING("haspopup"),
|
|
|
|
NS_LITERAL_STRING("true"), unused);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2012-10-19 00:15:23 -07:00
|
|
|
return ConvertToAtkAttributeSet(attributes);
|
|
|
|
}
|
|
|
|
|
|
|
|
return nullptr;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
AtkAttributeSet *
|
|
|
|
getAttributesCB(AtkObject *aAtkObj)
|
|
|
|
{
|
2012-05-28 18:18:45 -07:00
|
|
|
AccessibleWrap* accWrap = GetAccessibleWrap(aAtkObj);
|
2014-10-24 02:29:48 -07:00
|
|
|
if (accWrap)
|
|
|
|
return GetAttributeSet(accWrap);
|
|
|
|
|
|
|
|
ProxyAccessible* proxy = GetProxy(aAtkObj);
|
|
|
|
if (!proxy)
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
nsAutoTArray<Attribute, 10> attrs;
|
|
|
|
proxy->Attributes(&attrs);
|
|
|
|
if (attrs.IsEmpty())
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
AtkAttributeSet* objAttributeSet = nullptr;
|
|
|
|
for (uint32_t i = 0; i < attrs.Length(); i++) {
|
|
|
|
AtkAttribute *objAttr = (AtkAttribute *)g_malloc(sizeof(AtkAttribute));
|
|
|
|
objAttr->name = g_strdup(attrs[i].Name().get());
|
|
|
|
objAttr->value = g_strdup(NS_ConvertUTF16toUTF8(attrs[i].Value()).get());
|
|
|
|
objAttributeSet = g_slist_prepend(objAttributeSet, objAttr);
|
|
|
|
}
|
|
|
|
|
|
|
|
return objAttributeSet;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2013-11-14 00:03:57 -08:00
|
|
|
const gchar*
|
|
|
|
GetLocaleCB(AtkObject* aAtkObj)
|
|
|
|
{
|
|
|
|
AccessibleWrap* accWrap = GetAccessibleWrap(aAtkObj);
|
|
|
|
if (!accWrap)
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
nsAutoString locale;
|
|
|
|
accWrap->Language(locale);
|
|
|
|
return AccessibleWrap::ReturnString(locale);
|
|
|
|
}
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
AtkObject *
|
|
|
|
getParentCB(AtkObject *aAtkObj)
|
|
|
|
{
|
2014-09-23 05:00:15 -07:00
|
|
|
if (aAtkObj->accessible_parent)
|
|
|
|
return aAtkObj->accessible_parent;
|
|
|
|
|
|
|
|
AtkObject* atkParent = nullptr;
|
|
|
|
if (AccessibleWrap* wrapper = GetAccessibleWrap(aAtkObj)) {
|
|
|
|
Accessible* parent = wrapper->Parent();
|
|
|
|
atkParent = parent ? AccessibleWrap::GetAtkObject(parent) : nullptr;
|
|
|
|
} else if (ProxyAccessible* proxy = GetProxy(aAtkObj)) {
|
|
|
|
ProxyAccessible* parent = proxy->Parent();
|
|
|
|
atkParent = parent ? GetWrapperFor(parent) : nullptr;
|
|
|
|
}
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2014-09-23 05:00:15 -07:00
|
|
|
if (atkParent)
|
|
|
|
atk_object_set_parent(aAtkObj, atkParent);
|
2007-06-04 02:39:15 -07:00
|
|
|
|
2011-07-23 01:38:33 -07:00
|
|
|
return aAtkObj->accessible_parent;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
gint
|
|
|
|
getChildCountCB(AtkObject *aAtkObj)
|
|
|
|
{
|
2012-05-28 18:18:45 -07:00
|
|
|
AccessibleWrap* accWrap = GetAccessibleWrap(aAtkObj);
|
2008-10-17 03:10:43 -07:00
|
|
|
if (!accWrap || nsAccUtils::MustPrune(accWrap)) {
|
2007-06-08 02:09:24 -07:00
|
|
|
return 0;
|
|
|
|
}
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-05-25 03:53:45 -07:00
|
|
|
return static_cast<gint>(accWrap->EmbeddedChildCount());
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
AtkObject *
|
|
|
|
refChildCB(AtkObject *aAtkObj, gint aChildIndex)
|
|
|
|
{
|
|
|
|
// aChildIndex should not be less than zero
|
|
|
|
if (aChildIndex < 0) {
|
2012-07-30 07:20:58 -07:00
|
|
|
return nullptr;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2012-05-28 18:18:45 -07:00
|
|
|
AccessibleWrap* accWrap = GetAccessibleWrap(aAtkObj);
|
2008-10-17 03:10:43 -07:00
|
|
|
if (!accWrap || nsAccUtils::MustPrune(accWrap)) {
|
2012-07-30 07:20:58 -07:00
|
|
|
return nullptr;
|
2007-06-08 02:09:24 -07:00
|
|
|
}
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-05-28 18:18:45 -07:00
|
|
|
Accessible* accChild = accWrap->GetEmbeddedChildAt(aChildIndex);
|
2007-08-06 23:10:31 -07:00
|
|
|
if (!accChild)
|
2012-07-30 07:20:58 -07:00
|
|
|
return nullptr;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-05-28 18:18:45 -07:00
|
|
|
AtkObject* childAtkObj = AccessibleWrap::GetAtkObject(accChild);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2007-06-08 02:09:24 -07:00
|
|
|
NS_ASSERTION(childAtkObj, "Fail to get AtkObj");
|
|
|
|
if (!childAtkObj)
|
2012-07-30 07:20:58 -07:00
|
|
|
return nullptr;
|
2010-01-05 22:56:56 -08:00
|
|
|
g_object_ref(childAtkObj);
|
2012-02-27 12:30:32 -08:00
|
|
|
|
|
|
|
if (aAtkObj != childAtkObj->accessible_parent)
|
2007-06-04 02:39:15 -07:00
|
|
|
atk_object_set_parent(childAtkObj, aAtkObj);
|
2012-02-27 12:30:32 -08:00
|
|
|
|
|
|
|
return childAtkObj;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
gint
|
2014-10-21 17:49:28 -07:00
|
|
|
getIndexInParentCB(AtkObject* aAtkObj)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2014-10-21 17:49:28 -07:00
|
|
|
// We don't use Accessible::IndexInParent() because we don't include text
|
|
|
|
// leaf nodes as children in ATK.
|
2012-05-28 18:18:45 -07:00
|
|
|
AccessibleWrap* accWrap = GetAccessibleWrap(aAtkObj);
|
2007-06-08 02:09:24 -07:00
|
|
|
if (!accWrap) {
|
|
|
|
return -1;
|
|
|
|
}
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-05-28 18:18:45 -07:00
|
|
|
Accessible* parent = accWrap->Parent();
|
2011-07-23 01:38:33 -07:00
|
|
|
if (!parent)
|
2007-03-22 10:30:00 -07:00
|
|
|
return -1; // No parent
|
|
|
|
|
2010-08-15 04:29:02 -07:00
|
|
|
return parent->GetIndexOfEmbeddedChild(accWrap);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2011-04-09 16:38:06 -07:00
|
|
|
static void
|
2012-08-22 08:56:38 -07:00
|
|
|
TranslateStates(uint64_t aState, AtkStateSet* aStateSet)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2014-01-21 08:24:23 -08:00
|
|
|
// atk doesn't have a read only state so read only things shouldn't be
|
|
|
|
// editable.
|
|
|
|
if (aState & states::READONLY)
|
|
|
|
aState &= ~states::EDITABLE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// Convert every state to an entry in AtkStateMap
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t stateIndex = 0;
|
|
|
|
uint64_t bitMask = 1;
|
2011-04-09 16:38:06 -07:00
|
|
|
while (gAtkStateMap[stateIndex].stateMapEntryType != kNoSuchState) {
|
|
|
|
if (gAtkStateMap[stateIndex].atkState) { // There's potentially an ATK state for this
|
2011-09-28 23:19:26 -07:00
|
|
|
bool isStateOn = (aState & bitMask) != 0;
|
2011-04-09 16:38:06 -07:00
|
|
|
if (gAtkStateMap[stateIndex].stateMapEntryType == kMapOpposite) {
|
2007-03-22 10:30:00 -07:00
|
|
|
isStateOn = !isStateOn;
|
|
|
|
}
|
|
|
|
if (isStateOn) {
|
2011-04-09 16:38:06 -07:00
|
|
|
atk_state_set_add_state(aStateSet, gAtkStateMap[stateIndex].atkState);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
bitMask <<= 1;
|
|
|
|
++ stateIndex;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
AtkStateSet *
|
|
|
|
refStateSetCB(AtkObject *aAtkObj)
|
|
|
|
{
|
2014-09-23 01:35:33 -07:00
|
|
|
AtkStateSet *state_set = nullptr;
|
|
|
|
state_set = ATK_OBJECT_CLASS(parent_class)->ref_state_set(aAtkObj);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2014-09-23 01:35:33 -07:00
|
|
|
AccessibleWrap* accWrap = GetAccessibleWrap(aAtkObj);
|
|
|
|
if (accWrap)
|
2011-04-09 16:38:06 -07:00
|
|
|
TranslateStates(accWrap->State(), state_set);
|
2014-09-23 01:35:33 -07:00
|
|
|
else if (ProxyAccessible* proxy = GetProxy(aAtkObj))
|
|
|
|
TranslateStates(proxy->State(), state_set);
|
|
|
|
else
|
|
|
|
TranslateStates(states::DEFUNCT, state_set);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2014-09-23 01:35:33 -07:00
|
|
|
return state_set;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2013-10-22 16:55:27 -07:00
|
|
|
static void
|
|
|
|
UpdateAtkRelation(RelationType aType, Accessible* aAcc,
|
|
|
|
AtkRelationType aAtkType, AtkRelationSet* aAtkSet)
|
|
|
|
{
|
|
|
|
if (aAtkType == ATK_RELATION_NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
AtkRelation* atkRelation =
|
|
|
|
atk_relation_set_get_relation_by_type(aAtkSet, aAtkType);
|
|
|
|
if (atkRelation)
|
|
|
|
atk_relation_set_remove(aAtkSet, atkRelation);
|
|
|
|
|
|
|
|
Relation rel(aAcc->RelationByType(aType));
|
|
|
|
nsTArray<AtkObject*> targets;
|
|
|
|
Accessible* tempAcc = nullptr;
|
|
|
|
while ((tempAcc = rel.Next()))
|
|
|
|
targets.AppendElement(AccessibleWrap::GetAtkObject(tempAcc));
|
|
|
|
|
|
|
|
if (targets.Length()) {
|
|
|
|
atkRelation = atk_relation_new(targets.Elements(),
|
|
|
|
targets.Length(), aAtkType);
|
|
|
|
atk_relation_set_add(aAtkSet, atkRelation);
|
|
|
|
g_object_unref(atkRelation);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
AtkRelationSet *
|
|
|
|
refRelationSetCB(AtkObject *aAtkObj)
|
|
|
|
{
|
2011-08-09 18:44:00 -07:00
|
|
|
AtkRelationSet* relation_set =
|
|
|
|
ATK_OBJECT_CLASS(parent_class)->ref_relation_set(aAtkObj);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-05-28 18:18:45 -07:00
|
|
|
AccessibleWrap* accWrap = GetAccessibleWrap(aAtkObj);
|
2011-08-09 18:44:00 -07:00
|
|
|
if (!accWrap)
|
|
|
|
return relation_set;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-10-22 16:55:27 -07:00
|
|
|
#define RELATIONTYPE(geckoType, geckoTypeName, atkType, msaaType, ia2Type) \
|
|
|
|
UpdateAtkRelation(RelationType::geckoType, accWrap, atkType, relation_set);
|
2011-08-09 18:44:00 -07:00
|
|
|
|
2013-10-22 16:55:27 -07:00
|
|
|
#include "RelationTypeMap.h"
|
|
|
|
|
|
|
|
#undef RELATIONTYPE
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-08-09 18:44:00 -07:00
|
|
|
return relation_set;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2012-05-28 18:18:45 -07:00
|
|
|
// Check if aAtkObj is a valid MaiAtkObject, and return the AccessibleWrap
|
2007-06-08 02:09:24 -07:00
|
|
|
// for it.
|
2012-05-28 18:18:45 -07:00
|
|
|
AccessibleWrap*
|
|
|
|
GetAccessibleWrap(AtkObject* aAtkObj)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2012-07-30 07:20:58 -07:00
|
|
|
NS_ENSURE_TRUE(IS_MAI_OBJECT(aAtkObj), nullptr);
|
2014-03-07 13:35:19 -08:00
|
|
|
|
|
|
|
// Make sure its native is an AccessibleWrap not a proxy.
|
|
|
|
if (MAI_ATK_OBJECT(aAtkObj)->accWrap & IS_PROXY)
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
AccessibleWrap* accWrap =
|
|
|
|
reinterpret_cast<AccessibleWrap*>(MAI_ATK_OBJECT(aAtkObj)->accWrap);
|
2007-05-10 22:51:46 -07:00
|
|
|
|
2012-04-25 04:29:40 -07:00
|
|
|
// Check if the accessible was deconstructed.
|
|
|
|
if (!accWrap)
|
2012-07-30 07:20:58 -07:00
|
|
|
return nullptr;
|
2007-06-08 02:09:24 -07:00
|
|
|
|
2012-07-30 07:20:58 -07:00
|
|
|
NS_ENSURE_TRUE(accWrap->GetAtkObject() == aAtkObj, nullptr);
|
2007-06-01 20:01:38 -07:00
|
|
|
|
2012-09-10 06:20:26 -07:00
|
|
|
AccessibleWrap* appAccWrap = ApplicationAcc();
|
2012-04-25 04:29:40 -07:00
|
|
|
if (appAccWrap != accWrap && !accWrap->IsValidObject())
|
2012-07-30 07:20:58 -07:00
|
|
|
return nullptr;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-04-25 04:29:40 -07:00
|
|
|
return accWrap;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
2007-04-15 19:21:49 -07:00
|
|
|
|
2014-03-07 13:35:19 -08:00
|
|
|
ProxyAccessible*
|
|
|
|
GetProxy(AtkObject* aObj)
|
|
|
|
{
|
|
|
|
if (!aObj || !(MAI_ATK_OBJECT(aObj)->accWrap & IS_PROXY))
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
return reinterpret_cast<ProxyAccessible*>(MAI_ATK_OBJECT(aObj)->accWrap
|
|
|
|
& ~IS_PROXY);
|
|
|
|
}
|
|
|
|
|
2014-09-23 05:00:15 -07:00
|
|
|
AtkObject*
|
|
|
|
GetWrapperFor(ProxyAccessible* aProxy)
|
|
|
|
{
|
|
|
|
return reinterpret_cast<AtkObject*>(aProxy->GetWrapper() & ~IS_PROXY);
|
|
|
|
}
|
|
|
|
|
2014-03-07 13:35:19 -08:00
|
|
|
static uint16_t
|
|
|
|
GetInterfacesForProxy(ProxyAccessible* aProxy)
|
|
|
|
{
|
|
|
|
return MAI_INTERFACE_COMPONENT;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
a11y::ProxyCreated(ProxyAccessible* aProxy)
|
|
|
|
{
|
|
|
|
GType type = GetMaiAtkType(GetInterfacesForProxy(aProxy));
|
|
|
|
NS_ASSERTION(type, "why don't we have a type!");
|
|
|
|
|
|
|
|
AtkObject* obj =
|
|
|
|
reinterpret_cast<AtkObject *>
|
|
|
|
(g_object_new(type, nullptr));
|
|
|
|
if (!obj)
|
|
|
|
return;
|
|
|
|
|
2014-09-29 14:10:39 -07:00
|
|
|
uintptr_t inner = reinterpret_cast<uintptr_t>(aProxy) | IS_PROXY;
|
|
|
|
atk_object_initialize(obj, reinterpret_cast<gpointer>(inner));
|
2014-03-07 13:35:19 -08:00
|
|
|
obj->role = ATK_ROLE_INVALID;
|
|
|
|
obj->layer = ATK_LAYER_INVALID;
|
|
|
|
aProxy->SetWrapper(reinterpret_cast<uintptr_t>(obj) | IS_PROXY);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
a11y::ProxyDestroyed(ProxyAccessible* aProxy)
|
|
|
|
{
|
|
|
|
auto obj = reinterpret_cast<MaiAtkObject*>(aProxy->GetWrapper() & ~IS_PROXY);
|
|
|
|
obj->accWrap = 0;
|
|
|
|
g_object_unref(obj);
|
|
|
|
aProxy->SetWrapper(0);
|
|
|
|
}
|
|
|
|
|
2009-06-18 00:37:38 -07:00
|
|
|
nsresult
|
2012-05-28 18:18:45 -07:00
|
|
|
AccessibleWrap::HandleAccEvent(AccEvent* aEvent)
|
2007-04-15 19:21:49 -07:00
|
|
|
{
|
2012-05-28 18:18:45 -07:00
|
|
|
nsresult rv = Accessible::HandleAccEvent(aEvent);
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
2007-04-15 19:21:49 -07:00
|
|
|
|
2012-05-28 18:18:45 -07:00
|
|
|
Accessible* accessible = aEvent->GetAccessible();
|
2007-06-04 02:39:15 -07:00
|
|
|
NS_ENSURE_TRUE(accessible, NS_ERROR_FAILURE);
|
|
|
|
|
2013-05-24 11:24:19 -07:00
|
|
|
// The accessible can become defunct if we have an xpcom event listener
|
|
|
|
// which decides it would be fun to change the DOM and flush layout.
|
|
|
|
if (accessible->IsDefunct())
|
|
|
|
return NS_OK;
|
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t type = aEvent->GetEventType();
|
2007-04-15 19:21:49 -07:00
|
|
|
|
2012-05-28 18:18:45 -07:00
|
|
|
AtkObject* atkObj = AccessibleWrap::GetAtkObject(accessible);
|
2007-06-08 02:09:24 -07:00
|
|
|
|
2014-10-21 17:49:28 -07:00
|
|
|
// We don't create ATK objects for plain text leaves, just return NS_OK in
|
|
|
|
// such case.
|
2007-06-06 19:47:30 -07:00
|
|
|
if (!atkObj) {
|
2009-09-09 02:03:14 -07:00
|
|
|
NS_ASSERTION(type == nsIAccessibleEvent::EVENT_SHOW ||
|
|
|
|
type == nsIAccessibleEvent::EVENT_HIDE,
|
2007-06-06 19:47:30 -07:00
|
|
|
"Event other than SHOW and HIDE fired for plain text leaves");
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2012-05-28 18:18:45 -07:00
|
|
|
AccessibleWrap* accWrap = GetAccessibleWrap(atkObj);
|
2007-06-21 02:16:32 -07:00
|
|
|
if (!accWrap) {
|
|
|
|
return NS_OK; // Node is shut down
|
|
|
|
}
|
2007-06-17 22:47:33 -07:00
|
|
|
|
2007-04-15 19:21:49 -07:00
|
|
|
switch (type) {
|
|
|
|
case nsIAccessibleEvent::EVENT_STATE_CHANGE:
|
2007-04-20 00:29:08 -07:00
|
|
|
return FireAtkStateChangeEvent(aEvent, atkObj);
|
|
|
|
|
2007-08-10 18:44:44 -07:00
|
|
|
case nsIAccessibleEvent::EVENT_TEXT_REMOVED:
|
|
|
|
case nsIAccessibleEvent::EVENT_TEXT_INSERTED:
|
2007-04-20 00:29:08 -07:00
|
|
|
return FireAtkTextChangedEvent(aEvent, atkObj);
|
|
|
|
|
2007-06-17 22:47:33 -07:00
|
|
|
case nsIAccessibleEvent::EVENT_FOCUS:
|
|
|
|
{
|
2012-05-03 23:09:22 -07:00
|
|
|
a11y::RootAccessible* rootAccWrap = accWrap->RootAccessible();
|
2007-06-17 22:47:33 -07:00
|
|
|
if (rootAccWrap && rootAccWrap->mActivated) {
|
2013-11-18 05:16:21 -08:00
|
|
|
atk_focus_tracker_notify(atkObj);
|
2007-06-25 01:28:22 -07:00
|
|
|
// Fire state change event for focus
|
2013-11-08 12:31:20 -08:00
|
|
|
atk_object_notify_state_change(atkObj, ATK_STATE_FOCUSED, true);
|
|
|
|
return NS_OK;
|
2007-06-17 22:47:33 -07:00
|
|
|
}
|
|
|
|
} break;
|
|
|
|
|
2011-06-15 22:12:32 -07:00
|
|
|
case nsIAccessibleEvent::EVENT_NAME_CHANGE:
|
|
|
|
{
|
2012-04-30 20:08:31 -07:00
|
|
|
nsAutoString newName;
|
|
|
|
accessible->Name(newName);
|
2013-04-17 01:29:35 -07:00
|
|
|
|
|
|
|
MaybeFireNameChange(atkObj, newName);
|
2011-06-15 22:12:32 -07:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2014-10-21 17:49:28 -07:00
|
|
|
|
|
|
|
case nsIAccessibleEvent::EVENT_VALUE_CHANGE:
|
|
|
|
if (accessible->HasNumericValue()) {
|
|
|
|
// Make sure this is a numeric value. Don't fire for string value changes
|
|
|
|
// (e.g. text editing) ATK values are always numeric.
|
|
|
|
g_object_notify((GObject*)atkObj, "accessible-value");
|
|
|
|
}
|
|
|
|
break;
|
2007-06-17 22:47:33 -07:00
|
|
|
|
2011-10-31 17:52:27 -07:00
|
|
|
case nsIAccessibleEvent::EVENT_SELECTION:
|
|
|
|
case nsIAccessibleEvent::EVENT_SELECTION_ADD:
|
|
|
|
case nsIAccessibleEvent::EVENT_SELECTION_REMOVE:
|
|
|
|
{
|
|
|
|
// XXX: dupe events may be fired
|
|
|
|
AccSelChangeEvent* selChangeEvent = downcast_accEvent(aEvent);
|
2012-05-28 18:18:45 -07:00
|
|
|
g_signal_emit_by_name(AccessibleWrap::GetAtkObject(selChangeEvent->Widget()),
|
2011-10-31 17:52:27 -07:00
|
|
|
"selection_changed");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case nsIAccessibleEvent::EVENT_SELECTION_WITHIN:
|
|
|
|
{
|
|
|
|
g_signal_emit_by_name(atkObj, "selection_changed");
|
|
|
|
break;
|
|
|
|
}
|
2007-06-17 22:47:33 -07:00
|
|
|
|
|
|
|
case nsIAccessibleEvent::EVENT_TEXT_SELECTION_CHANGED:
|
|
|
|
g_signal_emit_by_name(atkObj, "text_selection_changed");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED:
|
2007-06-22 02:27:22 -07:00
|
|
|
{
|
2010-08-24 19:08:28 -07:00
|
|
|
AccCaretMoveEvent* caretMoveEvent = downcast_accEvent(aEvent);
|
2007-06-22 02:27:22 -07:00
|
|
|
NS_ASSERTION(caretMoveEvent, "Event needs event data");
|
|
|
|
if (!caretMoveEvent)
|
2007-06-17 22:47:33 -07:00
|
|
|
break;
|
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t caretOffset = caretMoveEvent->GetCaretOffset();
|
2012-12-01 10:49:24 -08:00
|
|
|
g_signal_emit_by_name(atkObj, "text_caret_moved", caretOffset);
|
2007-06-22 02:27:22 -07:00
|
|
|
} break;
|
2007-06-17 22:47:33 -07:00
|
|
|
|
2008-07-17 05:06:24 -07:00
|
|
|
case nsIAccessibleEvent::EVENT_TEXT_ATTRIBUTE_CHANGED:
|
2012-12-01 10:49:24 -08:00
|
|
|
g_signal_emit_by_name(atkObj, "text-attributes-changed");
|
2008-07-17 05:06:24 -07:00
|
|
|
break;
|
|
|
|
|
2007-06-17 22:47:33 -07:00
|
|
|
case nsIAccessibleEvent::EVENT_TABLE_MODEL_CHANGED:
|
|
|
|
g_signal_emit_by_name(atkObj, "model_changed");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case nsIAccessibleEvent::EVENT_TABLE_ROW_INSERT:
|
2008-01-17 19:09:10 -08:00
|
|
|
{
|
2010-08-24 19:08:28 -07:00
|
|
|
AccTableChangeEvent* tableEvent = downcast_accEvent(aEvent);
|
2008-01-17 18:56:38 -08:00
|
|
|
NS_ENSURE_TRUE(tableEvent, NS_ERROR_FAILURE);
|
2007-06-17 22:47:33 -07:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t rowIndex = tableEvent->GetIndex();
|
|
|
|
int32_t numRows = tableEvent->GetCount();
|
2007-06-17 22:47:33 -07:00
|
|
|
|
2012-12-01 10:49:24 -08:00
|
|
|
g_signal_emit_by_name(atkObj, "row_inserted", rowIndex, numRows);
|
2008-01-17 19:09:10 -08:00
|
|
|
} break;
|
2007-06-17 22:47:33 -07:00
|
|
|
|
|
|
|
case nsIAccessibleEvent::EVENT_TABLE_ROW_DELETE:
|
2008-01-17 19:09:10 -08:00
|
|
|
{
|
2010-08-24 19:08:28 -07:00
|
|
|
AccTableChangeEvent* tableEvent = downcast_accEvent(aEvent);
|
2008-01-17 18:56:38 -08:00
|
|
|
NS_ENSURE_TRUE(tableEvent, NS_ERROR_FAILURE);
|
2007-06-17 22:47:33 -07:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t rowIndex = tableEvent->GetIndex();
|
|
|
|
int32_t numRows = tableEvent->GetCount();
|
2007-06-17 22:47:33 -07:00
|
|
|
|
2012-12-01 10:49:24 -08:00
|
|
|
g_signal_emit_by_name(atkObj, "row_deleted", rowIndex, numRows);
|
2008-01-17 19:09:10 -08:00
|
|
|
} break;
|
2007-06-17 22:47:33 -07:00
|
|
|
|
|
|
|
case nsIAccessibleEvent::EVENT_TABLE_ROW_REORDER:
|
2008-01-17 19:09:10 -08:00
|
|
|
{
|
2007-06-17 22:47:33 -07:00
|
|
|
g_signal_emit_by_name(atkObj, "row_reordered");
|
|
|
|
break;
|
2008-01-17 19:09:10 -08:00
|
|
|
}
|
2007-06-17 22:47:33 -07:00
|
|
|
|
|
|
|
case nsIAccessibleEvent::EVENT_TABLE_COLUMN_INSERT:
|
2008-01-17 19:09:10 -08:00
|
|
|
{
|
2010-08-24 19:08:28 -07:00
|
|
|
AccTableChangeEvent* tableEvent = downcast_accEvent(aEvent);
|
2008-01-17 18:56:38 -08:00
|
|
|
NS_ENSURE_TRUE(tableEvent, NS_ERROR_FAILURE);
|
2007-06-17 22:47:33 -07:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t colIndex = tableEvent->GetIndex();
|
|
|
|
int32_t numCols = tableEvent->GetCount();
|
2012-12-01 10:49:24 -08:00
|
|
|
g_signal_emit_by_name(atkObj, "column_inserted", colIndex, numCols);
|
2008-01-17 19:09:10 -08:00
|
|
|
} break;
|
2007-06-17 22:47:33 -07:00
|
|
|
|
|
|
|
case nsIAccessibleEvent::EVENT_TABLE_COLUMN_DELETE:
|
2008-01-17 19:09:10 -08:00
|
|
|
{
|
2010-08-24 19:08:28 -07:00
|
|
|
AccTableChangeEvent* tableEvent = downcast_accEvent(aEvent);
|
2008-01-17 18:56:38 -08:00
|
|
|
NS_ENSURE_TRUE(tableEvent, NS_ERROR_FAILURE);
|
2007-06-17 22:47:33 -07:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t colIndex = tableEvent->GetIndex();
|
|
|
|
int32_t numCols = tableEvent->GetCount();
|
2012-12-01 10:49:24 -08:00
|
|
|
g_signal_emit_by_name(atkObj, "column_deleted", colIndex, numCols);
|
2008-01-17 19:09:10 -08:00
|
|
|
} break;
|
2007-06-17 22:47:33 -07:00
|
|
|
|
|
|
|
case nsIAccessibleEvent::EVENT_TABLE_COLUMN_REORDER:
|
|
|
|
g_signal_emit_by_name(atkObj, "column_reordered");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case nsIAccessibleEvent::EVENT_SECTION_CHANGED:
|
|
|
|
g_signal_emit_by_name(atkObj, "visible_data_changed");
|
|
|
|
break;
|
|
|
|
|
2009-09-09 02:03:14 -07:00
|
|
|
case nsIAccessibleEvent::EVENT_SHOW:
|
2011-10-17 07:59:28 -07:00
|
|
|
return FireAtkShowHideEvent(aEvent, atkObj, true);
|
2007-06-29 19:49:32 -07:00
|
|
|
|
2009-09-09 02:03:14 -07:00
|
|
|
case nsIAccessibleEvent::EVENT_HIDE:
|
2014-02-08 17:55:52 -08:00
|
|
|
// XXX - Handle native dialog accessibles.
|
|
|
|
if (!accessible->IsRoot() && accessible->HasARIARole() &&
|
|
|
|
accessible->ARIARole() == roles::DIALOG) {
|
|
|
|
guint id = g_signal_lookup("deactivate", MAI_TYPE_ATK_OBJECT);
|
|
|
|
g_signal_emit(atkObj, id, 0);
|
|
|
|
}
|
2011-10-17 07:59:28 -07:00
|
|
|
return FireAtkShowHideEvent(aEvent, atkObj, false);
|
2007-06-17 22:47:33 -07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Because dealing with menu is very different between nsIAccessible
|
|
|
|
* and ATK, and the menu activity is important, specially transfer the
|
|
|
|
* following two event.
|
|
|
|
* Need more verification by AT test.
|
|
|
|
*/
|
|
|
|
case nsIAccessibleEvent::EVENT_MENU_START:
|
|
|
|
case nsIAccessibleEvent::EVENT_MENU_END:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case nsIAccessibleEvent::EVENT_WINDOW_ACTIVATE:
|
|
|
|
{
|
2012-05-03 23:09:22 -07:00
|
|
|
accessible->AsRoot()->mActivated = true;
|
2014-02-08 17:55:52 -08:00
|
|
|
guint id = g_signal_lookup("activate", MAI_TYPE_ATK_OBJECT);
|
2007-06-17 22:47:33 -07:00
|
|
|
g_signal_emit(atkObj, id, 0);
|
2008-07-03 00:10:16 -07:00
|
|
|
|
|
|
|
// Always fire a current focus event after activation.
|
2011-09-27 18:46:11 -07:00
|
|
|
FocusMgr()->ForceFocusEvent();
|
2007-06-17 22:47:33 -07:00
|
|
|
} break;
|
|
|
|
|
|
|
|
case nsIAccessibleEvent::EVENT_WINDOW_DEACTIVATE:
|
|
|
|
{
|
2012-05-03 23:09:22 -07:00
|
|
|
accessible->AsRoot()->mActivated = false;
|
2014-02-08 17:55:52 -08:00
|
|
|
guint id = g_signal_lookup("deactivate", MAI_TYPE_ATK_OBJECT);
|
2007-06-17 22:47:33 -07:00
|
|
|
g_signal_emit(atkObj, id, 0);
|
|
|
|
} break;
|
|
|
|
|
2011-03-26 09:06:00 -07:00
|
|
|
case nsIAccessibleEvent::EVENT_WINDOW_MAXIMIZE:
|
|
|
|
{
|
2014-02-08 17:55:52 -08:00
|
|
|
guint id = g_signal_lookup("maximize", MAI_TYPE_ATK_OBJECT);
|
2011-03-26 09:06:00 -07:00
|
|
|
g_signal_emit(atkObj, id, 0);
|
|
|
|
} break;
|
|
|
|
|
|
|
|
case nsIAccessibleEvent::EVENT_WINDOW_MINIMIZE:
|
|
|
|
{
|
2014-02-08 17:55:52 -08:00
|
|
|
guint id = g_signal_lookup("minimize", MAI_TYPE_ATK_OBJECT);
|
2011-03-26 09:06:00 -07:00
|
|
|
g_signal_emit(atkObj, id, 0);
|
|
|
|
} break;
|
|
|
|
|
|
|
|
case nsIAccessibleEvent::EVENT_WINDOW_RESTORE:
|
|
|
|
{
|
2014-02-08 17:55:52 -08:00
|
|
|
guint id = g_signal_lookup("restore", MAI_TYPE_ATK_OBJECT);
|
2011-03-26 09:06:00 -07:00
|
|
|
g_signal_emit(atkObj, id, 0);
|
|
|
|
} break;
|
|
|
|
|
2007-06-17 22:47:33 -07:00
|
|
|
case nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_COMPLETE:
|
|
|
|
g_signal_emit_by_name (atkObj, "load_complete");
|
2014-02-08 17:55:52 -08:00
|
|
|
// XXX - Handle native dialog accessibles.
|
|
|
|
if (!accessible->IsRoot() && accessible->HasARIARole() &&
|
|
|
|
accessible->ARIARole() == roles::DIALOG) {
|
|
|
|
guint id = g_signal_lookup("activate", MAI_TYPE_ATK_OBJECT);
|
|
|
|
g_signal_emit(atkObj, id, 0);
|
|
|
|
}
|
2012-12-01 10:49:24 -08:00
|
|
|
break;
|
2007-06-17 22:47:33 -07:00
|
|
|
|
|
|
|
case nsIAccessibleEvent::EVENT_DOCUMENT_RELOAD:
|
|
|
|
g_signal_emit_by_name (atkObj, "reload");
|
2012-12-01 10:49:24 -08:00
|
|
|
break;
|
2007-06-17 22:47:33 -07:00
|
|
|
|
|
|
|
case nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_STOPPED:
|
|
|
|
g_signal_emit_by_name (atkObj, "load_stopped");
|
2012-12-01 10:49:24 -08:00
|
|
|
break;
|
2007-06-17 22:47:33 -07:00
|
|
|
|
|
|
|
case nsIAccessibleEvent::EVENT_MENUPOPUP_START:
|
2013-11-18 05:16:21 -08:00
|
|
|
atk_focus_tracker_notify(atkObj); // fire extra focus event
|
2011-10-17 07:59:28 -07:00
|
|
|
atk_object_notify_state_change(atkObj, ATK_STATE_VISIBLE, true);
|
|
|
|
atk_object_notify_state_change(atkObj, ATK_STATE_SHOWING, true);
|
2007-06-17 22:47:33 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case nsIAccessibleEvent::EVENT_MENUPOPUP_END:
|
2011-10-17 07:59:28 -07:00
|
|
|
atk_object_notify_state_change(atkObj, ATK_STATE_VISIBLE, false);
|
|
|
|
atk_object_notify_state_change(atkObj, ATK_STATE_SHOWING, false);
|
2007-06-29 19:49:32 -07:00
|
|
|
break;
|
2007-04-20 00:29:08 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2007-04-15 19:21:49 -07:00
|
|
|
|
2014-09-30 07:00:26 -07:00
|
|
|
void
|
|
|
|
a11y::ProxyEvent(ProxyAccessible* aTarget, uint32_t aEventType)
|
|
|
|
{
|
|
|
|
AtkObject* wrapper = GetWrapperFor(aTarget);
|
|
|
|
if (aEventType == nsIAccessibleEvent::EVENT_FOCUS) {
|
|
|
|
atk_focus_tracker_notify(wrapper);
|
|
|
|
atk_object_notify_state_change(wrapper, ATK_STATE_FOCUSED, true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-04-20 00:29:08 -07:00
|
|
|
nsresult
|
2012-05-28 18:18:45 -07:00
|
|
|
AccessibleWrap::FireAtkStateChangeEvent(AccEvent* aEvent,
|
|
|
|
AtkObject* aObject)
|
2007-04-20 00:29:08 -07:00
|
|
|
{
|
2010-08-24 19:08:28 -07:00
|
|
|
AccStateChangeEvent* event = downcast_accEvent(aEvent);
|
2007-04-20 00:29:08 -07:00
|
|
|
NS_ENSURE_TRUE(event, NS_ERROR_FAILURE);
|
2007-04-15 19:21:49 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool isEnabled = event->IsStateEnabled();
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t stateIndex = AtkStateMap::GetStateIndexFor(event->GetState());
|
2007-04-20 00:29:08 -07:00
|
|
|
if (stateIndex >= 0) {
|
2011-04-09 16:38:06 -07:00
|
|
|
NS_ASSERTION(gAtkStateMap[stateIndex].stateMapEntryType != kNoSuchState,
|
2007-04-20 00:29:08 -07:00
|
|
|
"No such state");
|
2007-04-15 19:21:49 -07:00
|
|
|
|
2011-04-09 16:38:06 -07:00
|
|
|
if (gAtkStateMap[stateIndex].atkState != kNone) {
|
|
|
|
NS_ASSERTION(gAtkStateMap[stateIndex].stateMapEntryType != kNoStateChange,
|
2007-04-20 00:29:08 -07:00
|
|
|
"State changes should not fired for this state");
|
2007-04-15 19:21:49 -07:00
|
|
|
|
2011-04-09 16:38:06 -07:00
|
|
|
if (gAtkStateMap[stateIndex].stateMapEntryType == kMapOpposite)
|
2007-04-20 00:29:08 -07:00
|
|
|
isEnabled = !isEnabled;
|
2007-04-15 19:21:49 -07:00
|
|
|
|
2007-04-20 00:29:08 -07:00
|
|
|
// Fire state change for first state if there is one to map
|
|
|
|
atk_object_notify_state_change(aObject,
|
2011-04-09 16:38:06 -07:00
|
|
|
gAtkStateMap[stateIndex].atkState,
|
2007-04-20 00:29:08 -07:00
|
|
|
isEnabled);
|
2007-04-15 19:21:49 -07:00
|
|
|
}
|
2007-04-20 00:29:08 -07:00
|
|
|
}
|
2007-04-16 23:52:52 -07:00
|
|
|
|
2007-04-20 00:29:08 -07:00
|
|
|
return NS_OK;
|
|
|
|
}
|
2007-04-16 23:52:52 -07:00
|
|
|
|
2007-04-20 00:29:08 -07:00
|
|
|
nsresult
|
2012-05-28 18:18:45 -07:00
|
|
|
AccessibleWrap::FireAtkTextChangedEvent(AccEvent* aEvent,
|
|
|
|
AtkObject* aObject)
|
2007-04-20 00:29:08 -07:00
|
|
|
{
|
2010-08-24 19:08:28 -07:00
|
|
|
AccTextChangeEvent* event = downcast_accEvent(aEvent);
|
2007-04-20 00:29:08 -07:00
|
|
|
NS_ENSURE_TRUE(event, NS_ERROR_FAILURE);
|
2007-04-16 23:52:52 -07:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t start = event->GetStartOffset();
|
|
|
|
uint32_t length = event->GetLength();
|
2011-09-28 23:19:26 -07:00
|
|
|
bool isInserted = event->IsTextInserted();
|
|
|
|
bool isFromUserInput = aEvent->IsFromUserInput();
|
2012-07-30 07:20:58 -07:00
|
|
|
char* signal_name = nullptr;
|
2011-03-24 15:03:14 -07:00
|
|
|
|
2011-07-04 06:49:44 -07:00
|
|
|
if (gAvailableAtkSignals == eUnknown)
|
2011-12-21 03:26:08 -08:00
|
|
|
gAvailableAtkSignals =
|
|
|
|
g_signal_lookup("text-insert", G_OBJECT_TYPE(aObject)) ?
|
|
|
|
eHaveNewAtkTextSignals : eNoNewAtkSignals;
|
2011-07-04 06:49:44 -07:00
|
|
|
|
|
|
|
if (gAvailableAtkSignals == eNoNewAtkSignals) {
|
|
|
|
// XXX remove this code and the gHaveNewTextSignals check when we can
|
|
|
|
// stop supporting old atk since it doesn't really work anyway
|
|
|
|
// see bug 619002
|
|
|
|
signal_name = g_strconcat(isInserted ? "text_changed::insert" :
|
|
|
|
"text_changed::delete",
|
2013-04-02 17:33:43 -07:00
|
|
|
isFromUserInput ? "" : kNonUserInputEvent, nullptr);
|
2011-07-04 06:49:44 -07:00
|
|
|
g_signal_emit_by_name(aObject, signal_name, start, length);
|
|
|
|
} else {
|
|
|
|
nsAutoString text;
|
|
|
|
event->GetModifiedText(text);
|
|
|
|
signal_name = g_strconcat(isInserted ? "text-insert" : "text-remove",
|
2013-04-02 17:33:43 -07:00
|
|
|
isFromUserInput ? "" : "::system", nullptr);
|
2011-07-04 06:49:44 -07:00
|
|
|
g_signal_emit_by_name(aObject, signal_name, start, length,
|
|
|
|
NS_ConvertUTF16toUTF8(text).get());
|
|
|
|
}
|
2007-09-18 14:40:04 -07:00
|
|
|
|
2011-07-04 06:49:44 -07:00
|
|
|
g_free(signal_name);
|
|
|
|
return NS_OK;
|
2007-04-20 00:29:08 -07:00
|
|
|
}
|
|
|
|
|
2007-06-29 19:49:32 -07:00
|
|
|
nsresult
|
2012-05-28 18:18:45 -07:00
|
|
|
AccessibleWrap::FireAtkShowHideEvent(AccEvent* aEvent,
|
|
|
|
AtkObject* aObject, bool aIsAdded)
|
2007-06-29 19:49:32 -07:00
|
|
|
{
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t indexInParent = getIndexInParentCB(aObject);
|
2008-01-29 13:41:58 -08:00
|
|
|
AtkObject *parentObject = getParentCB(aObject);
|
2007-06-29 19:49:32 -07:00
|
|
|
NS_ENSURE_STATE(parentObject);
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool isFromUserInput = aEvent->IsFromUserInput();
|
2007-09-18 14:40:04 -07:00
|
|
|
char *signal_name = g_strconcat(aIsAdded ? "children_changed::add" : "children_changed::remove",
|
2013-04-02 17:33:43 -07:00
|
|
|
isFromUserInput ? "" : kNonUserInputEvent, nullptr);
|
|
|
|
g_signal_emit_by_name(parentObject, signal_name, indexInParent, aObject, nullptr);
|
2007-09-18 14:40:04 -07:00
|
|
|
g_free(signal_name);
|
2007-06-29 19:49:32 -07:00
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|