mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
bug 1088628 - implement Accessible::Attributes for proxies r=davidb
This commit is contained in:
parent
52b881a303
commit
fb1705cc7a
@ -10,6 +10,7 @@
|
||||
#include "ApplicationAccessibleWrap.h"
|
||||
#include "InterfaceInitFuncs.h"
|
||||
#include "nsAccUtils.h"
|
||||
#include "mozilla/a11y/PDocAccessible.h"
|
||||
#include "ProxyAccessible.h"
|
||||
#include "RootAccessible.h"
|
||||
#include "nsMai.h"
|
||||
@ -771,7 +772,27 @@ AtkAttributeSet *
|
||||
getAttributesCB(AtkObject *aAtkObj)
|
||||
{
|
||||
AccessibleWrap* accWrap = GetAccessibleWrap(aAtkObj);
|
||||
return accWrap ? GetAttributeSet(accWrap) : nullptr;
|
||||
if (accWrap)
|
||||
return GetAttributeSet(accWrap);
|
||||
|
||||
ProxyAccessible* proxy = GetProxy(aAtkObj);
|
||||
if (!proxy)
|
||||
return nullptr;
|
||||
|
||||
nsAutoTArray<Attribute, 10> attrs;
|
||||
proxy->Attributes(&attrs);
|
||||
if (attrs.IsEmpty())
|
||||
return nullptr;
|
||||
|
||||
AtkAttributeSet* objAttributeSet = nullptr;
|
||||
for (uint32_t i = 0; i < attrs.Length(); i++) {
|
||||
AtkAttribute *objAttr = (AtkAttribute *)g_malloc(sizeof(AtkAttribute));
|
||||
objAttr->name = g_strdup(attrs[i].Name().get());
|
||||
objAttr->value = g_strdup(NS_ConvertUTF16toUTF8(attrs[i].Value()).get());
|
||||
objAttributeSet = g_slist_prepend(objAttributeSet, objAttr);
|
||||
}
|
||||
|
||||
return objAttributeSet;
|
||||
}
|
||||
|
||||
const gchar*
|
||||
|
@ -49,3 +49,5 @@ if CONFIG['MOZ_ENABLE_GTK']:
|
||||
|
||||
if CONFIG['MOZ_ENABLE_DBUS']:
|
||||
CXXFLAGS += CONFIG['MOZ_DBUS_CFLAGS']
|
||||
|
||||
include('/ipc/chromium/chromium-config.mozbuild')
|
||||
|
@ -8,6 +8,9 @@
|
||||
|
||||
#include "Accessible-inl.h"
|
||||
|
||||
#include "nsIPersistentProperties2.h"
|
||||
#include "nsISimpleEnumerator.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
@ -76,5 +79,43 @@ DocAccessibleChild::RecvDescription(const uint64_t& aID, nsString* aDesc)
|
||||
acc->Description(*aDesc);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
DocAccessibleChild::RecvAttributes(const uint64_t& aID, nsTArray<Attribute>* aAttributes)
|
||||
{
|
||||
Accessible* acc = mDoc->GetAccessibleByUniqueID((void*)aID);
|
||||
if (!acc)
|
||||
return true;
|
||||
|
||||
nsCOMPtr<nsIPersistentProperties> props = acc->Attributes();
|
||||
if (!props)
|
||||
return true;
|
||||
|
||||
nsCOMPtr<nsISimpleEnumerator> propEnum;
|
||||
nsresult rv = props->Enumerate(getter_AddRefs(propEnum));
|
||||
NS_ENSURE_SUCCESS(rv, false);
|
||||
|
||||
bool hasMore;
|
||||
while (NS_SUCCEEDED(propEnum->HasMoreElements(&hasMore)) && hasMore) {
|
||||
nsCOMPtr<nsISupports> sup;
|
||||
rv = propEnum->GetNext(getter_AddRefs(sup));
|
||||
NS_ENSURE_SUCCESS(rv, false);
|
||||
|
||||
nsCOMPtr<nsIPropertyElement> propElem(do_QueryInterface(sup));
|
||||
NS_ENSURE_TRUE(propElem, false);
|
||||
|
||||
nsAutoCString name;
|
||||
rv = propElem->GetKey(name);
|
||||
NS_ENSURE_SUCCESS(rv, false);
|
||||
|
||||
nsAutoString value;
|
||||
rv = propElem->GetValue(value);
|
||||
NS_ENSURE_SUCCESS(rv, false);
|
||||
|
||||
aAttributes->AppendElement(Attribute(name, value));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -48,6 +48,8 @@ public:
|
||||
*/
|
||||
virtual bool RecvDescription(const uint64_t& aID, nsString* aDesc) MOZ_OVERRIDE;
|
||||
|
||||
virtual bool RecvAttributes(const uint64_t& aID, nsTArray<Attribute> *aAttributes) MOZ_OVERRIDE;
|
||||
|
||||
private:
|
||||
DocAccessible* mDoc;
|
||||
};
|
||||
|
@ -23,6 +23,12 @@ struct ShowEventData
|
||||
AccessibleData[] NewTree;
|
||||
};
|
||||
|
||||
struct Attribute
|
||||
{
|
||||
nsCString Name;
|
||||
nsString Value;
|
||||
};
|
||||
|
||||
prio(normal upto high) sync protocol PDocAccessible
|
||||
{
|
||||
manager PContent;
|
||||
@ -42,6 +48,7 @@ child:
|
||||
prio(high) sync State(uint64_t aID) returns(uint64_t states);
|
||||
prio(high) sync Name(uint64_t aID) returns(nsString name);
|
||||
prio(high) sync Description(uint64_t aID) returns(nsString desc);
|
||||
prio(high) sync Attributes(uint64_t aID) returns(Attribute[] attributes);
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -59,5 +59,11 @@ ProxyAccessible::Description(nsString& aDesc) const
|
||||
{
|
||||
unused << mDoc->SendDescription(mID, &aDesc);
|
||||
}
|
||||
|
||||
void
|
||||
ProxyAccessible::Attributes(nsTArray<Attribute> *aAttrs) const
|
||||
{
|
||||
unused << mDoc->SendAttributes(mID, aAttrs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,7 @@
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
class Attribute;
|
||||
class DocAccessibleParent;
|
||||
|
||||
class ProxyAccessible
|
||||
@ -68,6 +69,11 @@ public:
|
||||
*/
|
||||
void Description(nsString& aDesc) const;
|
||||
|
||||
/**
|
||||
* Get the set of attributes on the proxied accessible.
|
||||
*/
|
||||
void Attributes(nsTArray<Attribute> *aAttrs) const;
|
||||
|
||||
/**
|
||||
* Allow the platform to store a pointers worth of data on us.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user