Bug 1148025 - IPC Proxy for 'Component', r=tbsaunde
authorOlli Pettay <Olli.Pettay@helsinki.fi>
Fri, 27 Mar 2015 00:06:45 +0200
changeset 266373 8833d0060bcaf000083cabea394c8a967168ffce
parent 266372 1d65746a972d833dcbc5bc03ee27c66821ceff47
child 266374 e99d72e0a529bd7b95e56fe39cad2e42ee1d1445
push id830
push userraliiev@mozilla.com
push dateFri, 19 Jun 2015 19:24:37 +0000
treeherdermozilla-release@932614382a68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstbsaunde
bugs1148025
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 1148025 - IPC Proxy for 'Component', r=tbsaunde
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
@@ -10,16 +10,17 @@
 #include "ProxyAccessible.h"
 #include "Relation.h"
 #include "HyperTextAccessible-inl.h"
 #include "ImageAccessible.h"
 #include "TableAccessible.h"
 #include "TableCellAccessible.h"
 #include "nsIPersistentProperties2.h"
 #include "nsISimpleEnumerator.h"
+#include "nsAccUtils.h"
 
 namespace mozilla {
 namespace a11y {
 
 static uint32_t
 InterfacesFor(Accessible* aAcc)
 {
   uint32_t interfaces = 0;
@@ -1578,10 +1579,57 @@ DocAccessibleChild::RecvStep(const uint6
   Accessible* acc = IdToAccessible(aID);
   if (acc) {
     *aStep = acc->Step();
   }
 
   return true;
 }
 
+bool
+DocAccessibleChild::RecvTakeFocus(const uint64_t& aID)
+{
+  Accessible* acc = IdToAccessible(aID);
+  if (acc) {
+    acc->TakeFocus();
+  }
+
+  return true;
+}
+
+bool
+DocAccessibleChild::RecvChildAtPoint(const uint64_t& aID,
+                                     const int32_t& aX,
+                                     const int32_t& aY,
+                                     const uint32_t& aWhich,
+                                     uint64_t* aChild,
+                                     bool* aOk)
+{
+  *aChild = 0;
+  *aOk = false;
+  Accessible* acc = IdToAccessible(aID);
+  if (acc && !acc->IsDefunct() && !nsAccUtils::MustPrune(acc)) {
+    Accessible* child =
+      acc->ChildAtPoint(aX, aY,
+                        static_cast<Accessible::EWhichChildAtPoint>(aWhich));
+    if (child) {
+      *aChild = reinterpret_cast<uint64_t>(child->UniqueID());
+      *aOk = true;
+    }
+  }
+
+  return true;
+}
+
+bool
+DocAccessibleChild::RecvBounds(const uint64_t& aID,
+                               nsIntRect* aRect)
+{
+  Accessible* acc = IdToAccessible(aID);
+  if (acc && !acc->IsDefunct()) {
+    *aRect = acc->Bounds();
+  }
+
+  return false;
+}
+
 }
 }
--- a/accessible/ipc/DocAccessibleChild.h
+++ b/accessible/ipc/DocAccessibleChild.h
@@ -385,16 +385,27 @@ public:
   virtual bool RecvMinValue(const uint64_t& aID,
                             double* aValue);
 
   virtual bool RecvMaxValue(const uint64_t& aID,
                             double* aValue);
 
   virtual bool RecvStep(const uint64_t& aID,
                         double* aStep);
+
+  virtual bool RecvTakeFocus(const uint64_t& aID) override;
+
+  virtual bool RecvChildAtPoint(const uint64_t& aID,
+                                const int32_t& aX,
+                                const int32_t& aY,
+                                const uint32_t& aWhich,
+                                uint64_t* aChild,
+                                bool* aOk) override;
+
+  virtual bool RecvBounds(const uint64_t& aID, nsIntRect* aRect) 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
@@ -199,12 +199,17 @@ child:
   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);
 
   prio(high) sync CurValue(uint64_t aID) returns(double aValue);
   prio(high) sync SetCurValue(uint64_t aID, double aValue) returns(bool aRetVal);
   prio(high) sync MinValue(uint64_t aID) returns(double aValue);
   prio(high) sync MaxValue(uint64_t aID) returns(double aValue);
   prio(high) sync Step(uint64_t aID) returns(double aStep);
+
+  prio(high) sync TakeFocus(uint64_t aID);
+  prio(high) sync ChildAtPoint(uint64_t aID, int32_t aX, int32_t aY, uint32_t aWhich)
+    returns(uint64_t aChild, bool aOk);
+  prio(high) sync Bounds(uint64_t aID) returns(nsIntRect aRect);
 };
 
 }
 }
--- a/accessible/ipc/ProxyAccessible.cpp
+++ b/accessible/ipc/ProxyAccessible.cpp
@@ -880,10 +880,36 @@ ProxyAccessible::MaxValue()
 double
 ProxyAccessible::Step()
 {
   double step = UnspecifiedNaN<double>();
   unused << mDoc->SendStep(mID, &step);
   return step;
 }
 
+void
+ProxyAccessible::TakeFocus()
+{
+  unused << mDoc->SendTakeFocus(mID);
+}
+
+ProxyAccessible*
+ProxyAccessible::ChildAtPoint(int32_t aX, int32_t aY,
+                              Accessible::EWhichChildAtPoint aWhichChild)
+{
+  uint64_t childID = 0;
+  bool ok = false;
+  unused << mDoc->SendChildAtPoint(mID, aX, aY,
+                                   static_cast<uint32_t>(aWhichChild),
+                                   &childID, &ok);
+  return ok ? mDoc->GetAccessible(childID) : nullptr;
+}
+
+nsIntRect
+ProxyAccessible::Bounds()
+{
+  nsIntRect rect;
+  unused << mDoc->SendBounds(mID, &rect);
+  return rect;
+}
+
 }
 }
--- a/accessible/ipc/ProxyAccessible.h
+++ b/accessible/ipc/ProxyAccessible.h
@@ -8,16 +8,17 @@
 #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"
+#include "Accessible.h"
 
 namespace mozilla {
 namespace a11y {
 
 class Attribute;
 class DocAccessibleParent;
 enum class RelationType;
 
@@ -265,16 +266,21 @@ public:
   KeyBinding KeyboardShortcut();
 
   double CurValue();
   bool SetCurValue(double aValue);
   double MinValue();
   double MaxValue();
   double Step();
 
+  void TakeFocus();
+  ProxyAccessible* ChildAtPoint(int32_t aX, int32_t aY,
+                                Accessible::EWhichChildAtPoint aWhichChild);
+  nsIntRect Bounds();
+
   /**
    * 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.