зеркало из https://github.com/mozilla/gecko-dev.git
bug 1172525 - rework forwarding events to the parent process r=davidb, lsocks
The set of events fired to platform accessibility is not the same as the set in the event queue. Therefore we should forward events to the parent process someplace where they are the same so the same events can be emitted for child processes.
This commit is contained in:
Родитель
9eadc95b3f
Коммит
6b4b770150
|
@ -480,44 +480,6 @@ 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;
|
||||
case nsIAccessibleEvent::EVENT_STATE_CHANGE: {
|
||||
AccStateChangeEvent* event = downcast_accEvent(aEvent);
|
||||
ipcDoc->SendStateChangeEvent(id, event->GetState(),
|
||||
event->IsStateEnabled());
|
||||
break;
|
||||
}
|
||||
case nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED: {
|
||||
AccCaretMoveEvent* event = downcast_accEvent(aEvent);
|
||||
ipcDoc->SendEvent(id, event->GetCaretOffset());
|
||||
break;
|
||||
}
|
||||
default:
|
||||
ipcDoc->SendEvent(id, aEvent->GetEventType());
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// EventQueue: event queue
|
||||
|
||||
|
@ -594,8 +556,5 @@ EventQueue::ProcessEventQueue()
|
|||
|
||||
if (!mDocument)
|
||||
return;
|
||||
|
||||
if (IPCAccessibilityActive())
|
||||
SendIPCEvent(event);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,11 +53,6 @@ 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.
|
||||
*/
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "ApplicationAccessible.h"
|
||||
#include "nsEventShell.h"
|
||||
#include "nsTextEquivUtils.h"
|
||||
#include "DocAccessibleChild.h"
|
||||
#include "Relation.h"
|
||||
#include "Role.h"
|
||||
#include "RootAccessible.h"
|
||||
|
@ -832,6 +833,42 @@ Accessible::HandleAccEvent(AccEvent* aEvent)
|
|||
{
|
||||
NS_ENSURE_ARG_POINTER(aEvent);
|
||||
|
||||
if (IPCAccessibilityActive() && Document()) {
|
||||
DocAccessibleChild* ipcDoc = mDoc->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;
|
||||
case nsIAccessibleEvent::EVENT_STATE_CHANGE: {
|
||||
AccStateChangeEvent* event = downcast_accEvent(aEvent);
|
||||
ipcDoc->SendStateChangeEvent(id, event->GetState(),
|
||||
event->IsStateEnabled());
|
||||
break;
|
||||
}
|
||||
case nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED: {
|
||||
AccCaretMoveEvent* event = downcast_accEvent(aEvent);
|
||||
ipcDoc->SendEvent(id, event->GetCaretOffset());
|
||||
break;
|
||||
}
|
||||
default:
|
||||
ipcDoc->SendEvent(id, aEvent->GetEventType());
|
||||
}
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIObserverService> obsService = services::GetObserverService();
|
||||
NS_ENSURE_TRUE(obsService, NS_ERROR_FAILURE);
|
||||
|
||||
|
|
|
@ -336,6 +336,12 @@ public:
|
|||
*/
|
||||
void RecreateAccessible(nsIContent* aContent);
|
||||
|
||||
/**
|
||||
* If this document is in a content process return the object responsible for
|
||||
* communicating with the main process for it.
|
||||
*/
|
||||
DocAccessibleChild* IPCDoc() const { return mIPCDoc; }
|
||||
|
||||
protected:
|
||||
virtual ~DocAccessible();
|
||||
|
||||
|
@ -519,12 +525,6 @@ protected:
|
|||
*/
|
||||
bool IsLoadEventTarget() const;
|
||||
|
||||
/**
|
||||
* If this document is in a content process return the object responsible for
|
||||
* communicating with the main process for it.
|
||||
*/
|
||||
DocAccessibleChild* IPCDoc() const { return mIPCDoc; }
|
||||
|
||||
/*
|
||||
* Set the object responsible for communicating with the main process on
|
||||
* behalf of this document.
|
||||
|
|
Загрузка…
Ссылка в новой задаче