Bug 1147518 - IPC Proxy for Action, r=davidb
authorOlli Pettay <Olli.Pettay@helsinki.fi>
Fri, 27 Mar 2015 00:06:21 +0200
changeset 264909 97e579a59306882610f5acd5368ee722c2b4ace4
parent 264908 76d1fba1297a15590fc7e1b46eb8efec919a2afd
child 264910 1d65746a972d833dcbc5bc03ee27c66821ceff47
push id4718
push userraliiev@mozilla.com
push dateMon, 11 May 2015 18:39:53 +0000
treeherdermozilla-beta@c20c4ef55f08 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdavidb
bugs1147518
milestone39.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1147518 - IPC Proxy for Action, r=davidb
accessible/ipc/DocAccessibleChild.cpp
accessible/ipc/DocAccessibleChild.h
accessible/ipc/PDocAccessible.ipdl
accessible/ipc/ProxyAccessible.cpp
accessible/ipc/ProxyAccessible.h
--- a/accessible/ipc/DocAccessibleChild.cpp
+++ b/accessible/ipc/DocAccessibleChild.cpp
@@ -1425,10 +1425,97 @@ DocAccessibleChild::RecvUnselectAll(cons
   Accessible* acc = IdToAccessibleSelect(aID);
   if (acc) {
     *aSuccess = acc->UnselectAll();
   }
 
   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;
+}
+
 }
 }
--- a/accessible/ipc/DocAccessibleChild.h
+++ b/accessible/ipc/DocAccessibleChild.h
@@ -346,16 +346,39 @@ public:
                                            const uint32_t& aIndex,
                                            bool* aSuccess) override;
 
   virtual bool RecvSelectAll(const uint64_t& aID,
                              bool* aSuccess) override;
 
   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;
   Accessible* IdToAccessibleLink(const uint64_t& aID) const;
   Accessible* IdToAccessibleSelect(const uint64_t& aID) const;
   HyperTextAccessible* IdToHyperTextAccessible(const uint64_t& aID) const;
   ImageAccessible* IdToImageAccessible(const uint64_t& aID) const;
   TableCellAccessible* IdToTableCellAccessible(const uint64_t& aID) const;
--- a/accessible/ipc/PDocAccessible.ipdl
+++ b/accessible/ipc/PDocAccessible.ipdl
@@ -186,13 +186,19 @@ child:
   prio(high) sync SelectedItems(uint64_t aID) returns(uint64_t[] aSelectedItemIDs);
   prio(high) sync SelectedItemCount(uint64_t aID) returns(uint32_t aCount);
   prio(high) sync GetSelectedItem(uint64_t aID, uint32_t aIndex) returns(uint64_t aSelected, bool aOk);
   prio(high) sync IsItemSelected(uint64_t aID, uint32_t aIndex) returns(bool aSelected);
   prio(high) sync AddItemToSelection(uint64_t aID, uint32_t aIndex) returns(bool aSuccess);
   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);
 };
 
 }
 }
--- a/accessible/ipc/ProxyAccessible.cpp
+++ b/accessible/ipc/ProxyAccessible.cpp
@@ -794,10 +794,56 @@ ProxyAccessible::SelectAll()
 bool
 ProxyAccessible::UnselectAll()
 {
   bool success = false;
   unused << mDoc->SendUnselectAll(mID, &success);
   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);
+}
+
 }
 }
--- a/accessible/ipc/ProxyAccessible.h
+++ b/accessible/ipc/ProxyAccessible.h
@@ -4,16 +4,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_a11y_ProxyAccessible_h
 #define mozilla_a11y_ProxyAccessible_h
 
 #include "mozilla/a11y/Role.h"
 #include "nsIAccessibleText.h"
+#include "Accessible.h"
 #include "nsString.h"
 #include "nsTArray.h"
 #include "nsRect.h"
 
 namespace mozilla {
 namespace a11y {
 
 class Attribute;
@@ -251,16 +252,23 @@ public:
   uint32_t SelectedItemCount();
   ProxyAccessible* GetSelectedItem(uint32_t aIndex);
   bool IsItemSelected(uint32_t aIndex);
   bool AddItemToSelection(uint32_t aIndex);
   bool RemoveItemFromSelection(uint32_t aIndex);
   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.
    */
   uintptr_t GetWrapper() const { return mWrapper; }
   void SetWrapper(uintptr_t aWrapper) { mWrapper = aWrapper; }
 
   /*
    * Return the ID of the accessible being proxied.