bug 1088477 - implement Accessible::Description for proxies r=davidb
authorTrevor Saunders <trev.saunders@gmail.com>
Thu, 23 Oct 2014 23:21:44 -0400
changeset 212645 6844f7c948b08675ef0188b2aee67a6f05fd6db3
parent 212644 b7aa4fec51e5a8124e9df64c49573e6f7ee4e079
child 212678 cf82f73b0ee382eceeda39dfbce2993b19d539ca
push id51027
push usertrev.saunders@gmail.com
push dateTue, 28 Oct 2014 15:11:19 +0000
treeherdermozilla-inbound@6844f7c948b0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdavidb
bugs1088477
milestone36.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 1088477 - implement Accessible::Description for proxies r=davidb
accessible/atk/AccessibleWrap.cpp
accessible/ipc/DocAccessibleChild.cpp
accessible/ipc/DocAccessibleChild.h
accessible/ipc/PDocAccessible.ipdl
accessible/ipc/ProxyAccessible.cpp
accessible/ipc/ProxyAccessible.h
--- a/accessible/atk/AccessibleWrap.cpp
+++ b/accessible/atk/AccessibleWrap.cpp
@@ -639,23 +639,28 @@ MaybeFireNameChange(AtkObject* aAtkObj, 
 
   if (notify)
     g_object_notify(G_OBJECT(aAtkObj), "accessible-name");
 }
 
 const gchar *
 getDescriptionCB(AtkObject *aAtkObj)
 {
-    AccessibleWrap* accWrap = GetAccessibleWrap(aAtkObj);
-    if (!accWrap || accWrap->IsDefunct())
-        return nullptr;
+  nsAutoString uniDesc;
+  AccessibleWrap* accWrap = GetAccessibleWrap(aAtkObj);
+  if (accWrap) {
+    if (accWrap->IsDefunct())
+      return nullptr;
 
-    /* nsIAccessible is responsible for the nonnull description */
-    nsAutoString uniDesc;
     accWrap->Description(uniDesc);
+  } else if (ProxyAccessible* proxy = GetProxy(aAtkObj)) {
+    proxy->Description(uniDesc);
+  } else {
+    return nullptr;
+  }
 
     NS_ConvertUTF8toUTF16 objDesc(aAtkObj->description);
     if (!uniDesc.Equals(objDesc))
         atk_object_set_description(aAtkObj,
                                    NS_ConvertUTF16toUTF8(uniDesc).get());
 
     return aAtkObj->description;
 }
--- a/accessible/ipc/DocAccessibleChild.cpp
+++ b/accessible/ipc/DocAccessibleChild.cpp
@@ -54,10 +54,21 @@ DocAccessibleChild::RecvName(const uint6
 {
   Accessible* acc = mDoc->GetAccessibleByUniqueID((void*)aID);
   if (!acc)
     return true;
 
   acc->Name(*aName);
   return true;
 }
+
+bool
+DocAccessibleChild::RecvDescription(const uint64_t& aID, nsString* aDesc)
+{
+  Accessible* acc = mDoc->GetAccessibleByUniqueID((void*)aID);
+  if (!acc)
+    return true;
+
+  acc->Description(*aDesc);
+  return true;
 }
 }
+}
--- a/accessible/ipc/DocAccessibleChild.h
+++ b/accessible/ipc/DocAccessibleChild.h
@@ -38,16 +38,21 @@ public:
    */
   virtual bool RecvState(const uint64_t& aID, uint64_t* aState) MOZ_OVERRIDE;
 
   /*
    * Get the name for the accessible with given id.
    */
   virtual bool RecvName(const uint64_t& aID, nsString* aName) MOZ_OVERRIDE;
 
+  /*
+   * Get the description for the accessible with given id.
+   */
+  virtual bool RecvDescription(const uint64_t& aID, nsString* aDesc) MOZ_OVERRIDE;
+
 private:
   DocAccessible* mDoc;
 };
 
 }
 }
 
 #endif
--- a/accessible/ipc/PDocAccessible.ipdl
+++ b/accessible/ipc/PDocAccessible.ipdl
@@ -36,12 +36,13 @@ parent:
    */
   Event(uint32_t type);
   ShowEvent(ShowEventData data);
   HideEvent(uint64_t aRootID);
 
 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);
 };
 
 }
 }
--- a/accessible/ipc/ProxyAccessible.cpp
+++ b/accessible/ipc/ProxyAccessible.cpp
@@ -48,10 +48,16 @@ ProxyAccessible::State() const
   return state;
 }
 
 void
 ProxyAccessible::Name(nsString& aName) const
 {
   unused << mDoc->SendName(mID, &aName);
 }
+
+void
+ProxyAccessible::Description(nsString& aDesc) const
+{
+  unused << mDoc->SendDescription(mID, &aDesc);
 }
 }
+}
--- a/accessible/ipc/ProxyAccessible.h
+++ b/accessible/ipc/ProxyAccessible.h
@@ -59,16 +59,21 @@ public:
   uint64_t State() const;
 
   /*
    * Set aName to the name of the proxied accessible.
    */
   void Name(nsString& aName) const;
 
   /**
+   * Set aDesc to the description of the proxied accessible.
+   */
+  void Description(nsString& aDesc) const;
+
+  /**
    * 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.
    */