Bug 1147518 - IPC Proxy for Action, r=davidb

--HG--
extra : rebase_source : 172a0c2a167be20f7cda760785ce4e96040cc295
This commit is contained in:
Olli Pettay 2015-03-27 00:06:21 +02:00
parent 525ae5030d
commit f5c6da7dce
5 changed files with 171 additions and 1 deletions

View File

@ -1430,5 +1430,92 @@ DocAccessibleChild::RecvUnselectAll(const uint64_t& aID,
return true;
}
bool
DocAccessibleChild::RecvDoAction(const uint64_t& aID,
const uint8_t& aIndex,
bool* aSuccess)
{
*aSuccess = false;
Accessible* acc = IdToAccessible(aID);
if (acc) {
*aSuccess = acc->DoAction(aIndex);
}
return true;
}
bool
DocAccessibleChild::RecvActionCount(const uint64_t& aID,
uint8_t* aCount)
{
*aCount = 0;
Accessible* acc = IdToAccessible(aID);
if (acc) {
*aCount = acc->ActionCount();
}
return true;
}
bool
DocAccessibleChild::RecvActionDescriptionAt(const uint64_t& aID,
const uint8_t& aIndex,
nsString* aDescription)
{
Accessible* acc = IdToAccessible(aID);
if (acc) {
acc->ActionDescriptionAt(aIndex, *aDescription);
}
return true;
}
bool
DocAccessibleChild::RecvActionNameAt(const uint64_t& aID,
const uint8_t& aIndex,
nsString* aName)
{
Accessible* acc = IdToAccessible(aID);
if (acc) {
acc->ActionNameAt(aIndex, *aName);
}
return true;
}
bool
DocAccessibleChild::RecvAccessKey(const uint64_t& aID,
uint32_t* aKey,
uint32_t* aModifierMask)
{
*aKey = 0;
*aModifierMask = 0;
Accessible* acc = IdToAccessible(aID);
if (acc) {
KeyBinding kb = acc->AccessKey();
*aKey = kb.Key();
*aModifierMask = kb.ModifierMask();
}
return true;
}
bool
DocAccessibleChild::RecvKeyboardShortcut(const uint64_t& aID,
uint32_t* aKey,
uint32_t* aModifierMask)
{
*aKey = 0;
*aModifierMask = 0;
Accessible* acc = IdToAccessible(aID);
if (acc) {
KeyBinding kb = acc->KeyboardShortcut();
*aKey = kb.Key();
*aModifierMask = kb.ModifierMask();
}
return true;
}
}
}

View File

@ -351,6 +351,29 @@ public:
virtual bool RecvUnselectAll(const uint64_t& aID,
bool* aSuccess) override;
virtual bool RecvDoAction(const uint64_t& aID,
const uint8_t& aIndex,
bool* aSuccess) override;
virtual bool RecvActionCount(const uint64_t& aID,
uint8_t* aCount) override;
virtual bool RecvActionDescriptionAt(const uint64_t& aID,
const uint8_t& aIndex,
nsString* aDescription) override;
virtual bool RecvActionNameAt(const uint64_t& aID,
const uint8_t& aIndex,
nsString* aName) override;
virtual bool RecvAccessKey(const uint64_t& aID,
uint32_t* aKey,
uint32_t* aModifierMask) override;
virtual bool RecvKeyboardShortcut(const uint64_t& aID,
uint32_t* aKey,
uint32_t* aModifierMask) override;
private:
Accessible* IdToAccessible(const uint64_t& aID) const;

View File

@ -191,7 +191,13 @@ child:
prio(high) sync RemoveItemFromSelection(uint64_t aID, uint32_t aIndex) returns(bool aSuccess);
prio(high) sync SelectAll(uint64_t aID) returns(bool aSuccess);
prio(high) sync UnselectAll(uint64_t aID) returns(bool aSuccess);
prio(high) sync DoAction(uint64_t aID, uint8_t aIndex) returns(bool aSuccess);
prio(high) sync ActionCount(uint64_t aID) returns(uint8_t aCount);
prio(high) sync ActionDescriptionAt(uint64_t aID, uint8_t aIndex) returns(nsString aDescription);
prio(high) sync ActionNameAt(uint64_t aID, uint8_t aIndex) returns(nsString aName);
prio(high) sync AccessKey(uint64_t aID) returns(uint32_t aKey, uint32_t aModifierMask);
prio(high) sync KeyboardShortcut(uint64_t aID) returns(uint32_t aKey, uint32_t aModifierMask);
};
}

View File

@ -799,5 +799,51 @@ ProxyAccessible::UnselectAll()
return success;
}
bool
ProxyAccessible::DoAction(uint8_t aIndex)
{
bool success = false;
unused << mDoc->SendDoAction(mID, aIndex, &success);
return success;
}
uint8_t
ProxyAccessible::ActionCount()
{
uint8_t count = 0;
unused << mDoc->SendActionCount(mID, &count);
return count;
}
void
ProxyAccessible::ActionDescriptionAt(uint8_t aIndex, nsString& aDescription)
{
unused << mDoc->SendActionDescriptionAt(mID, aIndex, &aDescription);
}
void
ProxyAccessible::ActionNameAt(uint8_t aIndex, nsString& aName)
{
unused << mDoc->SendActionNameAt(mID, aIndex, &aName);
}
KeyBinding
ProxyAccessible::AccessKey()
{
uint32_t key = 0;
uint32_t modifierMask = 0;
unused << mDoc->SendAccessKey(mID, &key, &modifierMask);
return KeyBinding(key, modifierMask);
}
KeyBinding
ProxyAccessible::KeyboardShortcut()
{
uint32_t key = 0;
uint32_t modifierMask = 0;
unused << mDoc->SendKeyboardShortcut(mID, &key, &modifierMask);
return KeyBinding(key, modifierMask);
}
}
}

View File

@ -9,6 +9,7 @@
#include "mozilla/a11y/Role.h"
#include "nsIAccessibleText.h"
#include "Accessible.h"
#include "nsString.h"
#include "nsTArray.h"
#include "nsRect.h"
@ -256,6 +257,13 @@ public:
bool SelectAll();
bool UnselectAll();
bool DoAction(uint8_t aIndex);
uint8_t ActionCount();
void ActionDescriptionAt(uint8_t aIndex, nsString& aDescription);
void ActionNameAt(uint8_t aIndex, nsString& aName);
KeyBinding AccessKey();
KeyBinding KeyboardShortcut();
/**
* Allow the platform to store a pointers worth of data on us.
*/