bug 1159741 - make ia2HyperText use proxies r=davidb
authorTrevor Saunders <tbsaunde@tbsaunde.org>
Wed, 29 Apr 2015 10:36:33 -0400
changeset 242802 b6aa5c3d357933d065e1d302768a807b9d0624db
parent 242801 4dc03fc3888594f7713747e8af689d12897e6c7f
child 242803 603d4c01ca0a3e569020cf9e63106a6d448019d2
push id59514
push usertrev.saunders@gmail.com
push dateThu, 07 May 2015 17:48:20 +0000
treeherdermozilla-inbound@d5a70f4292a6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdavidb
bugs1159741
milestone40.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
bug 1159741 - make ia2HyperText use proxies r=davidb
accessible/windows/ia2/ia2AccessibleHypertext.cpp
--- a/accessible/windows/ia2/ia2AccessibleHypertext.cpp
+++ b/accessible/windows/ia2/ia2AccessibleHypertext.cpp
@@ -21,16 +21,21 @@ ia2AccessibleHypertext::get_nHyperlinks(
 {
   A11Y_TRYBLOCK_BEGIN
 
   if (!aHyperlinkCount)
     return E_INVALIDARG;
 
   *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;
 
   *aHyperlinkCount = hyperText->LinkCount();
   return S_OK;
 
   A11Y_TRYBLOCK_END
@@ -42,42 +47,57 @@ ia2AccessibleHypertext::get_hyperlink(lo
 {
   A11Y_TRYBLOCK_BEGIN
 
   if (!aHyperlink)
     return E_INVALIDARG;
 
   *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;
 
-  Accessible* hyperLink = hyperText->LinkAt(aLinkIndex);
+    hyperLink = WrapperFor(link);
+  } else {
+    HyperTextAccessibleWrap* hyperText = static_cast<HyperTextAccessibleWrap*>(this);
+    if (hyperText->IsDefunct())
+      return CO_E_OBJNOTCONNECTED;
+
+    hyperLink = static_cast<AccessibleWrap*>(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;
 
   A11Y_TRYBLOCK_END
 }
 
 STDMETHODIMP
 ia2AccessibleHypertext::get_hyperlinkIndex(long aCharIndex, long* aHyperlinkIndex)
 {
   A11Y_TRYBLOCK_BEGIN
 
   if (!aHyperlinkIndex)
     return E_INVALIDARG;
 
   *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;
 
   *aHyperlinkIndex = hyperAcc->LinkIndexAtOffset(aCharIndex);
   return S_OK;
 
   A11Y_TRYBLOCK_END