Skip to content

Commit

Permalink
bug 1159741 - make ia2HyperText use proxies r=davidb
Browse files Browse the repository at this point in the history
  • Loading branch information
tbsaunde committed May 7, 2015
1 parent 73aad67 commit ffecc37
Showing 1 changed file with 25 additions and 5 deletions.
30 changes: 25 additions & 5 deletions accessible/windows/ia2/ia2AccessibleHypertext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

Expand All @@ -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;
Expand Down

0 comments on commit ffecc37

Please sign in to comment.