mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
bug 1250882 - make xpcAccessible::GetAttributes() work with proxied accessibles r=davidb
This commit is contained in:
parent
10cd68f503
commit
5b5e284221
@ -5,6 +5,7 @@
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "Accessible-inl.h"
|
||||
#include "mozilla/a11y/DocAccessibleParent.h"
|
||||
#include "nsAccUtils.h"
|
||||
#include "nsIAccessibleRelation.h"
|
||||
#include "nsIAccessibleRole.h"
|
||||
@ -342,12 +343,29 @@ xpcAccessible::GetAttributes(nsIPersistentProperties** aAttributes)
|
||||
NS_ENSURE_ARG_POINTER(aAttributes);
|
||||
*aAttributes = nullptr;
|
||||
|
||||
if (!Intl())
|
||||
if (IntlGeneric().IsNull()) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPersistentProperties> attributes = Intl()->Attributes();
|
||||
attributes.swap(*aAttributes);
|
||||
if (Accessible* acc = Intl()) {
|
||||
nsCOMPtr<nsIPersistentProperties> attributes = acc->Attributes();
|
||||
attributes.swap(*aAttributes);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
ProxyAccessible* proxy = IntlGeneric().AsProxy();
|
||||
AutoTArray<Attribute, 10> attrs;
|
||||
proxy->Attributes(&attrs);
|
||||
|
||||
nsCOMPtr<nsIPersistentProperties> props =
|
||||
do_CreateInstance(NS_PERSISTENTPROPERTIES_CONTRACTID);
|
||||
uint32_t attrCount = attrs.Length();
|
||||
nsAutoString unused;
|
||||
for (uint32_t i = 0; i < attrCount; i++) {
|
||||
props->SetStringProperty(attrs[i].Name(), attrs[i].Value(), unused);
|
||||
}
|
||||
|
||||
props.forget(aAttributes);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user