diff --git a/accessible/windows/ia2/ia2AccessibleHypertext.cpp b/accessible/windows/ia2/ia2AccessibleHypertext.cpp index bf9436621c59c..906b76d4e7967 100644 --- a/accessible/windows/ia2/ia2AccessibleHypertext.cpp +++ b/accessible/windows/ia2/ia2AccessibleHypertext.cpp @@ -26,6 +26,11 @@ ia2AccessibleHypertext::get_nHyperlinks(long* aHyperlinkCount) *aHyperlinkCount = 0; + if (ProxyAccessible* proxy = HyperTextProxyFor(this)) { + *aHyperlinkCount = proxy->LinkCount(); + return S_OK; + } + HyperTextAccessibleWrap* hyperText = static_cast(this); if (hyperText->IsDefunct()) return CO_E_OBJNOTCONNECTED; @@ -47,16 +52,26 @@ ia2AccessibleHypertext::get_hyperlink(long aLinkIndex, *aHyperlink = nullptr; - HyperTextAccessibleWrap* hyperText = static_cast(this); - if (hyperText->IsDefunct()) - return CO_E_OBJNOTCONNECTED; + AccessibleWrap* hyperLink; + if (ProxyAccessible* proxy = HyperTextProxyFor(this)) { + ProxyAccessible* link = proxy->LinkAt(aLinkIndex); + if (!link) + return E_FAIL; + + hyperLink = WrapperFor(link); + } else { + HyperTextAccessibleWrap* hyperText = static_cast(this); + if (hyperText->IsDefunct()) + return CO_E_OBJNOTCONNECTED; + + hyperLink = static_cast(hyperText->LinkAt(aLinkIndex)); + } - Accessible* hyperLink = hyperText->LinkAt(aLinkIndex); if (!hyperLink) return E_FAIL; *aHyperlink = - static_cast(static_cast(hyperLink)); + static_cast(hyperLink); (*aHyperlink)->AddRef(); return S_OK; @@ -73,6 +88,11 @@ ia2AccessibleHypertext::get_hyperlinkIndex(long aCharIndex, long* aHyperlinkInde *aHyperlinkIndex = 0; + if (ProxyAccessible* proxy = HyperTextProxyFor(this)) { + *aHyperlinkIndex = proxy->LinkIndexAtOffset(aCharIndex); + return S_OK; + } + HyperTextAccessibleWrap* hyperAcc = static_cast(this); if (hyperAcc->IsDefunct()) return CO_E_OBJNOTCONNECTED;