mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
bug 1250882 - make xpcAccessible::GetAttributes() work with proxied accessibles r=davidb
This commit is contained in:
parent
8d8ca6ac5e
commit
8a22dbafd4
@ -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