mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-07 09:54:42 +00:00
Bug 1336637 - Support relation methods in xpc on windows. r=tbsaunde
MozReview-Commit-ID: BcyE0Vy1Fu4
This commit is contained in:
parent
4f9bb91ff9
commit
5f324eb9dd
@ -6,6 +6,7 @@
|
||||
|
||||
#include "Accessible2.h"
|
||||
#include "ProxyAccessible.h"
|
||||
#include "ia2AccessibleRelation.h"
|
||||
#include "ia2AccessibleValue.h"
|
||||
#include "IGeckoCustom.h"
|
||||
#include "mozilla/a11y/DocAccessibleParent.h"
|
||||
@ -80,6 +81,12 @@ struct InterfaceIID<IGeckoCustom>
|
||||
static REFIID Value() { return IID_IGeckoCustom; }
|
||||
};
|
||||
|
||||
template<>
|
||||
struct InterfaceIID<IAccessible2_2>
|
||||
{
|
||||
static REFIID Value() { return IID_IAccessible2_2; }
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the COM proxy for this proxy accessible and QueryInterface it with the
|
||||
* correct IID
|
||||
@ -363,6 +370,44 @@ ProxyAccessible::Attributes(nsTArray<Attribute>* aAttrs) const
|
||||
aAttrs);
|
||||
}
|
||||
|
||||
nsTArray<ProxyAccessible*>
|
||||
ProxyAccessible::RelationByType(RelationType aType) const
|
||||
{
|
||||
RefPtr<IAccessible2_2> acc = QueryInterface<IAccessible2_2>(this);
|
||||
if (!acc) {
|
||||
nsTArray<ProxyAccessible*>();
|
||||
}
|
||||
|
||||
_bstr_t relationType;
|
||||
for (uint32_t idx = 0; idx < ArrayLength(sRelationTypePairs); idx++) {
|
||||
if (aType == sRelationTypePairs[idx].first) {
|
||||
relationType = sRelationTypePairs[idx].second;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!relationType) {
|
||||
nsTArray<ProxyAccessible*>();
|
||||
}
|
||||
|
||||
IUnknown** targets;
|
||||
long nTargets = 0;
|
||||
HRESULT hr = acc->get_relationTargetsOfType(relationType, 0, &targets, &nTargets);
|
||||
if (FAILED(hr)) {
|
||||
nsTArray<ProxyAccessible*>();
|
||||
}
|
||||
|
||||
nsTArray<ProxyAccessible*> proxies;
|
||||
for (long idx = 0; idx < nTargets; idx++) {
|
||||
IUnknown* target = targets[idx];
|
||||
proxies.AppendElement(GetProxyFor(Document(), target));
|
||||
target->Release();
|
||||
}
|
||||
CoTaskMemFree(targets);
|
||||
|
||||
return Move(proxies);
|
||||
}
|
||||
|
||||
double
|
||||
ProxyAccessible::CurValue()
|
||||
{
|
||||
|
@ -21,7 +21,7 @@ skip-if = e10s && os == 'win' && os_version == '5.1'
|
||||
[browser_caching_name.js]
|
||||
skip-if = e10s && os == 'win' && os_version == '5.1'
|
||||
[browser_caching_relations.js]
|
||||
skip-if = e10s && os == 'win' # Bug 1288839
|
||||
skip-if = e10s && os == 'win' && os_version == '5.1'
|
||||
[browser_caching_states.js]
|
||||
skip-if = e10s && os == 'win' && os_version == '5.1'
|
||||
[browser_caching_value.js]
|
||||
|
@ -504,16 +504,12 @@ xpcAccessible::GetRelationByType(uint32_t aType,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#if defined(XP_WIN)
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
#else
|
||||
ProxyAccessible* proxy = IntlGeneric().AsProxy();
|
||||
nsTArray<ProxyAccessible*> targets =
|
||||
proxy->RelationByType(static_cast<RelationType>(aType));
|
||||
NS_ADDREF(*aRelation = new nsAccessibleRelation(aType, &targets));
|
||||
|
||||
return NS_OK;
|
||||
#endif
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
Loading…
Reference in New Issue
Block a user