зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1268544: Remove proxy-specific code paths from IAccessible and IA2 wrappers; r=tbsaunde
MozReview-Commit-ID: J2LxsDU7trH
This commit is contained in:
Родитель
494a0e9e53
Коммит
ca2a8c99dc
|
@ -73,14 +73,7 @@ ia2Accessible::get_nRelations(long* aNRelations)
|
|||
if (acc->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
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;
|
||||
}
|
||||
MOZ_ASSERT(!acc->IsProxy());
|
||||
|
||||
for (uint32_t idx = 0; idx < ArrayLength(sRelationTypePairs); idx++) {
|
||||
if (sRelationTypePairs[idx].second == IA2_RELATION_NULL)
|
||||
|
@ -109,33 +102,7 @@ ia2Accessible::get_relation(long aRelationIndex,
|
|||
if (acc->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
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;
|
||||
}
|
||||
MOZ_ASSERT(!acc->IsProxy());
|
||||
|
||||
long relIdx = 0;
|
||||
for (uint32_t idx = 0; idx < ArrayLength(sRelationTypePairs); idx++) {
|
||||
|
@ -176,33 +143,7 @@ ia2Accessible::get_relations(long aMaxRelations,
|
|||
if (acc->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
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;
|
||||
}
|
||||
MOZ_ASSERT(!acc->IsProxy());
|
||||
|
||||
for (uint32_t idx = 0; idx < ArrayLength(sRelationTypePairs) &&
|
||||
*aNRelations < aMaxRelations; idx++) {
|
||||
|
@ -243,10 +184,8 @@ ia2Accessible::role(long* aRole)
|
|||
break;
|
||||
|
||||
a11y::role geckoRole;
|
||||
if (acc->IsProxy())
|
||||
geckoRole = acc->Proxy()->Role();
|
||||
else
|
||||
geckoRole = acc->Role();
|
||||
MOZ_ASSERT(!acc->IsProxy());
|
||||
geckoRole = acc->Role();
|
||||
switch (geckoRole) {
|
||||
#include "RoleMap.h"
|
||||
default:
|
||||
|
@ -257,16 +196,11 @@ ia2Accessible::role(long* aRole)
|
|||
|
||||
// Special case, if there is a ROLE_ROW inside of a ROLE_TREE_TABLE, then call
|
||||
// the IA2 role a ROLE_OUTLINEITEM.
|
||||
if (acc->IsProxy()) {
|
||||
if (geckoRole == roles::ROW && acc->Proxy()->Parent() &&
|
||||
acc->Proxy()->Parent()->Role() == roles::TREE_TABLE)
|
||||
MOZ_ASSERT(!acc->IsProxy());
|
||||
if (geckoRole == roles::ROW) {
|
||||
Accessible* xpParent = acc->Parent();
|
||||
if (xpParent && xpParent->Role() == roles::TREE_TABLE)
|
||||
*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;
|
||||
|
@ -283,12 +217,9 @@ ia2Accessible::scrollTo(enum IA2ScrollType aScrollType)
|
|||
if (acc->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
if (acc->IsProxy()) {
|
||||
acc->Proxy()->ScrollTo(aScrollType);
|
||||
} else {
|
||||
nsCoreUtils::ScrollTo(acc->Document()->PresShell(), acc->GetContent(),
|
||||
aScrollType);
|
||||
}
|
||||
MOZ_ASSERT(!acc->IsProxy());
|
||||
nsCoreUtils::ScrollTo(acc->Document()->PresShell(), acc->GetContent(),
|
||||
aScrollType);
|
||||
|
||||
return S_OK;
|
||||
|
||||
|
@ -309,11 +240,8 @@ ia2Accessible::scrollToPoint(enum IA2CoordinateType aCoordType,
|
|||
nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE :
|
||||
nsIAccessibleCoordinateType::COORDTYPE_PARENT_RELATIVE;
|
||||
|
||||
if (acc->IsProxy()) {
|
||||
acc->Proxy()->ScrollToPoint(geckoCoordType, aX, aY);
|
||||
} else {
|
||||
acc->ScrollToPoint(geckoCoordType, aX, aY);
|
||||
}
|
||||
MOZ_ASSERT(!acc->IsProxy());
|
||||
acc->ScrollToPoint(geckoCoordType, aX, aY);
|
||||
|
||||
return S_OK;
|
||||
|
||||
|
@ -373,10 +301,8 @@ ia2Accessible::get_states(AccessibleStates* aStates)
|
|||
}
|
||||
|
||||
uint64_t state;
|
||||
if (acc->IsProxy())
|
||||
state = acc->Proxy()->State();
|
||||
else
|
||||
state = acc->State();
|
||||
MOZ_ASSERT(!acc->IsProxy());
|
||||
state = acc->State();
|
||||
|
||||
if (state & states::INVALID)
|
||||
*aStates |= IA2_STATE_INVALID_ENTRY;
|
||||
|
@ -548,10 +474,8 @@ ia2Accessible::get_indexInParent(long* aIndexInParent)
|
|||
if (acc->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
if (acc->IsProxy())
|
||||
*aIndexInParent = acc->Proxy()->IndexInParent();
|
||||
else
|
||||
*aIndexInParent = acc->IndexInParent();
|
||||
MOZ_ASSERT(!acc->IsProxy());
|
||||
*aIndexInParent = acc->IndexInParent();
|
||||
|
||||
if (*aIndexInParent == -1)
|
||||
return S_FALSE;
|
||||
|
@ -632,9 +556,8 @@ ia2Accessible::get_attributes(BSTR* aAttributes)
|
|||
return ConvertToIA2Attributes(attributes, aAttributes);
|
||||
}
|
||||
|
||||
nsTArray<Attribute> attrs;
|
||||
acc->Proxy()->Attributes(&attrs);
|
||||
return ConvertToIA2Attributes(&attrs, aAttributes);
|
||||
MOZ_ASSERT(!acc->IsProxy());
|
||||
return E_UNEXPECTED;
|
||||
|
||||
A11Y_TRYBLOCK_END
|
||||
}
|
||||
|
@ -719,21 +642,12 @@ ia2Accessible::get_relationTargetsOfType(BSTR aType,
|
|||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
nsTArray<Accessible*> targets;
|
||||
if (acc->IsProxy()) {
|
||||
nsTArray<ProxyAccessible*> targetProxies =
|
||||
acc->Proxy()->RelationByType(*relationType);
|
||||
|
||||
size_t targetCount = aMaxTargets;
|
||||
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);
|
||||
MOZ_ASSERT(!acc->IsProxy());
|
||||
Relation rel = acc->RelationByType(*relationType);
|
||||
Accessible* target = nullptr;
|
||||
while ((target = rel.Next()) &&
|
||||
static_cast<long>(targets.Length()) <= aMaxTargets) {
|
||||
targets.AppendElement(target);
|
||||
}
|
||||
|
||||
*aNTargets = targets.Length();
|
||||
|
|
|
@ -24,9 +24,7 @@ ia2AccessibleEditableText::copyText(long aStartOffset, long aEndOffset)
|
|||
{
|
||||
A11Y_TRYBLOCK_BEGIN
|
||||
|
||||
if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
|
||||
return proxy->CopyText(aStartOffset, aEndOffset) ? S_OK : E_INVALIDARG;
|
||||
}
|
||||
MOZ_ASSERT(!HyperTextProxyFor(this));
|
||||
|
||||
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
|
||||
if (textAcc->IsDefunct())
|
||||
|
@ -46,9 +44,7 @@ ia2AccessibleEditableText::deleteText(long aStartOffset, long aEndOffset)
|
|||
{
|
||||
A11Y_TRYBLOCK_BEGIN
|
||||
|
||||
if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
|
||||
return proxy->DeleteText(aStartOffset, aEndOffset) ? S_OK : E_INVALIDARG;
|
||||
}
|
||||
MOZ_ASSERT(!HyperTextProxyFor(this));
|
||||
|
||||
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
|
||||
if (textAcc->IsDefunct())
|
||||
|
@ -70,9 +66,7 @@ ia2AccessibleEditableText::insertText(long aOffset, BSTR *aText)
|
|||
|
||||
uint32_t length = ::SysStringLen(*aText);
|
||||
nsAutoString text(*aText, length);
|
||||
if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
|
||||
return proxy->InsertText(text, aOffset) ? S_OK : E_INVALIDARG;
|
||||
}
|
||||
MOZ_ASSERT(!HyperTextProxyFor(this));
|
||||
|
||||
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
|
||||
if (textAcc->IsDefunct())
|
||||
|
@ -92,9 +86,7 @@ ia2AccessibleEditableText::cutText(long aStartOffset, long aEndOffset)
|
|||
{
|
||||
A11Y_TRYBLOCK_BEGIN
|
||||
|
||||
if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
|
||||
return proxy->CutText(aStartOffset, aEndOffset) ? S_OK : E_INVALIDARG;
|
||||
}
|
||||
MOZ_ASSERT(!HyperTextProxyFor(this));
|
||||
|
||||
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
|
||||
if (textAcc->IsDefunct())
|
||||
|
@ -114,9 +106,7 @@ ia2AccessibleEditableText::pasteText(long aOffset)
|
|||
{
|
||||
A11Y_TRYBLOCK_BEGIN
|
||||
|
||||
if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
|
||||
return proxy->PasteText(aOffset) ? S_OK : E_INVALIDARG;
|
||||
}
|
||||
MOZ_ASSERT(!HyperTextProxyFor(this));
|
||||
|
||||
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
|
||||
if (textAcc->IsDefunct())
|
||||
|
|
|
@ -53,17 +53,7 @@ ia2AccessibleHyperlink::get_anchor(long aIndex, VARIANT* aAnchor)
|
|||
VariantInit(aAnchor);
|
||||
|
||||
Accessible* thisObj = static_cast<AccessibleWrap*>(this);
|
||||
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;
|
||||
}
|
||||
MOZ_ASSERT(!thisObj->IsProxy());
|
||||
|
||||
if (thisObj->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
@ -97,36 +87,35 @@ ia2AccessibleHyperlink::get_anchorTarget(long aIndex, VARIANT* aAnchorTarget)
|
|||
{
|
||||
A11Y_TRYBLOCK_BEGIN
|
||||
|
||||
if (!aAnchorTarget)
|
||||
if (!aAnchorTarget) {
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
VariantInit(aAnchorTarget);
|
||||
|
||||
Accessible* thisObj = static_cast<AccessibleWrap*>(this);
|
||||
nsAutoCString uriStr;
|
||||
if (thisObj->IsProxy()) {
|
||||
bool ok;
|
||||
thisObj->Proxy()->AnchorURIAt(aIndex, uriStr, &ok);
|
||||
if (!ok)
|
||||
return S_FALSE;
|
||||
MOZ_ASSERT(!thisObj->IsProxy());
|
||||
if (thisObj->IsDefunct()) {
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
}
|
||||
|
||||
} else {
|
||||
if (thisObj->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
if (aIndex < 0 || aIndex >= static_cast<long>(thisObj->AnchorCount())) {
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
if (aIndex < 0 || aIndex >= static_cast<long>(thisObj->AnchorCount()))
|
||||
return E_INVALIDARG;
|
||||
if (!thisObj->IsLink()) {
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
if (!thisObj->IsLink())
|
||||
return S_FALSE;
|
||||
nsCOMPtr<nsIURI> uri = thisObj->AnchorURIAt(aIndex);
|
||||
if (!uri) {
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIURI> uri = thisObj->AnchorURIAt(aIndex);
|
||||
if (!uri)
|
||||
return S_FALSE;
|
||||
|
||||
nsresult rv = uri->GetSpec(uriStr);
|
||||
if (NS_FAILED(rv))
|
||||
return GetHRESULT(rv);
|
||||
nsresult rv = uri->GetSpec(uriStr);
|
||||
if (NS_FAILED(rv)) {
|
||||
return GetHRESULT(rv);
|
||||
}
|
||||
|
||||
nsAutoString stringURI;
|
||||
|
@ -150,11 +139,7 @@ ia2AccessibleHyperlink::get_startIndex(long* aIndex)
|
|||
|
||||
*aIndex = 0;
|
||||
|
||||
if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
|
||||
bool valid;
|
||||
*aIndex = proxy->StartOffset(&valid);
|
||||
return valid ? S_OK : S_FALSE;
|
||||
}
|
||||
MOZ_ASSERT(!HyperTextProxyFor(this));
|
||||
|
||||
Accessible* thisObj = static_cast<AccessibleWrap*>(this);
|
||||
if (thisObj->IsDefunct())
|
||||
|
@ -179,11 +164,7 @@ ia2AccessibleHyperlink::get_endIndex(long* aIndex)
|
|||
|
||||
*aIndex = 0;
|
||||
|
||||
if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
|
||||
bool valid;
|
||||
*aIndex = proxy->EndOffset(&valid);
|
||||
return valid ? S_OK : S_FALSE;
|
||||
}
|
||||
MOZ_ASSERT(!HyperTextProxyFor(this));
|
||||
|
||||
Accessible* thisObj = static_cast<AccessibleWrap*>(this);
|
||||
if (thisObj->IsDefunct())
|
||||
|
@ -208,10 +189,7 @@ ia2AccessibleHyperlink::get_valid(boolean* aValid)
|
|||
|
||||
*aValid = false;
|
||||
|
||||
if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
|
||||
*aValid = proxy->IsLinkValid();
|
||||
return S_OK;
|
||||
}
|
||||
MOZ_ASSERT(!HyperTextProxyFor(this));
|
||||
|
||||
Accessible* thisObj = static_cast<AccessibleWrap*>(this);
|
||||
if (thisObj->IsDefunct())
|
||||
|
|
|
@ -26,10 +26,7 @@ ia2AccessibleHypertext::get_nHyperlinks(long* aHyperlinkCount)
|
|||
|
||||
*aHyperlinkCount = 0;
|
||||
|
||||
if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
|
||||
*aHyperlinkCount = proxy->LinkCount();
|
||||
return S_OK;
|
||||
}
|
||||
MOZ_ASSERT(!HyperTextProxyFor(this));
|
||||
|
||||
HyperTextAccessibleWrap* hyperText = static_cast<HyperTextAccessibleWrap*>(this);
|
||||
if (hyperText->IsDefunct())
|
||||
|
@ -53,20 +50,14 @@ ia2AccessibleHypertext::get_hyperlink(long aLinkIndex,
|
|||
*aHyperlink = nullptr;
|
||||
|
||||
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));
|
||||
MOZ_ASSERT(!HyperTextProxyFor(this));
|
||||
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;
|
||||
|
||||
|
@ -88,10 +79,7 @@ ia2AccessibleHypertext::get_hyperlinkIndex(long aCharIndex, long* aHyperlinkInde
|
|||
|
||||
*aHyperlinkIndex = 0;
|
||||
|
||||
if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
|
||||
*aHyperlinkIndex = proxy->LinkIndexAtOffset(aCharIndex);
|
||||
return S_OK;
|
||||
}
|
||||
MOZ_ASSERT(!HyperTextProxyFor(this));
|
||||
|
||||
HyperTextAccessibleWrap* hyperAcc = static_cast<HyperTextAccessibleWrap*>(this);
|
||||
if (hyperAcc->IsDefunct())
|
||||
|
|
|
@ -30,10 +30,7 @@ ia2AccessibleText::addSelection(long aStartOffset, long aEndOffset)
|
|||
{
|
||||
A11Y_TRYBLOCK_BEGIN
|
||||
|
||||
if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
|
||||
return proxy->AddToSelection(aStartOffset, aEndOffset) ?
|
||||
S_OK : E_INVALIDARG;
|
||||
}
|
||||
MOZ_ASSERT(!HyperTextProxyFor(this));
|
||||
|
||||
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
|
||||
if (textAcc->IsDefunct())
|
||||
|
@ -60,21 +57,16 @@ ia2AccessibleText::get_attributes(long aOffset, long *aStartOffset,
|
|||
|
||||
int32_t startOffset = 0, endOffset = 0;
|
||||
HRESULT hr;
|
||||
if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
|
||||
AutoTArray<Attribute, 10> attrs;
|
||||
proxy->TextAttributes(true, aOffset, &attrs, &startOffset, &endOffset);
|
||||
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);
|
||||
MOZ_ASSERT(!HyperTextProxyFor(this));
|
||||
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);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
|
@ -96,16 +88,14 @@ ia2AccessibleText::get_caretOffset(long *aOffset)
|
|||
|
||||
*aOffset = -1;
|
||||
|
||||
if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
|
||||
*aOffset = proxy->CaretOffset();
|
||||
} else {
|
||||
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
|
||||
if (textAcc->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
*aOffset = textAcc->CaretOffset();
|
||||
MOZ_ASSERT(!HyperTextProxyFor(this));
|
||||
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
|
||||
if (textAcc->IsDefunct()) {
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
}
|
||||
|
||||
*aOffset = textAcc->CaretOffset();
|
||||
|
||||
return *aOffset != -1 ? S_OK : S_FALSE;
|
||||
|
||||
A11Y_TRYBLOCK_END
|
||||
|
@ -127,15 +117,12 @@ ia2AccessibleText::get_characterExtents(long aOffset,
|
|||
nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE :
|
||||
nsIAccessibleCoordinateType::COORDTYPE_PARENT_RELATIVE;
|
||||
nsIntRect rect;
|
||||
if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
|
||||
rect = proxy->CharBounds(aOffset, geckoCoordType);
|
||||
} else {
|
||||
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
|
||||
if (textAcc->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
MOZ_ASSERT(!HyperTextProxyFor(this));
|
||||
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;
|
||||
*aY = rect.y;
|
||||
|
@ -155,16 +142,14 @@ ia2AccessibleText::get_nSelections(long* aNSelections)
|
|||
return E_INVALIDARG;
|
||||
*aNSelections = 0;
|
||||
|
||||
if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
|
||||
*aNSelections = proxy->SelectionCount();
|
||||
} else {
|
||||
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
|
||||
if (textAcc->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
*aNSelections = textAcc->SelectionCount();
|
||||
MOZ_ASSERT(!HyperTextProxyFor(this));
|
||||
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
|
||||
if (textAcc->IsDefunct()) {
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
}
|
||||
|
||||
*aNSelections = textAcc->SelectionCount();
|
||||
|
||||
return S_OK;
|
||||
|
||||
A11Y_TRYBLOCK_END
|
||||
|
@ -185,16 +170,14 @@ ia2AccessibleText::get_offsetAtPoint(long aX, long aY,
|
|||
nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE :
|
||||
nsIAccessibleCoordinateType::COORDTYPE_PARENT_RELATIVE;
|
||||
|
||||
if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
|
||||
*aOffset = proxy->OffsetAtPoint(aX, aY, geckoCoordType);
|
||||
} else {
|
||||
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
|
||||
if (textAcc->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
*aOffset = textAcc->OffsetAtPoint(aX, aY, geckoCoordType);
|
||||
MOZ_ASSERT(!HyperTextProxyFor(this));
|
||||
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
|
||||
if (textAcc->IsDefunct()) {
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
}
|
||||
|
||||
*aOffset = textAcc->OffsetAtPoint(aX, aY, geckoCoordType);
|
||||
|
||||
return *aOffset == -1 ? S_FALSE : S_OK;
|
||||
|
||||
A11Y_TRYBLOCK_END
|
||||
|
@ -211,18 +194,14 @@ ia2AccessibleText::get_selection(long aSelectionIndex, long* aStartOffset,
|
|||
*aStartOffset = *aEndOffset = 0;
|
||||
|
||||
int32_t startOffset = 0, endOffset = 0;
|
||||
if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
|
||||
nsString unused;
|
||||
if (!proxy->SelectionBoundsAt(aSelectionIndex, unused, &startOffset,
|
||||
&endOffset))
|
||||
return E_INVALIDARG;
|
||||
} else {
|
||||
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
|
||||
if (textAcc->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
MOZ_ASSERT(!HyperTextProxyFor(this));
|
||||
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
|
||||
if (textAcc->IsDefunct()) {
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
}
|
||||
|
||||
if (!textAcc->SelectionBoundsAt(aSelectionIndex, &startOffset, &endOffset))
|
||||
return E_INVALIDARG;
|
||||
if (!textAcc->SelectionBoundsAt(aSelectionIndex, &startOffset, &endOffset)) {
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
*aStartOffset = startOffset;
|
||||
|
@ -243,21 +222,18 @@ ia2AccessibleText::get_text(long aStartOffset, long aEndOffset, BSTR* aText)
|
|||
*aText = nullptr;
|
||||
|
||||
nsAutoString text;
|
||||
if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
|
||||
if (!proxy->TextSubstring(aStartOffset, aEndOffset, text)) {
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
} else {
|
||||
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
|
||||
if (textAcc->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
if (!textAcc->IsValidRange(aStartOffset, aEndOffset))
|
||||
return E_INVALIDARG;
|
||||
|
||||
textAcc->TextSubstring(aStartOffset, aEndOffset, text);
|
||||
MOZ_ASSERT(!HyperTextProxyFor(this));
|
||||
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
|
||||
if (textAcc->IsDefunct()) {
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
}
|
||||
|
||||
if (!textAcc->IsValidRange(aStartOffset, aEndOffset)) {
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
textAcc->TextSubstring(aStartOffset, aEndOffset, text);
|
||||
|
||||
if (text.IsEmpty())
|
||||
return S_FALSE;
|
||||
|
||||
|
@ -414,9 +390,7 @@ ia2AccessibleText::removeSelection(long aSelectionIndex)
|
|||
{
|
||||
A11Y_TRYBLOCK_BEGIN
|
||||
|
||||
if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
|
||||
return proxy->RemoveFromSelection(aSelectionIndex) ? S_OK : E_INVALIDARG;
|
||||
}
|
||||
MOZ_ASSERT(!HyperTextProxyFor(this));
|
||||
|
||||
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
|
||||
if (textAcc->IsDefunct())
|
||||
|
@ -433,10 +407,7 @@ ia2AccessibleText::setCaretOffset(long aOffset)
|
|||
{
|
||||
A11Y_TRYBLOCK_BEGIN
|
||||
|
||||
if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
|
||||
proxy->SetCaretOffset(aOffset);
|
||||
return S_OK;
|
||||
}
|
||||
MOZ_ASSERT(!HyperTextProxyFor(this));
|
||||
|
||||
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
|
||||
if (textAcc->IsDefunct())
|
||||
|
@ -457,10 +428,7 @@ ia2AccessibleText::setSelection(long aSelectionIndex, long aStartOffset,
|
|||
{
|
||||
A11Y_TRYBLOCK_BEGIN
|
||||
|
||||
if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
|
||||
return proxy->SetSelectionBoundsAt(aSelectionIndex, aStartOffset,
|
||||
aEndOffset) ? S_OK : E_INVALIDARG;
|
||||
}
|
||||
MOZ_ASSERT(!HyperTextProxyFor(this));
|
||||
|
||||
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
|
||||
if (textAcc->IsDefunct())
|
||||
|
@ -481,10 +449,7 @@ ia2AccessibleText::get_nCharacters(long* aNCharacters)
|
|||
return E_INVALIDARG;
|
||||
*aNCharacters = 0;
|
||||
|
||||
if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
|
||||
*aNCharacters = proxy->CharacterCount();
|
||||
return S_OK;
|
||||
}
|
||||
MOZ_ASSERT(!HyperTextProxyFor(this));
|
||||
|
||||
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
|
||||
if (textAcc->IsDefunct())
|
||||
|
@ -502,10 +467,7 @@ ia2AccessibleText::scrollSubstringTo(long aStartIndex, long aEndIndex,
|
|||
{
|
||||
A11Y_TRYBLOCK_BEGIN
|
||||
|
||||
if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
|
||||
proxy->ScrollSubstringTo(aStartIndex, aEndIndex, aScrollType);
|
||||
return S_OK;
|
||||
}
|
||||
MOZ_ASSERT(!HyperTextProxyFor(this));
|
||||
|
||||
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
|
||||
if (textAcc->IsDefunct())
|
||||
|
@ -531,11 +493,7 @@ ia2AccessibleText::scrollSubstringToPoint(long aStartIndex, long aEndIndex,
|
|||
nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE :
|
||||
nsIAccessibleCoordinateType::COORDTYPE_PARENT_RELATIVE;
|
||||
|
||||
if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
|
||||
proxy->ScrollSubstringToPoint(aStartIndex, aEndIndex, geckoCoordType, aX,
|
||||
aY);
|
||||
return S_OK;
|
||||
}
|
||||
MOZ_ASSERT(!HyperTextProxyFor(this));
|
||||
|
||||
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
|
||||
if (textAcc->IsDefunct())
|
||||
|
|
|
@ -55,15 +55,13 @@ ia2AccessibleValue::get_currentValue(VARIANT* aCurrentValue)
|
|||
|
||||
AccessibleWrap* valueAcc = static_cast<AccessibleWrap*>(this);
|
||||
double currentValue;
|
||||
if (valueAcc->IsProxy()) {
|
||||
currentValue = valueAcc->Proxy()->CurValue();
|
||||
} else {
|
||||
if (valueAcc->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
currentValue = valueAcc->CurValue();
|
||||
MOZ_ASSERT(!valueAcc->IsProxy());
|
||||
if (valueAcc->IsDefunct()) {
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
}
|
||||
|
||||
currentValue = valueAcc->CurValue();
|
||||
|
||||
if (IsNaN(currentValue))
|
||||
return S_FALSE;
|
||||
|
||||
|
@ -83,8 +81,7 @@ ia2AccessibleValue::setCurrentValue(VARIANT aValue)
|
|||
return E_INVALIDARG;
|
||||
|
||||
AccessibleWrap* valueAcc = static_cast<AccessibleWrap*>(this);
|
||||
if (valueAcc->IsProxy())
|
||||
return valueAcc->Proxy()->SetCurValue(aValue.dblVal) ? S_OK : E_FAIL;
|
||||
MOZ_ASSERT(!valueAcc->IsProxy());
|
||||
|
||||
if (valueAcc->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
@ -106,15 +103,13 @@ ia2AccessibleValue::get_maximumValue(VARIANT* aMaximumValue)
|
|||
|
||||
AccessibleWrap* valueAcc = static_cast<AccessibleWrap*>(this);
|
||||
double maximumValue;
|
||||
if (valueAcc->IsProxy()) {
|
||||
maximumValue = valueAcc->Proxy()->MaxValue();
|
||||
} else {
|
||||
if (valueAcc->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
maximumValue = valueAcc->MaxValue();
|
||||
MOZ_ASSERT(!valueAcc->IsProxy());
|
||||
if (valueAcc->IsDefunct()) {
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
}
|
||||
|
||||
maximumValue = valueAcc->MaxValue();
|
||||
|
||||
if (IsNaN(maximumValue))
|
||||
return S_FALSE;
|
||||
|
||||
|
@ -137,15 +132,13 @@ ia2AccessibleValue::get_minimumValue(VARIANT* aMinimumValue)
|
|||
|
||||
AccessibleWrap* valueAcc = static_cast<AccessibleWrap*>(this);
|
||||
double minimumValue;
|
||||
if (valueAcc->IsProxy()) {
|
||||
minimumValue = valueAcc->Proxy()->MinValue();
|
||||
} else {
|
||||
if (valueAcc->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
minimumValue = valueAcc->MinValue();
|
||||
MOZ_ASSERT(!valueAcc->IsProxy());
|
||||
if (valueAcc->IsDefunct()) {
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
}
|
||||
|
||||
minimumValue = valueAcc->MinValue();
|
||||
|
||||
if (IsNaN(minimumValue))
|
||||
return S_FALSE;
|
||||
|
||||
|
|
|
@ -187,16 +187,6 @@ AccessibleWrap::get_accParent( IDispatch __RPC_FAR *__RPC_FAR *ppdispParent)
|
|||
if (IsDefunct())
|
||||
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();
|
||||
if (doc) {
|
||||
// Return window system accessible object for root document and tab document
|
||||
|
@ -236,15 +226,6 @@ AccessibleWrap::get_accChildCount( long __RPC_FAR *pcountChildren)
|
|||
if (IsDefunct())
|
||||
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))
|
||||
return S_OK;
|
||||
|
||||
|
@ -309,10 +290,7 @@ AccessibleWrap::get_accName(
|
|||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
nsAutoString name;
|
||||
if (xpAccessible->IsProxy())
|
||||
xpAccessible->Proxy()->Name(name);
|
||||
else
|
||||
xpAccessible->Name(name);
|
||||
xpAccessible->Name(name);
|
||||
|
||||
// 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
|
||||
|
@ -351,10 +329,6 @@ AccessibleWrap::get_accValue(
|
|||
if (xpAccessible->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
// TODO make this work with proxies.
|
||||
if (IsProxy())
|
||||
return E_NOTIMPL;
|
||||
|
||||
nsAutoString value;
|
||||
xpAccessible->Value(value);
|
||||
|
||||
|
@ -394,10 +368,7 @@ AccessibleWrap::get_accDescription(VARIANT varChild,
|
|||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
nsAutoString description;
|
||||
if (IsProxy())
|
||||
xpAccessible->Proxy()->Description(description);
|
||||
else
|
||||
xpAccessible->Description(description);
|
||||
xpAccessible->Description(description);
|
||||
|
||||
*pszDescription = ::SysAllocStringLen(description.get(),
|
||||
description.Length());
|
||||
|
@ -429,16 +400,12 @@ AccessibleWrap::get_accRole(
|
|||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
a11y::role geckoRole;
|
||||
if (xpAccessible->IsProxy()) {
|
||||
geckoRole = xpAccessible->Proxy()->Role();
|
||||
} else {
|
||||
#ifdef DEBUG
|
||||
NS_ASSERTION(nsAccUtils::IsTextInterfaceSupportCorrect(xpAccessible),
|
||||
"Does not support Text when it should");
|
||||
NS_ASSERTION(nsAccUtils::IsTextInterfaceSupportCorrect(xpAccessible),
|
||||
"Does not support Text when it should");
|
||||
#endif
|
||||
|
||||
geckoRole = xpAccessible->Role();
|
||||
}
|
||||
geckoRole = xpAccessible->Role();
|
||||
|
||||
uint32_t msaaRole = 0;
|
||||
|
||||
|
@ -459,18 +426,12 @@ AccessibleWrap::get_accRole(
|
|||
// 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.
|
||||
// We need this because ARIA has a role of "row" for both grid and treegrid
|
||||
if (xpAccessible->IsProxy()) {
|
||||
if (geckoRole == roles::ROW
|
||||
&& xpAccessible->Proxy()->Parent()->Role() == roles::TREE_TABLE)
|
||||
msaaRole = ROLE_SYSTEM_OUTLINEITEM;
|
||||
} else {
|
||||
if (geckoRole == roles::ROW) {
|
||||
Accessible* xpParent = Parent();
|
||||
if (xpParent && xpParent->Role() == roles::TREE_TABLE)
|
||||
msaaRole = ROLE_SYSTEM_OUTLINEITEM;
|
||||
}
|
||||
if (geckoRole == roles::ROW) {
|
||||
Accessible* xpParent = Parent();
|
||||
if (xpParent && xpParent->Role() == roles::TREE_TABLE)
|
||||
msaaRole = ROLE_SYSTEM_OUTLINEITEM;
|
||||
}
|
||||
|
||||
|
||||
// -- Try enumerated role
|
||||
if (msaaRole != USE_ROLE_STRING) {
|
||||
pvarRole->vt = VT_I4;
|
||||
|
@ -478,10 +439,6 @@ AccessibleWrap::get_accRole(
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
// XXX bug 798492 make this work with proxies?
|
||||
if (IsProxy())
|
||||
return E_FAIL;
|
||||
|
||||
// -- Try BSTR role
|
||||
// Could not map to known enumerated MSAA role like ROLE_BUTTON
|
||||
// Use BSTR role to expose role attribute or tag name + namespace
|
||||
|
@ -552,11 +509,7 @@ AccessibleWrap::get_accState(
|
|||
// INVALID -> ALERT_HIGH
|
||||
// CHECKABLE -> MARQUEED
|
||||
|
||||
uint64_t state;
|
||||
if (xpAccessible->IsProxy())
|
||||
state = xpAccessible->Proxy()->State();
|
||||
else
|
||||
state = State();
|
||||
uint64_t state = State();
|
||||
|
||||
uint32_t msaaState = 0;
|
||||
nsAccUtils::To32States(state, &msaaState, nullptr);
|
||||
|
@ -622,10 +575,6 @@ AccessibleWrap::get_accKeyboardShortcut(
|
|||
if (acc->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
// TODO make this work with proxies.
|
||||
if (acc->IsProxy())
|
||||
return E_NOTIMPL;
|
||||
|
||||
KeyBinding keyBinding = acc->AccessKey();
|
||||
if (keyBinding.IsEmpty())
|
||||
keyBinding = acc->KeyboardShortcut();
|
||||
|
@ -661,13 +610,7 @@ AccessibleWrap::get_accFocus(
|
|||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
// Return the current IAccessible child that has focus
|
||||
Accessible* focusedAccessible;
|
||||
if (IsProxy()) {
|
||||
ProxyAccessible* proxy = Proxy()->FocusedChild();
|
||||
focusedAccessible = proxy ? WrapperFor(proxy) : nullptr;
|
||||
} else {
|
||||
focusedAccessible = FocusedChild();
|
||||
}
|
||||
Accessible* focusedAccessible = FocusedChild();
|
||||
|
||||
if (focusedAccessible == this) {
|
||||
pvarChild->vt = VT_I4;
|
||||
|
@ -829,23 +772,9 @@ AccessibleWrap::get_accSelection(VARIANT __RPC_FAR *pvarChildren)
|
|||
if (IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
// TODO make this work with proxies.
|
||||
if (IsProxy())
|
||||
return E_NOTIMPL;
|
||||
|
||||
if (IsSelect()) {
|
||||
AutoTArray<Accessible*, 10> 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);
|
||||
}
|
||||
SelectedItems(&selectedItems);
|
||||
|
||||
// 1) Create and initialize the enumeration
|
||||
RefPtr<AccessibleEnumerator> pEnum = new AccessibleEnumerator(selectedItems);
|
||||
|
@ -880,11 +809,7 @@ AccessibleWrap::get_accDefaultAction(
|
|||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
nsAutoString defaultAction;
|
||||
if (xpAccessible->IsProxy()) {
|
||||
xpAccessible->Proxy()->ActionNameAt(0, defaultAction);
|
||||
} else {
|
||||
xpAccessible->ActionNameAt(0, defaultAction);
|
||||
}
|
||||
xpAccessible->ActionNameAt(0, defaultAction);
|
||||
|
||||
*pszDefaultAction = ::SysAllocStringLen(defaultAction.get(),
|
||||
defaultAction.Length());
|
||||
|
@ -912,42 +837,22 @@ AccessibleWrap::accSelect(
|
|||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
if (flagsSelect & SELFLAG_TAKEFOCUS) {
|
||||
if (xpAccessible->IsProxy()) {
|
||||
xpAccessible->Proxy()->TakeFocus();
|
||||
} else {
|
||||
xpAccessible->TakeFocus();
|
||||
}
|
||||
|
||||
xpAccessible->TakeFocus();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
if (flagsSelect & SELFLAG_TAKESELECTION) {
|
||||
if (xpAccessible->IsProxy()) {
|
||||
xpAccessible->Proxy()->TakeSelection();
|
||||
} else {
|
||||
xpAccessible->TakeSelection();
|
||||
}
|
||||
|
||||
xpAccessible->TakeSelection();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
if (flagsSelect & SELFLAG_ADDSELECTION) {
|
||||
if (xpAccessible->IsProxy()) {
|
||||
xpAccessible->Proxy()->SetSelected(true);
|
||||
} else {
|
||||
xpAccessible->SetSelected(true);
|
||||
}
|
||||
|
||||
xpAccessible->SetSelected(true);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
if (flagsSelect & SELFLAG_REMOVESELECTION) {
|
||||
if (xpAccessible->IsProxy()) {
|
||||
xpAccessible->Proxy()->SetSelected(false);
|
||||
} else {
|
||||
xpAccessible->SetSelected(false);
|
||||
}
|
||||
|
||||
xpAccessible->SetSelected(false);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
@ -984,12 +889,7 @@ AccessibleWrap::accLocation(
|
|||
if (xpAccessible->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
nsIntRect rect;
|
||||
if (xpAccessible->IsProxy()) {
|
||||
rect = xpAccessible->Proxy()->Bounds();
|
||||
} else {
|
||||
rect = xpAccessible->Bounds();
|
||||
}
|
||||
nsIntRect rect = xpAccessible->Bounds();
|
||||
|
||||
*pxLeft = rect.x;
|
||||
*pyTop = rect.y;
|
||||
|
@ -1023,6 +923,22 @@ AccessibleWrap::accNavigate(
|
|||
if (accessible->IsDefunct())
|
||||
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;
|
||||
Maybe<RelationType> xpRelation;
|
||||
|
||||
|
@ -1080,16 +996,8 @@ AccessibleWrap::accNavigate(
|
|||
pvarEndUpAt->vt = VT_EMPTY;
|
||||
|
||||
if (xpRelation) {
|
||||
if (accessible->IsProxy()) {
|
||||
nsTArray<ProxyAccessible*> targets =
|
||||
accessible->Proxy()->RelationByType(*xpRelation);
|
||||
if (targets.Length()) {
|
||||
navAccessible = WrapperFor(targets[0]);
|
||||
}
|
||||
} else {
|
||||
Relation rel = RelationByType(*xpRelation);
|
||||
navAccessible = rel.Next();
|
||||
}
|
||||
Relation rel = RelationByType(*xpRelation);
|
||||
navAccessible = rel.Next();
|
||||
}
|
||||
|
||||
if (!navAccessible)
|
||||
|
@ -1118,15 +1026,7 @@ AccessibleWrap::accHitTest(
|
|||
if (IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
Accessible* accessible = nullptr;
|
||||
if (IsProxy()) {
|
||||
ProxyAccessible* proxy = Proxy()->ChildAtPoint(xLeft, yTop, eDirectChild);
|
||||
if (proxy) {
|
||||
accessible = WrapperFor(proxy);
|
||||
}
|
||||
} else {
|
||||
accessible = ChildAtPoint(xLeft, yTop, eDirectChild);
|
||||
}
|
||||
Accessible* accessible = ChildAtPoint(xLeft, yTop, eDirectChild);
|
||||
|
||||
// if we got a child
|
||||
if (accessible) {
|
||||
|
@ -1164,10 +1064,6 @@ AccessibleWrap::accDoDefaultAction(
|
|||
if (xpAccessible->IsDefunct())
|
||||
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;
|
||||
|
||||
A11Y_TRYBLOCK_END
|
||||
|
|
Загрузка…
Ссылка в новой задаче