Backed out changeset 9912f206b678 (bug 1268544)

This commit is contained in:
Sebastian Hengst 2016-08-19 10:02:28 +02:00
Родитель cc42764379
Коммит e2408b40db
7 изменённых файлов: 453 добавлений и 170 удалений

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

@ -73,7 +73,14 @@ ia2Accessible::get_nRelations(long* aNRelations)
if (acc->IsDefunct()) if (acc->IsDefunct())
return CO_E_OBJNOTCONNECTED; return CO_E_OBJNOTCONNECTED;
MOZ_ASSERT(!acc->IsProxy()); if (acc->IsProxy()) {
// XXX evaluate performance of collecting all relation targets.
nsTArray<RelationType> types;
nsTArray<nsTArray<ProxyAccessible*>> targetSets;
acc->Proxy()->Relations(&types, &targetSets);
*aNRelations = types.Length();
return S_OK;
}
for (uint32_t idx = 0; idx < ArrayLength(sRelationTypePairs); idx++) { for (uint32_t idx = 0; idx < ArrayLength(sRelationTypePairs); idx++) {
if (sRelationTypePairs[idx].second == IA2_RELATION_NULL) if (sRelationTypePairs[idx].second == IA2_RELATION_NULL)
@ -102,7 +109,33 @@ ia2Accessible::get_relation(long aRelationIndex,
if (acc->IsDefunct()) if (acc->IsDefunct())
return CO_E_OBJNOTCONNECTED; return CO_E_OBJNOTCONNECTED;
MOZ_ASSERT(!acc->IsProxy()); if (acc->IsProxy()) {
nsTArray<RelationType> types;
nsTArray<nsTArray<ProxyAccessible*>> targetSets;
acc->Proxy()->Relations(&types, &targetSets);
size_t targetSetCount = targetSets.Length();
for (size_t i = 0; i < targetSetCount; i++) {
uint32_t relTypeIdx = static_cast<uint32_t>(types[i]);
MOZ_ASSERT(sRelationTypePairs[relTypeIdx].first == types[i]);
if (sRelationTypePairs[relTypeIdx].second == IA2_RELATION_NULL)
continue;
if (static_cast<size_t>(aRelationIndex) == i) {
nsTArray<RefPtr<Accessible>> targets;
size_t targetCount = targetSets[i].Length();
for (size_t j = 0; j < targetCount; j++)
targets.AppendElement(WrapperFor(targetSets[i][j]));
RefPtr<ia2AccessibleRelation> rel =
new ia2AccessibleRelation(types[i], Move(targets));
rel.forget(aRelation);
return S_OK;
}
}
return E_INVALIDARG;
}
long relIdx = 0; long relIdx = 0;
for (uint32_t idx = 0; idx < ArrayLength(sRelationTypePairs); idx++) { for (uint32_t idx = 0; idx < ArrayLength(sRelationTypePairs); idx++) {
@ -143,7 +176,33 @@ ia2Accessible::get_relations(long aMaxRelations,
if (acc->IsDefunct()) if (acc->IsDefunct())
return CO_E_OBJNOTCONNECTED; return CO_E_OBJNOTCONNECTED;
MOZ_ASSERT(!acc->IsProxy()); if (acc->IsProxy()) {
nsTArray<RelationType> types;
nsTArray<nsTArray<ProxyAccessible*>> targetSets;
acc->Proxy()->Relations(&types, &targetSets);
size_t count = std::min(targetSets.Length(),
static_cast<size_t>(aMaxRelations));
size_t i = 0;
while (i < count) {
uint32_t relTypeIdx = static_cast<uint32_t>(types[i]);
if (sRelationTypePairs[relTypeIdx].second == IA2_RELATION_NULL)
continue;
size_t targetCount = targetSets[i].Length();
nsTArray<RefPtr<Accessible>> targets(targetCount);
for (size_t j = 0; j < targetCount; j++)
targets.AppendElement(WrapperFor(targetSets[i][j]));
RefPtr<ia2AccessibleRelation> rel =
new ia2AccessibleRelation(types[i], Move(targets));
rel.forget(aRelation + i);
i++;
}
*aNRelations = i;
return S_OK;
}
for (uint32_t idx = 0; idx < ArrayLength(sRelationTypePairs) && for (uint32_t idx = 0; idx < ArrayLength(sRelationTypePairs) &&
*aNRelations < aMaxRelations; idx++) { *aNRelations < aMaxRelations; idx++) {
@ -184,8 +243,10 @@ ia2Accessible::role(long* aRole)
break; break;
a11y::role geckoRole; a11y::role geckoRole;
MOZ_ASSERT(!acc->IsProxy()); if (acc->IsProxy())
geckoRole = acc->Role(); geckoRole = acc->Proxy()->Role();
else
geckoRole = acc->Role();
switch (geckoRole) { switch (geckoRole) {
#include "RoleMap.h" #include "RoleMap.h"
default: default:
@ -196,11 +257,16 @@ ia2Accessible::role(long* aRole)
// Special case, if there is a ROLE_ROW inside of a ROLE_TREE_TABLE, then call // Special case, if there is a ROLE_ROW inside of a ROLE_TREE_TABLE, then call
// the IA2 role a ROLE_OUTLINEITEM. // the IA2 role a ROLE_OUTLINEITEM.
MOZ_ASSERT(!acc->IsProxy()); if (acc->IsProxy()) {
if (geckoRole == roles::ROW) { if (geckoRole == roles::ROW && acc->Proxy()->Parent() &&
Accessible* xpParent = acc->Parent(); acc->Proxy()->Parent()->Role() == roles::TREE_TABLE)
if (xpParent && xpParent->Role() == roles::TREE_TABLE)
*aRole = ROLE_SYSTEM_OUTLINEITEM; *aRole = ROLE_SYSTEM_OUTLINEITEM;
} else {
if (geckoRole == roles::ROW) {
Accessible* xpParent = acc->Parent();
if (xpParent && xpParent->Role() == roles::TREE_TABLE)
*aRole = ROLE_SYSTEM_OUTLINEITEM;
}
} }
return S_OK; return S_OK;
@ -217,9 +283,12 @@ ia2Accessible::scrollTo(enum IA2ScrollType aScrollType)
if (acc->IsDefunct()) if (acc->IsDefunct())
return CO_E_OBJNOTCONNECTED; return CO_E_OBJNOTCONNECTED;
MOZ_ASSERT(!acc->IsProxy()); if (acc->IsProxy()) {
nsCoreUtils::ScrollTo(acc->Document()->PresShell(), acc->GetContent(), acc->Proxy()->ScrollTo(aScrollType);
aScrollType); } else {
nsCoreUtils::ScrollTo(acc->Document()->PresShell(), acc->GetContent(),
aScrollType);
}
return S_OK; return S_OK;
@ -240,8 +309,11 @@ ia2Accessible::scrollToPoint(enum IA2CoordinateType aCoordType,
nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE : nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE :
nsIAccessibleCoordinateType::COORDTYPE_PARENT_RELATIVE; nsIAccessibleCoordinateType::COORDTYPE_PARENT_RELATIVE;
MOZ_ASSERT(!acc->IsProxy()); if (acc->IsProxy()) {
acc->ScrollToPoint(geckoCoordType, aX, aY); acc->Proxy()->ScrollToPoint(geckoCoordType, aX, aY);
} else {
acc->ScrollToPoint(geckoCoordType, aX, aY);
}
return S_OK; return S_OK;
@ -301,8 +373,10 @@ ia2Accessible::get_states(AccessibleStates* aStates)
} }
uint64_t state; uint64_t state;
MOZ_ASSERT(!acc->IsProxy()); if (acc->IsProxy())
state = acc->State(); state = acc->Proxy()->State();
else
state = acc->State();
if (state & states::INVALID) if (state & states::INVALID)
*aStates |= IA2_STATE_INVALID_ENTRY; *aStates |= IA2_STATE_INVALID_ENTRY;
@ -474,8 +548,10 @@ ia2Accessible::get_indexInParent(long* aIndexInParent)
if (acc->IsDefunct()) if (acc->IsDefunct())
return CO_E_OBJNOTCONNECTED; return CO_E_OBJNOTCONNECTED;
MOZ_ASSERT(!acc->IsProxy()); if (acc->IsProxy())
*aIndexInParent = acc->IndexInParent(); *aIndexInParent = acc->Proxy()->IndexInParent();
else
*aIndexInParent = acc->IndexInParent();
if (*aIndexInParent == -1) if (*aIndexInParent == -1)
return S_FALSE; return S_FALSE;
@ -556,8 +632,9 @@ ia2Accessible::get_attributes(BSTR* aAttributes)
return ConvertToIA2Attributes(attributes, aAttributes); return ConvertToIA2Attributes(attributes, aAttributes);
} }
MOZ_ASSERT(!acc->IsProxy()); nsTArray<Attribute> attrs;
return E_UNEXPECTED; acc->Proxy()->Attributes(&attrs);
return ConvertToIA2Attributes(&attrs, aAttributes);
A11Y_TRYBLOCK_END A11Y_TRYBLOCK_END
} }
@ -642,12 +719,21 @@ ia2Accessible::get_relationTargetsOfType(BSTR aType,
return CO_E_OBJNOTCONNECTED; return CO_E_OBJNOTCONNECTED;
nsTArray<Accessible*> targets; nsTArray<Accessible*> targets;
MOZ_ASSERT(!acc->IsProxy()); if (acc->IsProxy()) {
Relation rel = acc->RelationByType(*relationType); nsTArray<ProxyAccessible*> targetProxies =
Accessible* target = nullptr; acc->Proxy()->RelationByType(*relationType);
while ((target = rel.Next()) &&
static_cast<long>(targets.Length()) <= aMaxTargets) { size_t targetCount = aMaxTargets;
targets.AppendElement(target); if (targetProxies.Length() < targetCount)
targetCount = targetProxies.Length();
for (size_t i = 0; i < targetCount; i++)
targets.AppendElement(WrapperFor(targetProxies[i]));
} else {
Relation rel = acc->RelationByType(*relationType);
Accessible* target = nullptr;
while ((target = rel.Next()) &&
static_cast<long>(targets.Length()) <= aMaxTargets)
targets.AppendElement(target);
} }
*aNTargets = targets.Length(); *aNTargets = targets.Length();

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

@ -24,7 +24,9 @@ ia2AccessibleEditableText::copyText(long aStartOffset, long aEndOffset)
{ {
A11Y_TRYBLOCK_BEGIN A11Y_TRYBLOCK_BEGIN
MOZ_ASSERT(!HyperTextProxyFor(this)); if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
return proxy->CopyText(aStartOffset, aEndOffset) ? S_OK : E_INVALIDARG;
}
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this); HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct()) if (textAcc->IsDefunct())
@ -44,7 +46,9 @@ ia2AccessibleEditableText::deleteText(long aStartOffset, long aEndOffset)
{ {
A11Y_TRYBLOCK_BEGIN A11Y_TRYBLOCK_BEGIN
MOZ_ASSERT(!HyperTextProxyFor(this)); if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
return proxy->DeleteText(aStartOffset, aEndOffset) ? S_OK : E_INVALIDARG;
}
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this); HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct()) if (textAcc->IsDefunct())
@ -66,7 +70,9 @@ ia2AccessibleEditableText::insertText(long aOffset, BSTR *aText)
uint32_t length = ::SysStringLen(*aText); uint32_t length = ::SysStringLen(*aText);
nsAutoString text(*aText, length); nsAutoString text(*aText, length);
MOZ_ASSERT(!HyperTextProxyFor(this)); if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
return proxy->InsertText(text, aOffset) ? S_OK : E_INVALIDARG;
}
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this); HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct()) if (textAcc->IsDefunct())
@ -86,7 +92,9 @@ ia2AccessibleEditableText::cutText(long aStartOffset, long aEndOffset)
{ {
A11Y_TRYBLOCK_BEGIN A11Y_TRYBLOCK_BEGIN
MOZ_ASSERT(!HyperTextProxyFor(this)); if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
return proxy->CutText(aStartOffset, aEndOffset) ? S_OK : E_INVALIDARG;
}
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this); HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct()) if (textAcc->IsDefunct())
@ -106,7 +114,9 @@ ia2AccessibleEditableText::pasteText(long aOffset)
{ {
A11Y_TRYBLOCK_BEGIN A11Y_TRYBLOCK_BEGIN
MOZ_ASSERT(!HyperTextProxyFor(this)); if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
return proxy->PasteText(aOffset) ? S_OK : E_INVALIDARG;
}
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this); HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct()) if (textAcc->IsDefunct())

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

@ -53,7 +53,17 @@ ia2AccessibleHyperlink::get_anchor(long aIndex, VARIANT* aAnchor)
VariantInit(aAnchor); VariantInit(aAnchor);
Accessible* thisObj = static_cast<AccessibleWrap*>(this); Accessible* thisObj = static_cast<AccessibleWrap*>(this);
MOZ_ASSERT(!thisObj->IsProxy()); if (thisObj->IsProxy()) {
ProxyAccessible* anchor = thisObj->Proxy()->AnchorAt(aIndex);
if (!anchor)
return S_FALSE;
IUnknown* tmp = static_cast<IAccessibleHyperlink*>(WrapperFor(anchor));
tmp->AddRef();
aAnchor->punkVal = tmp;
aAnchor->vt = VT_UNKNOWN;
return S_OK;
}
if (thisObj->IsDefunct()) if (thisObj->IsDefunct())
return CO_E_OBJNOTCONNECTED; return CO_E_OBJNOTCONNECTED;
@ -87,35 +97,36 @@ ia2AccessibleHyperlink::get_anchorTarget(long aIndex, VARIANT* aAnchorTarget)
{ {
A11Y_TRYBLOCK_BEGIN A11Y_TRYBLOCK_BEGIN
if (!aAnchorTarget) { if (!aAnchorTarget)
return E_INVALIDARG; return E_INVALIDARG;
}
VariantInit(aAnchorTarget); VariantInit(aAnchorTarget);
Accessible* thisObj = static_cast<AccessibleWrap*>(this); Accessible* thisObj = static_cast<AccessibleWrap*>(this);
nsAutoCString uriStr; nsAutoCString uriStr;
MOZ_ASSERT(!thisObj->IsProxy()); if (thisObj->IsProxy()) {
if (thisObj->IsDefunct()) { bool ok;
return CO_E_OBJNOTCONNECTED; thisObj->Proxy()->AnchorURIAt(aIndex, uriStr, &ok);
} if (!ok)
return S_FALSE;
if (aIndex < 0 || aIndex >= static_cast<long>(thisObj->AnchorCount())) { } else {
return E_INVALIDARG; if (thisObj->IsDefunct())
} return CO_E_OBJNOTCONNECTED;
if (!thisObj->IsLink()) { if (aIndex < 0 || aIndex >= static_cast<long>(thisObj->AnchorCount()))
return S_FALSE; return E_INVALIDARG;
}
nsCOMPtr<nsIURI> uri = thisObj->AnchorURIAt(aIndex); if (!thisObj->IsLink())
if (!uri) { return S_FALSE;
return S_FALSE;
}
nsresult rv = uri->GetSpec(uriStr); nsCOMPtr<nsIURI> uri = thisObj->AnchorURIAt(aIndex);
if (NS_FAILED(rv)) { if (!uri)
return GetHRESULT(rv); return S_FALSE;
nsresult rv = uri->GetSpec(uriStr);
if (NS_FAILED(rv))
return GetHRESULT(rv);
} }
nsAutoString stringURI; nsAutoString stringURI;
@ -139,7 +150,11 @@ ia2AccessibleHyperlink::get_startIndex(long* aIndex)
*aIndex = 0; *aIndex = 0;
MOZ_ASSERT(!HyperTextProxyFor(this)); if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
bool valid;
*aIndex = proxy->StartOffset(&valid);
return valid ? S_OK : S_FALSE;
}
Accessible* thisObj = static_cast<AccessibleWrap*>(this); Accessible* thisObj = static_cast<AccessibleWrap*>(this);
if (thisObj->IsDefunct()) if (thisObj->IsDefunct())
@ -164,7 +179,11 @@ ia2AccessibleHyperlink::get_endIndex(long* aIndex)
*aIndex = 0; *aIndex = 0;
MOZ_ASSERT(!HyperTextProxyFor(this)); if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
bool valid;
*aIndex = proxy->EndOffset(&valid);
return valid ? S_OK : S_FALSE;
}
Accessible* thisObj = static_cast<AccessibleWrap*>(this); Accessible* thisObj = static_cast<AccessibleWrap*>(this);
if (thisObj->IsDefunct()) if (thisObj->IsDefunct())
@ -189,7 +208,10 @@ ia2AccessibleHyperlink::get_valid(boolean* aValid)
*aValid = false; *aValid = false;
MOZ_ASSERT(!HyperTextProxyFor(this)); if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
*aValid = proxy->IsLinkValid();
return S_OK;
}
Accessible* thisObj = static_cast<AccessibleWrap*>(this); Accessible* thisObj = static_cast<AccessibleWrap*>(this);
if (thisObj->IsDefunct()) if (thisObj->IsDefunct())

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

@ -26,7 +26,10 @@ ia2AccessibleHypertext::get_nHyperlinks(long* aHyperlinkCount)
*aHyperlinkCount = 0; *aHyperlinkCount = 0;
MOZ_ASSERT(!HyperTextProxyFor(this)); if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
*aHyperlinkCount = proxy->LinkCount();
return S_OK;
}
HyperTextAccessibleWrap* hyperText = static_cast<HyperTextAccessibleWrap*>(this); HyperTextAccessibleWrap* hyperText = static_cast<HyperTextAccessibleWrap*>(this);
if (hyperText->IsDefunct()) if (hyperText->IsDefunct())
@ -50,13 +53,19 @@ ia2AccessibleHypertext::get_hyperlink(long aLinkIndex,
*aHyperlink = nullptr; *aHyperlink = nullptr;
AccessibleWrap* hyperLink; AccessibleWrap* hyperLink;
MOZ_ASSERT(!HyperTextProxyFor(this)); if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
HyperTextAccessibleWrap* hyperText = static_cast<HyperTextAccessibleWrap*>(this); ProxyAccessible* link = proxy->LinkAt(aLinkIndex);
if (hyperText->IsDefunct()) { if (!link)
return CO_E_OBJNOTCONNECTED; return E_FAIL;
}
hyperLink = static_cast<AccessibleWrap*>(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) if (!hyperLink)
return E_FAIL; return E_FAIL;
@ -79,7 +88,10 @@ ia2AccessibleHypertext::get_hyperlinkIndex(long aCharIndex, long* aHyperlinkInde
*aHyperlinkIndex = 0; *aHyperlinkIndex = 0;
MOZ_ASSERT(!HyperTextProxyFor(this)); if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
*aHyperlinkIndex = proxy->LinkIndexAtOffset(aCharIndex);
return S_OK;
}
HyperTextAccessibleWrap* hyperAcc = static_cast<HyperTextAccessibleWrap*>(this); HyperTextAccessibleWrap* hyperAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (hyperAcc->IsDefunct()) if (hyperAcc->IsDefunct())

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

@ -30,7 +30,10 @@ ia2AccessibleText::addSelection(long aStartOffset, long aEndOffset)
{ {
A11Y_TRYBLOCK_BEGIN A11Y_TRYBLOCK_BEGIN
MOZ_ASSERT(!HyperTextProxyFor(this)); if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
return proxy->AddToSelection(aStartOffset, aEndOffset) ?
S_OK : E_INVALIDARG;
}
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this); HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct()) if (textAcc->IsDefunct())
@ -57,16 +60,21 @@ ia2AccessibleText::get_attributes(long aOffset, long *aStartOffset,
int32_t startOffset = 0, endOffset = 0; int32_t startOffset = 0, endOffset = 0;
HRESULT hr; HRESULT hr;
MOZ_ASSERT(!HyperTextProxyFor(this)); if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this); AutoTArray<Attribute, 10> attrs;
if (textAcc->IsDefunct()) { proxy->TextAttributes(true, aOffset, &attrs, &startOffset, &endOffset);
return CO_E_OBJNOTCONNECTED; hr = AccessibleWrap::ConvertToIA2Attributes(&attrs, aTextAttributes);
} else {
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
nsCOMPtr<nsIPersistentProperties> attributes =
textAcc->TextAttributes(true, aOffset, &startOffset, &endOffset);
hr = AccessibleWrap::ConvertToIA2Attributes(attributes, aTextAttributes);
} }
nsCOMPtr<nsIPersistentProperties> attributes =
textAcc->TextAttributes(true, aOffset, &startOffset, &endOffset);
hr = AccessibleWrap::ConvertToIA2Attributes(attributes, aTextAttributes);
if (FAILED(hr)) if (FAILED(hr))
return hr; return hr;
@ -88,13 +96,15 @@ ia2AccessibleText::get_caretOffset(long *aOffset)
*aOffset = -1; *aOffset = -1;
MOZ_ASSERT(!HyperTextProxyFor(this)); if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this); *aOffset = proxy->CaretOffset();
if (textAcc->IsDefunct()) { } else {
return CO_E_OBJNOTCONNECTED; HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
} if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
*aOffset = textAcc->CaretOffset(); *aOffset = textAcc->CaretOffset();
}
return *aOffset != -1 ? S_OK : S_FALSE; return *aOffset != -1 ? S_OK : S_FALSE;
@ -117,12 +127,15 @@ ia2AccessibleText::get_characterExtents(long aOffset,
nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE : nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE :
nsIAccessibleCoordinateType::COORDTYPE_PARENT_RELATIVE; nsIAccessibleCoordinateType::COORDTYPE_PARENT_RELATIVE;
nsIntRect rect; nsIntRect rect;
MOZ_ASSERT(!HyperTextProxyFor(this)); if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this); rect = proxy->CharBounds(aOffset, geckoCoordType);
if (textAcc->IsDefunct()) } else {
return CO_E_OBJNOTCONNECTED; HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
rect = textAcc->CharBounds(aOffset, geckoCoordType); rect = textAcc->CharBounds(aOffset, geckoCoordType);
}
*aX = rect.x; *aX = rect.x;
*aY = rect.y; *aY = rect.y;
@ -142,13 +155,15 @@ ia2AccessibleText::get_nSelections(long* aNSelections)
return E_INVALIDARG; return E_INVALIDARG;
*aNSelections = 0; *aNSelections = 0;
MOZ_ASSERT(!HyperTextProxyFor(this)); if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this); *aNSelections = proxy->SelectionCount();
if (textAcc->IsDefunct()) { } else {
return CO_E_OBJNOTCONNECTED; HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
} if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
*aNSelections = textAcc->SelectionCount(); *aNSelections = textAcc->SelectionCount();
}
return S_OK; return S_OK;
@ -170,13 +185,15 @@ ia2AccessibleText::get_offsetAtPoint(long aX, long aY,
nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE : nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE :
nsIAccessibleCoordinateType::COORDTYPE_PARENT_RELATIVE; nsIAccessibleCoordinateType::COORDTYPE_PARENT_RELATIVE;
MOZ_ASSERT(!HyperTextProxyFor(this)); if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this); *aOffset = proxy->OffsetAtPoint(aX, aY, geckoCoordType);
if (textAcc->IsDefunct()) { } else {
return CO_E_OBJNOTCONNECTED; HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
} if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
*aOffset = textAcc->OffsetAtPoint(aX, aY, geckoCoordType); *aOffset = textAcc->OffsetAtPoint(aX, aY, geckoCoordType);
}
return *aOffset == -1 ? S_FALSE : S_OK; return *aOffset == -1 ? S_FALSE : S_OK;
@ -194,14 +211,18 @@ ia2AccessibleText::get_selection(long aSelectionIndex, long* aStartOffset,
*aStartOffset = *aEndOffset = 0; *aStartOffset = *aEndOffset = 0;
int32_t startOffset = 0, endOffset = 0; int32_t startOffset = 0, endOffset = 0;
MOZ_ASSERT(!HyperTextProxyFor(this)); if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this); nsString unused;
if (textAcc->IsDefunct()) { if (!proxy->SelectionBoundsAt(aSelectionIndex, unused, &startOffset,
return CO_E_OBJNOTCONNECTED; &endOffset))
} return E_INVALIDARG;
} else {
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
if (!textAcc->SelectionBoundsAt(aSelectionIndex, &startOffset, &endOffset)) { if (!textAcc->SelectionBoundsAt(aSelectionIndex, &startOffset, &endOffset))
return E_INVALIDARG; return E_INVALIDARG;
} }
*aStartOffset = startOffset; *aStartOffset = startOffset;
@ -222,17 +243,20 @@ ia2AccessibleText::get_text(long aStartOffset, long aEndOffset, BSTR* aText)
*aText = nullptr; *aText = nullptr;
nsAutoString text; nsAutoString text;
MOZ_ASSERT(!HyperTextProxyFor(this)); if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this); if (!proxy->TextSubstring(aStartOffset, aEndOffset, text)) {
if (textAcc->IsDefunct()) { return E_INVALIDARG;
return CO_E_OBJNOTCONNECTED; }
} } else {
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
if (!textAcc->IsValidRange(aStartOffset, aEndOffset)) { if (!textAcc->IsValidRange(aStartOffset, aEndOffset))
return E_INVALIDARG; return E_INVALIDARG;
}
textAcc->TextSubstring(aStartOffset, aEndOffset, text); textAcc->TextSubstring(aStartOffset, aEndOffset, text);
}
if (text.IsEmpty()) if (text.IsEmpty())
return S_FALSE; return S_FALSE;
@ -390,7 +414,9 @@ ia2AccessibleText::removeSelection(long aSelectionIndex)
{ {
A11Y_TRYBLOCK_BEGIN A11Y_TRYBLOCK_BEGIN
MOZ_ASSERT(!HyperTextProxyFor(this)); if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
return proxy->RemoveFromSelection(aSelectionIndex) ? S_OK : E_INVALIDARG;
}
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this); HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct()) if (textAcc->IsDefunct())
@ -407,7 +433,10 @@ ia2AccessibleText::setCaretOffset(long aOffset)
{ {
A11Y_TRYBLOCK_BEGIN A11Y_TRYBLOCK_BEGIN
MOZ_ASSERT(!HyperTextProxyFor(this)); if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
proxy->SetCaretOffset(aOffset);
return S_OK;
}
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this); HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct()) if (textAcc->IsDefunct())
@ -428,7 +457,10 @@ ia2AccessibleText::setSelection(long aSelectionIndex, long aStartOffset,
{ {
A11Y_TRYBLOCK_BEGIN A11Y_TRYBLOCK_BEGIN
MOZ_ASSERT(!HyperTextProxyFor(this)); if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
return proxy->SetSelectionBoundsAt(aSelectionIndex, aStartOffset,
aEndOffset) ? S_OK : E_INVALIDARG;
}
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this); HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct()) if (textAcc->IsDefunct())
@ -449,7 +481,10 @@ ia2AccessibleText::get_nCharacters(long* aNCharacters)
return E_INVALIDARG; return E_INVALIDARG;
*aNCharacters = 0; *aNCharacters = 0;
MOZ_ASSERT(!HyperTextProxyFor(this)); if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
*aNCharacters = proxy->CharacterCount();
return S_OK;
}
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this); HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct()) if (textAcc->IsDefunct())
@ -467,7 +502,10 @@ ia2AccessibleText::scrollSubstringTo(long aStartIndex, long aEndIndex,
{ {
A11Y_TRYBLOCK_BEGIN A11Y_TRYBLOCK_BEGIN
MOZ_ASSERT(!HyperTextProxyFor(this)); if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
proxy->ScrollSubstringTo(aStartIndex, aEndIndex, aScrollType);
return S_OK;
}
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this); HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct()) if (textAcc->IsDefunct())
@ -493,7 +531,11 @@ ia2AccessibleText::scrollSubstringToPoint(long aStartIndex, long aEndIndex,
nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE : nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE :
nsIAccessibleCoordinateType::COORDTYPE_PARENT_RELATIVE; nsIAccessibleCoordinateType::COORDTYPE_PARENT_RELATIVE;
MOZ_ASSERT(!HyperTextProxyFor(this)); if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
proxy->ScrollSubstringToPoint(aStartIndex, aEndIndex, geckoCoordType, aX,
aY);
return S_OK;
}
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this); HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct()) if (textAcc->IsDefunct())

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

@ -55,12 +55,14 @@ ia2AccessibleValue::get_currentValue(VARIANT* aCurrentValue)
AccessibleWrap* valueAcc = static_cast<AccessibleWrap*>(this); AccessibleWrap* valueAcc = static_cast<AccessibleWrap*>(this);
double currentValue; double currentValue;
MOZ_ASSERT(!valueAcc->IsProxy()); if (valueAcc->IsProxy()) {
if (valueAcc->IsDefunct()) { currentValue = valueAcc->Proxy()->CurValue();
return CO_E_OBJNOTCONNECTED; } else {
} if (valueAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
currentValue = valueAcc->CurValue(); currentValue = valueAcc->CurValue();
}
if (IsNaN(currentValue)) if (IsNaN(currentValue))
return S_FALSE; return S_FALSE;
@ -81,7 +83,8 @@ ia2AccessibleValue::setCurrentValue(VARIANT aValue)
return E_INVALIDARG; return E_INVALIDARG;
AccessibleWrap* valueAcc = static_cast<AccessibleWrap*>(this); AccessibleWrap* valueAcc = static_cast<AccessibleWrap*>(this);
MOZ_ASSERT(!valueAcc->IsProxy()); if (valueAcc->IsProxy())
return valueAcc->Proxy()->SetCurValue(aValue.dblVal) ? S_OK : E_FAIL;
if (valueAcc->IsDefunct()) if (valueAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED; return CO_E_OBJNOTCONNECTED;
@ -103,12 +106,14 @@ ia2AccessibleValue::get_maximumValue(VARIANT* aMaximumValue)
AccessibleWrap* valueAcc = static_cast<AccessibleWrap*>(this); AccessibleWrap* valueAcc = static_cast<AccessibleWrap*>(this);
double maximumValue; double maximumValue;
MOZ_ASSERT(!valueAcc->IsProxy()); if (valueAcc->IsProxy()) {
if (valueAcc->IsDefunct()) { maximumValue = valueAcc->Proxy()->MaxValue();
return CO_E_OBJNOTCONNECTED; } else {
} if (valueAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
maximumValue = valueAcc->MaxValue(); maximumValue = valueAcc->MaxValue();
}
if (IsNaN(maximumValue)) if (IsNaN(maximumValue))
return S_FALSE; return S_FALSE;
@ -132,12 +137,14 @@ ia2AccessibleValue::get_minimumValue(VARIANT* aMinimumValue)
AccessibleWrap* valueAcc = static_cast<AccessibleWrap*>(this); AccessibleWrap* valueAcc = static_cast<AccessibleWrap*>(this);
double minimumValue; double minimumValue;
MOZ_ASSERT(!valueAcc->IsProxy()); if (valueAcc->IsProxy()) {
if (valueAcc->IsDefunct()) { minimumValue = valueAcc->Proxy()->MinValue();
return CO_E_OBJNOTCONNECTED; } else {
} if (valueAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
minimumValue = valueAcc->MinValue(); minimumValue = valueAcc->MinValue();
}
if (IsNaN(minimumValue)) if (IsNaN(minimumValue))
return S_FALSE; return S_FALSE;

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

@ -187,6 +187,16 @@ AccessibleWrap::get_accParent( IDispatch __RPC_FAR *__RPC_FAR *ppdispParent)
if (IsDefunct()) if (IsDefunct())
return CO_E_OBJNOTCONNECTED; return CO_E_OBJNOTCONNECTED;
if (IsProxy()) {
ProxyAccessible* proxy = Proxy();
ProxyAccessible* parent = proxy->Parent();
if (!parent)
return S_FALSE;
*ppdispParent = NativeAccessible(WrapperFor(parent));
return S_OK;
}
DocAccessible* doc = AsDoc(); DocAccessible* doc = AsDoc();
if (doc) { if (doc) {
// Return window system accessible object for root document and tab document // Return window system accessible object for root document and tab document
@ -226,6 +236,15 @@ AccessibleWrap::get_accChildCount( long __RPC_FAR *pcountChildren)
if (IsDefunct()) if (IsDefunct())
return CO_E_OBJNOTCONNECTED; return CO_E_OBJNOTCONNECTED;
if (IsProxy()) {
ProxyAccessible* proxy = Proxy();
if (proxy->MustPruneChildren())
return S_OK;
*pcountChildren = proxy->ChildrenCount();
return S_OK;
}
if (nsAccUtils::MustPrune(this)) if (nsAccUtils::MustPrune(this))
return S_OK; return S_OK;
@ -290,7 +309,10 @@ AccessibleWrap::get_accName(
return CO_E_OBJNOTCONNECTED; return CO_E_OBJNOTCONNECTED;
nsAutoString name; nsAutoString name;
xpAccessible->Name(name); if (xpAccessible->IsProxy())
xpAccessible->Proxy()->Name(name);
else
xpAccessible->Name(name);
// The name was not provided, e.g. no alt attribute for an image. A screen // The name was not provided, e.g. no alt attribute for an image. A screen
// reader may choose to invent its own accessible name, e.g. from an image src // reader may choose to invent its own accessible name, e.g. from an image src
@ -329,6 +351,10 @@ AccessibleWrap::get_accValue(
if (xpAccessible->IsDefunct()) if (xpAccessible->IsDefunct())
return CO_E_OBJNOTCONNECTED; return CO_E_OBJNOTCONNECTED;
// TODO make this work with proxies.
if (IsProxy())
return E_NOTIMPL;
nsAutoString value; nsAutoString value;
xpAccessible->Value(value); xpAccessible->Value(value);
@ -368,7 +394,10 @@ AccessibleWrap::get_accDescription(VARIANT varChild,
return CO_E_OBJNOTCONNECTED; return CO_E_OBJNOTCONNECTED;
nsAutoString description; nsAutoString description;
xpAccessible->Description(description); if (IsProxy())
xpAccessible->Proxy()->Description(description);
else
xpAccessible->Description(description);
*pszDescription = ::SysAllocStringLen(description.get(), *pszDescription = ::SysAllocStringLen(description.get(),
description.Length()); description.Length());
@ -400,12 +429,16 @@ AccessibleWrap::get_accRole(
return CO_E_OBJNOTCONNECTED; return CO_E_OBJNOTCONNECTED;
a11y::role geckoRole; a11y::role geckoRole;
if (xpAccessible->IsProxy()) {
geckoRole = xpAccessible->Proxy()->Role();
} else {
#ifdef DEBUG #ifdef DEBUG
NS_ASSERTION(nsAccUtils::IsTextInterfaceSupportCorrect(xpAccessible), NS_ASSERTION(nsAccUtils::IsTextInterfaceSupportCorrect(xpAccessible),
"Does not support Text when it should"); "Does not support Text when it should");
#endif #endif
geckoRole = xpAccessible->Role(); geckoRole = xpAccessible->Role();
}
uint32_t msaaRole = 0; uint32_t msaaRole = 0;
@ -426,12 +459,18 @@ AccessibleWrap::get_accRole(
// Special case, if there is a ROLE_ROW inside of a ROLE_TREE_TABLE, then call the MSAA role // Special case, if there is a ROLE_ROW inside of a ROLE_TREE_TABLE, then call the MSAA role
// a ROLE_OUTLINEITEM for consistency and compatibility. // a ROLE_OUTLINEITEM for consistency and compatibility.
// We need this because ARIA has a role of "row" for both grid and treegrid // We need this because ARIA has a role of "row" for both grid and treegrid
if (geckoRole == roles::ROW) { if (xpAccessible->IsProxy()) {
Accessible* xpParent = Parent(); if (geckoRole == roles::ROW
if (xpParent && xpParent->Role() == roles::TREE_TABLE) && xpAccessible->Proxy()->Parent()->Role() == roles::TREE_TABLE)
msaaRole = ROLE_SYSTEM_OUTLINEITEM; msaaRole = ROLE_SYSTEM_OUTLINEITEM;
} else {
if (geckoRole == roles::ROW) {
Accessible* xpParent = Parent();
if (xpParent && xpParent->Role() == roles::TREE_TABLE)
msaaRole = ROLE_SYSTEM_OUTLINEITEM;
}
} }
// -- Try enumerated role // -- Try enumerated role
if (msaaRole != USE_ROLE_STRING) { if (msaaRole != USE_ROLE_STRING) {
pvarRole->vt = VT_I4; pvarRole->vt = VT_I4;
@ -439,6 +478,10 @@ AccessibleWrap::get_accRole(
return S_OK; return S_OK;
} }
// XXX bug 798492 make this work with proxies?
if (IsProxy())
return E_FAIL;
// -- Try BSTR role // -- Try BSTR role
// Could not map to known enumerated MSAA role like ROLE_BUTTON // Could not map to known enumerated MSAA role like ROLE_BUTTON
// Use BSTR role to expose role attribute or tag name + namespace // Use BSTR role to expose role attribute or tag name + namespace
@ -509,7 +552,11 @@ AccessibleWrap::get_accState(
// INVALID -> ALERT_HIGH // INVALID -> ALERT_HIGH
// CHECKABLE -> MARQUEED // CHECKABLE -> MARQUEED
uint64_t state = State(); uint64_t state;
if (xpAccessible->IsProxy())
state = xpAccessible->Proxy()->State();
else
state = State();
uint32_t msaaState = 0; uint32_t msaaState = 0;
nsAccUtils::To32States(state, &msaaState, nullptr); nsAccUtils::To32States(state, &msaaState, nullptr);
@ -575,6 +622,10 @@ AccessibleWrap::get_accKeyboardShortcut(
if (acc->IsDefunct()) if (acc->IsDefunct())
return CO_E_OBJNOTCONNECTED; return CO_E_OBJNOTCONNECTED;
// TODO make this work with proxies.
if (acc->IsProxy())
return E_NOTIMPL;
KeyBinding keyBinding = acc->AccessKey(); KeyBinding keyBinding = acc->AccessKey();
if (keyBinding.IsEmpty()) if (keyBinding.IsEmpty())
keyBinding = acc->KeyboardShortcut(); keyBinding = acc->KeyboardShortcut();
@ -610,7 +661,13 @@ AccessibleWrap::get_accFocus(
return CO_E_OBJNOTCONNECTED; return CO_E_OBJNOTCONNECTED;
// Return the current IAccessible child that has focus // Return the current IAccessible child that has focus
Accessible* focusedAccessible = FocusedChild(); Accessible* focusedAccessible;
if (IsProxy()) {
ProxyAccessible* proxy = Proxy()->FocusedChild();
focusedAccessible = proxy ? WrapperFor(proxy) : nullptr;
} else {
focusedAccessible = FocusedChild();
}
if (focusedAccessible == this) { if (focusedAccessible == this) {
pvarChild->vt = VT_I4; pvarChild->vt = VT_I4;
@ -772,9 +829,23 @@ AccessibleWrap::get_accSelection(VARIANT __RPC_FAR *pvarChildren)
if (IsDefunct()) if (IsDefunct())
return CO_E_OBJNOTCONNECTED; return CO_E_OBJNOTCONNECTED;
// TODO make this work with proxies.
if (IsProxy())
return E_NOTIMPL;
if (IsSelect()) { if (IsSelect()) {
AutoTArray<Accessible*, 10> selectedItems; AutoTArray<Accessible*, 10> selectedItems;
SelectedItems(&selectedItems); if (IsProxy()) {
nsTArray<ProxyAccessible*> proxies;
Proxy()->SelectedItems(&proxies);
uint32_t selectedCount = proxies.Length();
for (uint32_t i = 0; i < selectedCount; i++) {
selectedItems.AppendElement(WrapperFor(proxies[i]));
}
} else {
SelectedItems(&selectedItems);
}
// 1) Create and initialize the enumeration // 1) Create and initialize the enumeration
RefPtr<AccessibleEnumerator> pEnum = new AccessibleEnumerator(selectedItems); RefPtr<AccessibleEnumerator> pEnum = new AccessibleEnumerator(selectedItems);
@ -809,7 +880,11 @@ AccessibleWrap::get_accDefaultAction(
return CO_E_OBJNOTCONNECTED; return CO_E_OBJNOTCONNECTED;
nsAutoString defaultAction; nsAutoString defaultAction;
xpAccessible->ActionNameAt(0, defaultAction); if (xpAccessible->IsProxy()) {
xpAccessible->Proxy()->ActionNameAt(0, defaultAction);
} else {
xpAccessible->ActionNameAt(0, defaultAction);
}
*pszDefaultAction = ::SysAllocStringLen(defaultAction.get(), *pszDefaultAction = ::SysAllocStringLen(defaultAction.get(),
defaultAction.Length()); defaultAction.Length());
@ -837,22 +912,42 @@ AccessibleWrap::accSelect(
return CO_E_OBJNOTCONNECTED; return CO_E_OBJNOTCONNECTED;
if (flagsSelect & SELFLAG_TAKEFOCUS) { if (flagsSelect & SELFLAG_TAKEFOCUS) {
xpAccessible->TakeFocus(); if (xpAccessible->IsProxy()) {
xpAccessible->Proxy()->TakeFocus();
} else {
xpAccessible->TakeFocus();
}
return S_OK; return S_OK;
} }
if (flagsSelect & SELFLAG_TAKESELECTION) { if (flagsSelect & SELFLAG_TAKESELECTION) {
xpAccessible->TakeSelection(); if (xpAccessible->IsProxy()) {
xpAccessible->Proxy()->TakeSelection();
} else {
xpAccessible->TakeSelection();
}
return S_OK; return S_OK;
} }
if (flagsSelect & SELFLAG_ADDSELECTION) { if (flagsSelect & SELFLAG_ADDSELECTION) {
xpAccessible->SetSelected(true); if (xpAccessible->IsProxy()) {
xpAccessible->Proxy()->SetSelected(true);
} else {
xpAccessible->SetSelected(true);
}
return S_OK; return S_OK;
} }
if (flagsSelect & SELFLAG_REMOVESELECTION) { if (flagsSelect & SELFLAG_REMOVESELECTION) {
xpAccessible->SetSelected(false); if (xpAccessible->IsProxy()) {
xpAccessible->Proxy()->SetSelected(false);
} else {
xpAccessible->SetSelected(false);
}
return S_OK; return S_OK;
} }
@ -889,7 +984,12 @@ AccessibleWrap::accLocation(
if (xpAccessible->IsDefunct()) if (xpAccessible->IsDefunct())
return CO_E_OBJNOTCONNECTED; return CO_E_OBJNOTCONNECTED;
nsIntRect rect = xpAccessible->Bounds(); nsIntRect rect;
if (xpAccessible->IsProxy()) {
rect = xpAccessible->Proxy()->Bounds();
} else {
rect = xpAccessible->Bounds();
}
*pxLeft = rect.x; *pxLeft = rect.x;
*pyTop = rect.y; *pyTop = rect.y;
@ -923,22 +1023,6 @@ AccessibleWrap::accNavigate(
if (accessible->IsDefunct()) if (accessible->IsDefunct())
return CO_E_OBJNOTCONNECTED; return CO_E_OBJNOTCONNECTED;
// Make sure that varStart != CHILDID_SELF so we don't infinitely recurse
if (accessible->IsProxy() && varStart.vt == VT_I4 &&
varStart.lVal != CHILDID_SELF) {
// Now that we have the starting object, delegate this request to that
// object as a self-relative request...
RefPtr<IAccessible> comProxy;
accessible->GetNativeInterface((void**) getter_AddRefs(comProxy));
if (!comProxy) {
return E_UNEXPECTED;
}
VARIANT selfChildId;
selfChildId.vt = VT_I4;
selfChildId.lVal = CHILDID_SELF;
return comProxy->accNavigate(navDir, selfChildId, pvarEndUpAt);
}
Accessible* navAccessible = nullptr; Accessible* navAccessible = nullptr;
Maybe<RelationType> xpRelation; Maybe<RelationType> xpRelation;
@ -996,8 +1080,16 @@ AccessibleWrap::accNavigate(
pvarEndUpAt->vt = VT_EMPTY; pvarEndUpAt->vt = VT_EMPTY;
if (xpRelation) { if (xpRelation) {
Relation rel = RelationByType(*xpRelation); if (accessible->IsProxy()) {
navAccessible = rel.Next(); nsTArray<ProxyAccessible*> targets =
accessible->Proxy()->RelationByType(*xpRelation);
if (targets.Length()) {
navAccessible = WrapperFor(targets[0]);
}
} else {
Relation rel = RelationByType(*xpRelation);
navAccessible = rel.Next();
}
} }
if (!navAccessible) if (!navAccessible)
@ -1026,7 +1118,15 @@ AccessibleWrap::accHitTest(
if (IsDefunct()) if (IsDefunct())
return CO_E_OBJNOTCONNECTED; return CO_E_OBJNOTCONNECTED;
Accessible* accessible = ChildAtPoint(xLeft, yTop, eDirectChild); Accessible* accessible = nullptr;
if (IsProxy()) {
ProxyAccessible* proxy = Proxy()->ChildAtPoint(xLeft, yTop, eDirectChild);
if (proxy) {
accessible = WrapperFor(proxy);
}
} else {
accessible = ChildAtPoint(xLeft, yTop, eDirectChild);
}
// if we got a child // if we got a child
if (accessible) { if (accessible) {
@ -1064,6 +1164,10 @@ AccessibleWrap::accDoDefaultAction(
if (xpAccessible->IsDefunct()) if (xpAccessible->IsDefunct())
return CO_E_OBJNOTCONNECTED; return CO_E_OBJNOTCONNECTED;
// TODO make this work with proxies.
if (xpAccessible->IsProxy())
return xpAccessible->Proxy()->DoAction(0) ? S_OK : E_INVALIDARG;
return xpAccessible->DoAction(0) ? S_OK : E_INVALIDARG; return xpAccessible->DoAction(0) ? S_OK : E_INVALIDARG;
A11Y_TRYBLOCK_END A11Y_TRYBLOCK_END