diff --git a/accessible/atk/AccessibleWrap.cpp b/accessible/atk/AccessibleWrap.cpp index e15b69b7f920..dda4df911414 100644 --- a/accessible/atk/AccessibleWrap.cpp +++ b/accessible/atk/AccessibleWrap.cpp @@ -892,19 +892,18 @@ TranslateStates(uint64_t aState, AtkStateSet* aStateSet) AtkStateSet * refStateSetCB(AtkObject *aAtkObj) { - AtkStateSet *state_set = nullptr; - state_set = ATK_OBJECT_CLASS(parent_class)->ref_state_set(aAtkObj); + AtkStateSet *state_set = nullptr; + state_set = ATK_OBJECT_CLASS(parent_class)->ref_state_set(aAtkObj); - AccessibleWrap* accWrap = GetAccessibleWrap(aAtkObj); - if (!accWrap) { - TranslateStates(states::DEFUNCT, state_set); - return state_set; - } - - // Map states + AccessibleWrap* accWrap = GetAccessibleWrap(aAtkObj); + if (accWrap) TranslateStates(accWrap->State(), state_set); + else if (ProxyAccessible* proxy = GetProxy(aAtkObj)) + TranslateStates(proxy->State(), state_set); + else + TranslateStates(states::DEFUNCT, state_set); - return state_set; + return state_set; } static void diff --git a/accessible/ipc/DocAccessibleChild.cpp b/accessible/ipc/DocAccessibleChild.cpp index 5070b1fe9739..4b0bf33604b0 100644 --- a/accessible/ipc/DocAccessibleChild.cpp +++ b/accessible/ipc/DocAccessibleChild.cpp @@ -36,5 +36,19 @@ DocAccessibleChild::ShowEvent(AccShowEvent* aShowEvent) SerializeTree(aShowEvent->GetAccessible(), data.NewTree()); SendShowEvent(data); } + +bool +DocAccessibleChild::RecvState(const uint64_t& aID, uint64_t* aState) +{ + Accessible* acc = mDoc->GetAccessibleByUniqueID((void*)aID); + if (!acc) { + *aState = states::DEFUNCT; + return true; + } + + *aState = acc->State(); + + return true; +} } } diff --git a/accessible/ipc/DocAccessibleChild.h b/accessible/ipc/DocAccessibleChild.h index 50fdcc7cfd1f..9baa1e08f9e7 100644 --- a/accessible/ipc/DocAccessibleChild.h +++ b/accessible/ipc/DocAccessibleChild.h @@ -33,6 +33,11 @@ public: void ShowEvent(AccShowEvent* aShowEvent); + /* + * Return the state for the accessible with given ID. + */ + virtual bool RecvState(const uint64_t& aID, uint64_t* aState) MOZ_OVERRIDE; + private: DocAccessible* mDoc; }; diff --git a/accessible/ipc/PDocAccessible.ipdl b/accessible/ipc/PDocAccessible.ipdl index b3328b31b680..2c272e1374bd 100644 --- a/accessible/ipc/PDocAccessible.ipdl +++ b/accessible/ipc/PDocAccessible.ipdl @@ -24,7 +24,7 @@ struct ShowEventData AccessibleData[] NewTree; }; -protocol PDocAccessible +prio(normal upto high) sync protocol PDocAccessible { manager PContent; @@ -38,6 +38,9 @@ parent: Event(uint32_t type); ShowEvent(ShowEventData data); HideEvent(uint64_t aRootID); + +child: + prio(high) sync State(uint64_t aID) returns(uint64_t states); }; } diff --git a/accessible/ipc/ProxyAccessible.cpp b/accessible/ipc/ProxyAccessible.cpp index 5af1aa41d8fb..62558305df85 100644 --- a/accessible/ipc/ProxyAccessible.cpp +++ b/accessible/ipc/ProxyAccessible.cpp @@ -6,6 +6,7 @@ #include "ProxyAccessible.h" #include "DocAccessibleParent.h" +#include "mozilla/unused.h" #include "mozilla/a11y/Platform.h" namespace mozilla { @@ -38,5 +39,13 @@ ProxyAccessible::SetChildDoc(DocAccessibleParent* aParent) mOuterDoc = false; } } + +uint64_t +ProxyAccessible::State() const +{ + uint64_t state = 0; + unused << mDoc->SendState(mID, &state); + return state; +} } } diff --git a/accessible/ipc/ProxyAccessible.h b/accessible/ipc/ProxyAccessible.h index c5fff888082b..373d21c0db5b 100644 --- a/accessible/ipc/ProxyAccessible.h +++ b/accessible/ipc/ProxyAccessible.h @@ -54,6 +54,11 @@ public: */ role Role() const { return mRole; } + /* + * Return the states for the proxied accessible. + */ + uint64_t State() const; + /** * Allow the platform to store a pointers worth of data on us. */