Bug 1220897 - fix IAccessible2::get_accessibleWithCaret, r=tbsaunde
authorAlexander Surkov <surkov.alexander@gmail.com>
Fri, 06 Nov 2015 23:31:12 -0500
changeset 271631 4761642b93dc865f060d3f4e900282b33d394e1a
parent 271630 d907f1abdcf6f705e2554399218fe010a6b151a8
child 271632 380cc4f598401c14a7c2befdb6c71513af3e8328
push id67717
push usersurkov.alexander@gmail.com
push dateSat, 07 Nov 2015 04:31:25 +0000
treeherdermozilla-inbound@4761642b93dc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstbsaunde
bugs1220897
milestone45.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 1220897 - fix IAccessible2::get_accessibleWithCaret, r=tbsaunde
accessible/windows/ia2/ia2Accessible.cpp
--- a/accessible/windows/ia2/ia2Accessible.cpp
+++ b/accessible/windows/ia2/ia2Accessible.cpp
@@ -658,24 +658,25 @@ ia2Accessible::get_accessibleWithCaret(I
     return CO_E_OBJNOTCONNECTED;
 
   int32_t caretOffset = -1;
   Accessible* accWithCaret = SelectionMgr()->AccessibleWithCaret(&caretOffset);
   if (acc->Document() != accWithCaret->Document())
     return S_FALSE;
 
   Accessible* child = accWithCaret;
-  while (child != acc)
+  while (!child->IsDoc() && child != acc)
     child = child->Parent();
 
-  if (!child)
+  if (child != acc)
     return S_FALSE;
 
   *aAccessible =  static_cast<IAccessible2*>(
     static_cast<AccessibleWrap*>(accWithCaret));
+  (*aAccessible)->AddRef();
   *aCaretOffset = caretOffset;
   return S_OK;
 
   A11Y_TRYBLOCK_END
 }
 
 STDMETHODIMP
 ia2Accessible::get_relationTargetsOfType(BSTR aType,