diff --git a/accessible/atk/AccessibleWrap.cpp b/accessible/atk/AccessibleWrap.cpp index 0f922cf4c1a..6b2956f8359 100644 --- a/accessible/atk/AccessibleWrap.cpp +++ b/accessible/atk/AccessibleWrap.cpp @@ -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(accWrap)); + maiHyperlink = new MaiHyperlink(accWrap); g_object_set_qdata(G_OBJECT(this), quark_mai_hyperlink, maiHyperlink); } diff --git a/accessible/atk/nsMai.h b/accessible/atk/nsMai.h index b36bd15958d..127fbf44461 100644 --- a/accessible/atk/nsMai.h +++ b/accessible/atk/nsMai.h @@ -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 */ diff --git a/accessible/atk/nsMaiHyperlink.cpp b/accessible/atk/nsMaiHyperlink.cpp index 3013e6f8b77..7c364f3a39d 100644 --- a/accessible/atk/nsMaiHyperlink.cpp +++ b/accessible/atk/nsMaiHyperlink.cpp @@ -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) { diff --git a/accessible/atk/nsMaiHyperlink.h b/accessible/atk/nsMaiHyperlink.h index 7fca0275eea..0e5e5dbbba2 100644 --- a/accessible/atk/nsMaiHyperlink.h +++ b/accessible/atk/nsMaiHyperlink.h @@ -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(mHyperlink); + NS_ASSERTION(link->IsLink(), "Why isn't it a link!"); + return link; + } protected: - Accessible* mHyperlink; + uintptr_t mHyperlink; AtkHyperlink* mMaiAtkHyperlink; };