bug 1074869 - make atk deal with proxied focus events r=davidb

This commit is contained in:
Trevor Saunders 2014-09-30 10:00:26 -04:00
parent f635cbd2c0
commit 5d64fd76bf
10 changed files with 87 additions and 14 deletions

View File

@ -1307,6 +1307,16 @@ AccessibleWrap::HandleAccEvent(AccEvent* aEvent)
return NS_OK;
}
void
a11y::ProxyEvent(ProxyAccessible* aTarget, uint32_t aEventType)
{
AtkObject* wrapper = GetWrapperFor(aTarget);
if (aEventType == nsIAccessibleEvent::EVENT_FOCUS) {
atk_focus_tracker_notify(wrapper);
atk_object_notify_state_change(wrapper, ATK_STATE_FOCUSED, true);
}
}
nsresult
AccessibleWrap::FireAtkStateChangeEvent(AccEvent* aEvent,
AtkObject* aObject)

View File

@ -480,6 +480,33 @@ EventQueue::CreateTextChangeEventFor(AccMutationEvent* aEvent)
aEvent->mIsFromUserInput ? eFromUserInput : eNoUserInput);
}
void
EventQueue::SendIPCEvent(AccEvent* aEvent) const
{
DocAccessibleChild* ipcDoc = mDocument->IPCDoc();
uint64_t id = aEvent->GetAccessible()->IsDoc() ? 0 :
reinterpret_cast<uintptr_t>(aEvent->GetAccessible());
switch(aEvent->GetEventType()) {
case nsIAccessibleEvent::EVENT_SHOW:
ipcDoc->ShowEvent(downcast_accEvent(aEvent));
break;
case nsIAccessibleEvent::EVENT_HIDE:
ipcDoc->SendHideEvent(id);
break;
case nsIAccessibleEvent::EVENT_REORDER:
// reorder events on the application acc aren't necessary to tell the parent
// about new top level documents.
if (!aEvent->GetAccessible()->IsApplication())
ipcDoc->SendEvent(id, aEvent->GetEventType());
break;
default:
ipcDoc->SendEvent(id, aEvent->GetEventType());
}
}
////////////////////////////////////////////////////////////////////////////////
// EventQueue: event queue
@ -557,14 +584,7 @@ EventQueue::ProcessEventQueue()
if (!mDocument)
return;
if (IPCAccessibilityActive()) {
DocAccessibleChild* ipcDoc = mDocument->IPCDoc();
if (event->mEventType == nsIAccessibleEvent::EVENT_SHOW)
ipcDoc->ShowEvent(downcast_accEvent(event));
else if (event->mEventType == nsIAccessibleEvent::EVENT_HIDE)
ipcDoc->SendHideEvent(reinterpret_cast<uintptr_t>(event->GetAccessible()));
else
ipcDoc->SendEvent(event->GetEventType());
}
if (IPCAccessibilityActive())
SendIPCEvent(event);
}
}

View File

@ -53,6 +53,11 @@ private:
AccSelChangeEvent* aThisEvent,
uint32_t aThisIndex);
/**
* Notify the parent process of events being fired by this event queue.
*/
void SendIPCEvent(AccEvent* aEvent) const;
/**
* Coalesce text change events caused by sibling hide events.
*/

View File

@ -4,6 +4,8 @@
* 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/. */
#include <stdint.h>
namespace mozilla {
namespace a11y {
@ -60,6 +62,11 @@ void ProxyCreated(ProxyAccessible*);
* disposed of and other action taken.
*/
void ProxyDestroyed(ProxyAccessible*);
/**
* Callied when an event is fired on a proxied accessible.
*/
void ProxyEvent(ProxyAccessible* aTarget, uint32_t aEventType);
} // namespace a11y
} // namespace mozilla

View File

@ -112,5 +112,23 @@ DocAccessibleParent::RecvHideEvent(const uint64_t& aRootID)
return true;
}
bool
DocAccessibleParent::RecvEvent(const uint64_t& aID, const uint32_t& aEventType)
{
if (!aID) {
ProxyEvent(this, aEventType);
return true;
}
ProxyEntry* e = mAccessibles.GetEntry(aID);
if (!e) {
NS_ERROR("no proxy for event!");
return true;
}
ProxyEvent(e->mProxy, aEventType);
return true;
}
}
}

View File

@ -39,10 +39,8 @@ public:
* Called when a message from a document in a child process notifies the main
* process it is firing an event.
*/
virtual bool RecvEvent(const uint32_t& aType) MOZ_OVERRIDE
{
return true;
}
virtual bool RecvEvent(const uint64_t& aID, const uint32_t& aType)
MOZ_OVERRIDE;
virtual bool RecvShowEvent(const ShowEventData& aData) MOZ_OVERRIDE;
virtual bool RecvHideEvent(const uint64_t& aRootID) MOZ_OVERRIDE;

View File

@ -40,7 +40,7 @@ parent:
* Notify the parent process the document in the child process is firing an
* event.
*/
Event(uint32_t type);
Event(uint64_t aID, uint32_t type);
ShowEvent(ShowEventData data);
HideEvent(uint64_t aRootID);

View File

@ -42,6 +42,11 @@ void
ProxyDestroyed(ProxyAccessible*)
{
}
void
ProxyEvent(ProxyAccessible*, uint32_t)
{
}
}
}

View File

@ -28,3 +28,8 @@ void
a11y::ProxyDestroyed(ProxyAccessible*)
{
}
void
a11y::ProxyEvent(ProxyAccessible*, uint32_t)
{
}

View File

@ -43,3 +43,8 @@ void
a11y::ProxyDestroyed(ProxyAccessible*)
{
}
void
a11y::ProxyEvent(ProxyAccessible*, uint32_t)
{
}