bug 1146518 - allow MaiHyperlink to store references to proxies r=surkov

This commit is contained in:
Trevor Saunders 2015-04-21 16:31:58 -04:00
parent 9d2eb81fdd
commit 93badee7c8
4 changed files with 16 additions and 9 deletions

View File

@ -123,10 +123,6 @@ static const GInterfaceInfo atk_if_infos[] = {
(GInterfaceFinalizeFunc) nullptr, nullptr}
};
// This is or'd with the pointer in MaiAtkObject::accWrap if the wrap-ee is a
// proxy.
static const uintptr_t IS_PROXY = 1;
static GQuark quark_mai_hyperlink = 0;
AtkHyperlink*
@ -136,7 +132,7 @@ MaiAtkObject::GetAtkHyperlink()
MaiHyperlink* maiHyperlink =
(MaiHyperlink*)g_object_get_qdata(G_OBJECT(this), quark_mai_hyperlink);
if (!maiHyperlink) {
maiHyperlink = new MaiHyperlink(reinterpret_cast<Accessible*>(accWrap));
maiHyperlink = new MaiHyperlink(accWrap);
g_object_set_qdata(G_OBJECT(this), quark_mai_hyperlink, maiHyperlink);
}

View File

@ -51,6 +51,10 @@ IsAtkVersionAtLeast(int aMajor, int aMinor)
(aMajor == atkMajorVersion && aMinor <= atkMinorVersion);
}
// This is or'd with the pointer in MaiAtkObject::accWrap if the wrap-ee is a
// proxy.
static const uintptr_t IS_PROXY = 1;
/**
* This MaiAtkObject is a thin wrapper, in the MAI namespace, for AtkObject
*/

View File

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

View File

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