bug 1278004 - support QIing proxied accessibles to nsIAccessibleValue r=davidb

This commit is contained in:
Trevor Saunders 2016-06-03 19:21:16 -04:00
Родитель dd6cbdac21
Коммит 434092ec78
4 изменённых файлов: 31 добавлений и 32 удалений

Просмотреть файл

@ -105,7 +105,8 @@ DocAccessibleParent::AddSubtree(ProxyAccessible* aParent,
auto role = static_cast<a11y::role>(newChild.Role());
ProxyAccessible* newProxy =
new ProxyAccessible(newChild.ID(), aParent, this, role);
new ProxyAccessible(newChild.ID(), aParent, this, role,
newChild.Interfaces());
aParent->AddChildAt(aIdxInParent, newProxy);
mAccessibles.PutEntry(newChild.ID())->mProxy = newProxy;
ProxyCreated(newProxy, newChild.Interfaces());

Просмотреть файл

@ -24,14 +24,28 @@ class Attribute;
class DocAccessibleParent;
enum class RelationType;
enum Interfaces
{
HYPERTEXT = 1,
HYPERLINK = 1 << 1,
IMAGE = 1 << 2,
VALUE = 1 << 3,
TABLE = 1 << 4,
TABLECELL = 1 << 5,
DOCUMENT = 1 << 6,
SELECTION = 1 << 7,
ACTION = 1 << 8,
};
class ProxyAccessible
{
public:
ProxyAccessible(uint64_t aID, ProxyAccessible* aParent,
DocAccessibleParent* aDoc, role aRole) :
DocAccessibleParent* aDoc, role aRole, uint32_t aInterfaces) :
mParent(aParent), mDoc(aDoc), mWrapper(0), mID(aID), mRole(aRole),
mOuterDoc(false), mIsDoc(false)
mOuterDoc(false), mIsDoc(false),
mHasValue(aInterfaces & Interfaces::VALUE)
{
MOZ_COUNT_CTOR(ProxyAccessible);
}
@ -406,7 +420,7 @@ public:
protected:
explicit ProxyAccessible(DocAccessibleParent* aThisAsDoc) :
mParent(nullptr), mDoc(aThisAsDoc), mWrapper(0), mID(0),
mRole(roles::DOCUMENT), mOuterDoc(false), mIsDoc(true)
mRole(roles::DOCUMENT), mOuterDoc(false), mIsDoc(true), mHasValue(false)
{ MOZ_COUNT_CTOR(ProxyAccessible); }
protected:
@ -417,22 +431,12 @@ private:
DocAccessibleParent* mDoc;
uintptr_t mWrapper;
uint64_t mID;
role mRole : 30;
role mRole : 29;
bool mOuterDoc : 1;
const bool mIsDoc: 1;
};
enum Interfaces
{
HYPERTEXT = 1,
HYPERLINK = 1 << 1,
IMAGE = 1 << 2,
VALUE = 1 << 3,
TABLE = 1 << 4,
TABLECELL = 1 << 5,
DOCUMENT = 1 << 6,
SELECTION = 1 << 7,
ACTION = 1 << 8,
public:
const bool mIsDoc: 1;
const bool mHasValue: 1;
};
}

Просмотреть файл

@ -213,7 +213,12 @@ xpcAccessibleDocument::GetXPCAccessible(ProxyAccessible* aProxy)
}
// XXX support exposing optional interfaces.
acc = new xpcAccessibleGeneric(aProxy, 0);
uint8_t interfaces = 0;
if (aProxy->mHasValue) {
interfaces |= eValue;
}
acc = new xpcAccessibleGeneric(aProxy, interfaces);
mCache.Put(aProxy, acc);
return acc;

Просмотреть файл

@ -38,19 +38,8 @@ public:
mSupportedIfaces |= eHyperLink;
}
xpcAccessibleGeneric(ProxyAccessible* aProxy, uint32_t aInterfaces) :
mIntl(aProxy), mSupportedIfaces(0)
{
if (aInterfaces & Interfaces::SELECTION) {
mSupportedIfaces |= eSelectable;
}
if (aInterfaces & Interfaces::VALUE) {
mSupportedIfaces |= eValue;
}
if (aInterfaces & Interfaces::HYPERLINK) {
mSupportedIfaces |= eHyperLink;
}
}
xpcAccessibleGeneric(ProxyAccessible* aProxy, uint8_t aInterfaces) :
mIntl(aProxy), mSupportedIfaces(aInterfaces) {}
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(xpcAccessibleGeneric, nsIAccessible)