bug 1155829 - move AccessibleWrap::GetMaiHyperlink to MaiAtkObject::GetAtkHyperlink r=surkov

This commit is contained in:
Trevor Saunders 2015-04-17 15:21:36 -04:00
parent c05b5f732a
commit 54c82431b4
5 changed files with 22 additions and 32 deletions

View File

@ -129,6 +129,20 @@ static const uintptr_t IS_PROXY = 1;
static GQuark quark_mai_hyperlink = 0;
AtkHyperlink*
MaiAtkObject::GetAtkHyperlink()
{
NS_ASSERTION(quark_mai_hyperlink, "quark_mai_hyperlink not initialized");
MaiHyperlink* maiHyperlink =
(MaiHyperlink*)g_object_get_qdata(G_OBJECT(this), quark_mai_hyperlink);
if (!maiHyperlink) {
maiHyperlink = new MaiHyperlink(reinterpret_cast<Accessible*>(accWrap));
g_object_set_qdata(G_OBJECT(this), quark_mai_hyperlink, maiHyperlink);
}
return maiHyperlink->GetAtkHyperlink();
}
void
MaiAtkObject::Shutdown()
{
@ -267,27 +281,6 @@ AccessibleWrap::Shutdown()
Accessible::Shutdown();
}
MaiHyperlink*
AccessibleWrap::GetMaiHyperlink(bool aCreate /* = true */)
{
// make sure mAtkObject is created
GetAtkObject();
NS_ASSERTION(quark_mai_hyperlink, "quark_mai_hyperlink not initialized");
NS_ASSERTION(IS_MAI_OBJECT(mAtkObject), "Invalid AtkObject");
MaiHyperlink* maiHyperlink = nullptr;
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);
g_object_set_qdata(G_OBJECT(mAtkObject), quark_mai_hyperlink,
maiHyperlink);
}
}
return maiHyperlink;
}
void
AccessibleWrap::GetNativeInterface(void** aOutAccessible)
{

View File

@ -63,9 +63,6 @@ public:
bool IsValidObject();
// get the MaiHyperlink object for this AccessibleWrap
MaiHyperlink* GetMaiHyperlink(bool aCreate = true);
static const char * ReturnString(nsAString &aString) {
static nsCString returnedString;
returnedString = NS_ConvertUTF16toUTF8(aString);

View File

@ -63,6 +63,11 @@ struct MaiAtkObject
*/
uintptr_t accWrap;
/*
* Get the AtkHyperlink for this atk object.
*/
AtkHyperlink* GetAtkHyperlink();
/*
* Shutdown this AtkObject.
*/

View File

@ -21,9 +21,7 @@ getHyperlinkCB(AtkHyperlinkImpl* aImpl)
NS_ENSURE_TRUE(accWrap->IsLink(), nullptr);
MaiHyperlink* maiHyperlink = accWrap->GetMaiHyperlink();
NS_ENSURE_TRUE(maiHyperlink, nullptr);
return maiHyperlink->GetAtkHyperlink();
return MAI_ATK_OBJECT(aImpl)->GetAtkHyperlink();
}
}

View File

@ -32,12 +32,9 @@ getLinkCB(AtkHypertext *aText, gint aLinkIndex)
}
AtkObject* hyperLinkAtkObj = AccessibleWrap::GetAtkObject(hyperLink);
AccessibleWrap* accChild = GetAccessibleWrap(hyperLinkAtkObj);
NS_ENSURE_TRUE(accChild, nullptr);
NS_ENSURE_TRUE(IS_MAI_OBJECT(hyperLinkAtkObj), nullptr);
MaiHyperlink* maiHyperlink = accChild->GetMaiHyperlink();
NS_ENSURE_TRUE(maiHyperlink, nullptr);
return maiHyperlink->GetAtkHyperlink();
return MAI_ATK_OBJECT(hyperLinkAtkObj)->GetAtkHyperlink();
}
if (ProxyAccessible* proxy = GetProxy(ATK_OBJECT(aText))) {