bug 1155829 - inline MaiHyperlink::GetAtkHyperlink r=surkov

This commit is contained in:
Trevor Saunders 2015-04-07 15:56:28 -04:00
parent b2a307c179
commit f91e5d47b4
2 changed files with 11 additions and 22 deletions

View File

@ -94,36 +94,25 @@ MaiHyperlink::MaiHyperlink(Accessible* aHyperLink) :
mHyperlink(aHyperLink), mHyperlink(aHyperLink),
mMaiAtkHyperlink(nullptr) mMaiAtkHyperlink(nullptr)
{ {
}
MaiHyperlink::~MaiHyperlink()
{
if (mMaiAtkHyperlink) {
MAI_ATK_HYPERLINK(mMaiAtkHyperlink)->maiHyperlink = nullptr;
g_object_unref(mMaiAtkHyperlink);
}
}
AtkHyperlink*
MaiHyperlink::GetAtkHyperlink(void)
{
NS_ENSURE_TRUE(mHyperlink, nullptr);
if (mMaiAtkHyperlink)
return mMaiAtkHyperlink;
if (!mHyperlink->IsLink()) if (!mHyperlink->IsLink())
return nullptr; return;
mMaiAtkHyperlink = mMaiAtkHyperlink =
reinterpret_cast<AtkHyperlink *> reinterpret_cast<AtkHyperlink *>
(g_object_new(mai_atk_hyperlink_get_type(), nullptr)); (g_object_new(mai_atk_hyperlink_get_type(), nullptr));
NS_ASSERTION(mMaiAtkHyperlink, "OUT OF MEMORY"); NS_ASSERTION(mMaiAtkHyperlink, "OUT OF MEMORY");
NS_ENSURE_TRUE(mMaiAtkHyperlink, nullptr); if (!mMaiAtkHyperlink)
return;
MAI_ATK_HYPERLINK(mMaiAtkHyperlink)->maiHyperlink = this; MAI_ATK_HYPERLINK(mMaiAtkHyperlink)->maiHyperlink = this;
}
return mMaiAtkHyperlink; MaiHyperlink::~MaiHyperlink()
{
if (mMaiAtkHyperlink) {
MAI_ATK_HYPERLINK(mMaiAtkHyperlink)->maiHyperlink = nullptr;
g_object_unref(mMaiAtkHyperlink);
}
} }

View File

@ -27,7 +27,7 @@ public:
~MaiHyperlink(); ~MaiHyperlink();
public: public:
AtkHyperlink *GetAtkHyperlink(void); AtkHyperlink* GetAtkHyperlink() const { return mMaiAtkHyperlink; }
Accessible* GetAccHyperlink() Accessible* GetAccHyperlink()
{ return mHyperlink && mHyperlink->IsLink() ? mHyperlink : nullptr; } { return mHyperlink && mHyperlink->IsLink() ? mHyperlink : nullptr; }