From 5e32e582c29290b6bd394a2146b7d2f2fa538f07 Mon Sep 17 00:00:00 2001 From: Lorien Hu Date: Thu, 16 Jul 2015 17:34:51 -0400 Subject: [PATCH] Bug 1171995 - Part 1: Add FocusedChild to proxy accessibles r=tbsaunde --- accessible/ipc/DocAccessibleChild.cpp | 18 ++++++++++++++++++ accessible/ipc/DocAccessibleChild.h | 4 ++++ accessible/ipc/PDocAccessible.ipdl | 2 ++ accessible/ipc/ProxyAccessible.cpp | 9 +++++++++ accessible/ipc/ProxyAccessible.h | 1 + 5 files changed, 34 insertions(+) diff --git a/accessible/ipc/DocAccessibleChild.cpp b/accessible/ipc/DocAccessibleChild.cpp index 42957514e3f0..a38a0eb0426a 100644 --- a/accessible/ipc/DocAccessibleChild.cpp +++ b/accessible/ipc/DocAccessibleChild.cpp @@ -1652,6 +1652,24 @@ DocAccessibleChild::RecvEmbeddedChildAt(const uint64_t& aID, return true; } +bool +DocAccessibleChild::RecvFocusedChild(const uint64_t& aID, + uint64_t* aChild, + bool* aOk) +{ + *aChild = 0; + *aOk = false; + Accessible* acc = IdToAccessible(aID); + if (acc) { + Accessible* child = acc->FocusedChild(); + if (child) { + *aChild = reinterpret_cast(child->UniqueID()); + *aOk = true; + } + } + return true; +} + bool DocAccessibleChild::RecvChildAtPoint(const uint64_t& aID, const int32_t& aX, diff --git a/accessible/ipc/DocAccessibleChild.h b/accessible/ipc/DocAccessibleChild.h index c357a9f85c17..f2dec56c2b73 100644 --- a/accessible/ipc/DocAccessibleChild.h +++ b/accessible/ipc/DocAccessibleChild.h @@ -411,6 +411,10 @@ public: virtual bool RecvEmbeddedChildAt(const uint64_t& aID, const uint32_t& aIdx, uint64_t* aChildID) override final; + virtual bool RecvFocusedChild(const uint64_t& aID, + uint64_t* aChild, + bool* aOk) override; + virtual bool RecvChildAtPoint(const uint64_t& aID, const int32_t& aX, const int32_t& aY, diff --git a/accessible/ipc/PDocAccessible.ipdl b/accessible/ipc/PDocAccessible.ipdl index 81c9033b1681..cde80a9bc132 100644 --- a/accessible/ipc/PDocAccessible.ipdl +++ b/accessible/ipc/PDocAccessible.ipdl @@ -222,6 +222,8 @@ child: returns(uint32_t childIdx); prio(high) sync EmbeddedChildAt(uint64_t aID, uint32_t aChildIdx) returns(uint64_t aChild); + prio(high) sync FocusedChild(uint64_t aID) + returns(uint64_t aChild, bool aOk); 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); diff --git a/accessible/ipc/ProxyAccessible.cpp b/accessible/ipc/ProxyAccessible.cpp index 8522b4c20910..8eb73a99d8f4 100644 --- a/accessible/ipc/ProxyAccessible.cpp +++ b/accessible/ipc/ProxyAccessible.cpp @@ -924,6 +924,15 @@ ProxyAccessible::EmbeddedChildAt(size_t aChildIdx) return mDoc->GetAccessible(childID); } +ProxyAccessible* +ProxyAccessible::FocusedChild() +{ + uint64_t childID = 0; + bool ok = false; + unused << mDoc->SendFocusedChild(mID, &childID, &ok); + return ok ? mDoc->GetAccessible(childID) : nullptr; +} + ProxyAccessible* ProxyAccessible::ChildAtPoint(int32_t aX, int32_t aY, Accessible::EWhichChildAtPoint aWhichChild) diff --git a/accessible/ipc/ProxyAccessible.h b/accessible/ipc/ProxyAccessible.h index 056d9d4fea90..aabb177c0777 100644 --- a/accessible/ipc/ProxyAccessible.h +++ b/accessible/ipc/ProxyAccessible.h @@ -277,6 +277,7 @@ public: double Step(); void TakeFocus(); + ProxyAccessible* FocusedChild(); ProxyAccessible* ChildAtPoint(int32_t aX, int32_t aY, Accessible::EWhichChildAtPoint aWhichChild); nsIntRect Bounds();