bug 1241453 - switch MaiHyperLink to use AccessibleOrProxy r=davidb

This commit is contained in:
Trevor Saunders 2016-01-19 07:20:23 -05:00
parent 6b82afaf17
commit f7f97fab77
3 changed files with 11 additions and 13 deletions

View File

@ -135,7 +135,7 @@ MaiAtkObject::GetAtkHyperlink()
MaiHyperlink* maiHyperlink =
(MaiHyperlink*)g_object_get_qdata(G_OBJECT(this), quark_mai_hyperlink);
if (!maiHyperlink) {
maiHyperlink = new MaiHyperlink(accWrap.Bits());
maiHyperlink = new MaiHyperlink(accWrap);
g_object_set_qdata(G_OBJECT(this), quark_mai_hyperlink, maiHyperlink);
}

View File

@ -100,7 +100,7 @@ mai_atk_hyperlink_get_type(void)
return type;
}
MaiHyperlink::MaiHyperlink(uintptr_t aHyperLink) :
MaiHyperlink::MaiHyperlink(AccessibleOrProxy aHyperLink) :
mHyperlink(aHyperLink),
mMaiAtkHyperlink(nullptr)
{

View File

@ -23,31 +23,29 @@ namespace a11y {
class MaiHyperlink
{
public:
explicit MaiHyperlink(uintptr_t aHyperLink);
explicit MaiHyperlink(AccessibleOrProxy aHyperLink);
~MaiHyperlink();
public:
AtkHyperlink* GetAtkHyperlink() const { return mMaiAtkHyperlink; }
Accessible* GetAccHyperlink()
{
if (!mHyperlink || mHyperlink & IS_PROXY)
if (!mHyperlink.IsAccessible())
return nullptr;
Accessible* link = reinterpret_cast<Accessible*>(mHyperlink);
Accessible* link = mHyperlink.AsAccessible();
if (!link) {
return nullptr;
}
NS_ASSERTION(link->IsLink(), "Why isn't it a link!");
return link;
}
ProxyAccessible* Proxy() const
{
if (!(mHyperlink & IS_PROXY))
return nullptr;
return reinterpret_cast<ProxyAccessible*>(mHyperlink & ~IS_PROXY);
}
ProxyAccessible* Proxy() const { return mHyperlink.AsProxy(); }
protected:
uintptr_t mHyperlink;
AccessibleOrProxy mHyperlink;
AtkHyperlink* mMaiAtkHyperlink;
};