bug 1159741 - make ia2HyperText use proxies r=davidb

This commit is contained in:
Trevor Saunders 2015-04-29 10:36:33 -04:00
Родитель 86ad786706
Коммит 0a7a48758c
1 изменённых файлов: 25 добавлений и 5 удалений

Просмотреть файл

@ -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<HyperTextAccessibleWrap*>(this);
if (hyperText->IsDefunct())
return CO_E_OBJNOTCONNECTED;
@ -47,16 +52,26 @@ ia2AccessibleHypertext::get_hyperlink(long aLinkIndex,
*aHyperlink = nullptr;
HyperTextAccessibleWrap* hyperText = static_cast<HyperTextAccessibleWrap*>(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<HyperTextAccessibleWrap*>(this);
if (hyperText->IsDefunct())
return CO_E_OBJNOTCONNECTED;
hyperLink = static_cast<AccessibleWrap*>(hyperText->LinkAt(aLinkIndex));
}
Accessible* hyperLink = hyperText->LinkAt(aLinkIndex);
if (!hyperLink)
return E_FAIL;
*aHyperlink =
static_cast<IAccessibleHyperlink*>(static_cast<AccessibleWrap*>(hyperLink));
static_cast<IAccessibleHyperlink*>(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<HyperTextAccessibleWrap*>(this);
if (hyperAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;