From f7f97fab7776b4d3ab7ef9347486ef7e5671e89a Mon Sep 17 00:00:00 2001 From: Trevor Saunders Date: Tue, 19 Jan 2016 07:20:23 -0500 Subject: [PATCH] bug 1241453 - switch MaiHyperLink to use AccessibleOrProxy r=davidb --- accessible/atk/AccessibleWrap.cpp | 2 +- accessible/atk/nsMaiHyperlink.cpp | 2 +- accessible/atk/nsMaiHyperlink.h | 20 +++++++++----------- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/accessible/atk/AccessibleWrap.cpp b/accessible/atk/AccessibleWrap.cpp index fdeb8bf8ac6..cf12459fc20 100644 --- a/accessible/atk/AccessibleWrap.cpp +++ b/accessible/atk/AccessibleWrap.cpp @@ -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); } diff --git a/accessible/atk/nsMaiHyperlink.cpp b/accessible/atk/nsMaiHyperlink.cpp index e0703d8d9f4..3994bba3f9c 100644 --- a/accessible/atk/nsMaiHyperlink.cpp +++ b/accessible/atk/nsMaiHyperlink.cpp @@ -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) { diff --git a/accessible/atk/nsMaiHyperlink.h b/accessible/atk/nsMaiHyperlink.h index 44420323cdf..7dc1b73551e 100644 --- a/accessible/atk/nsMaiHyperlink.h +++ b/accessible/atk/nsMaiHyperlink.h @@ -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(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(mHyperlink & ~IS_PROXY); - } + ProxyAccessible* Proxy() const { return mHyperlink.AsProxy(); } protected: - uintptr_t mHyperlink; + AccessibleOrProxy mHyperlink; AtkHyperlink* mMaiAtkHyperlink; };