mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 873438 - Implement IAccessible2_2::accessibleWithCaret, r=yzen
This commit is contained in:
parent
2764b0443c
commit
a94a922597
@ -18,6 +18,7 @@
|
||||
#include "nsIAccessibleTypes.h"
|
||||
#include "mozilla/a11y/PDocAccessible.h"
|
||||
#include "Relation.h"
|
||||
#include "nsAccessibilityService.h"
|
||||
|
||||
#include "nsIPersistentProperties2.h"
|
||||
#include "nsISimpleEnumerator.h"
|
||||
@ -651,7 +652,27 @@ ia2Accessible::get_accessibleWithCaret(IUnknown** aAccessible,
|
||||
|
||||
*aAccessible = nullptr;
|
||||
*aCaretOffset = -1;
|
||||
return E_NOTIMPL;
|
||||
|
||||
AccessibleWrap* acc = static_cast<AccessibleWrap*>(this);
|
||||
if (acc->IsDefunct())
|
||||
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)
|
||||
child = child->Parent();
|
||||
|
||||
if (!child)
|
||||
return S_FALSE;
|
||||
|
||||
*aAccessible = static_cast<IAccessible2*>(
|
||||
static_cast<AccessibleWrap*>(accWithCaret));
|
||||
*aCaretOffset = caretOffset;
|
||||
return S_OK;
|
||||
|
||||
A11Y_TRYBLOCK_END
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user