Bug 1471466: Don't fire a focus event for a remote accessible if focus has moved into the chrome since the event was sent. r=surkov

For example, this can happen when choosing File menu -> new Tab.
Focus briefly returns to the document in the original tab, so we ask that document to restore focus.
The remote document then sends a focus event to the parent.
However, before the parent can process that event, focus has already moved to the address bar for the new tab.
With this check, we discover that focus is now in the chrome and thus avoid firing the event for the remote accessible.

MozReview-Commit-ID: 7k58dzREqZD

--HG--
extra : rebase_source : 070d3a6b5032bd6d4cd36fb054be04509bb0faae
This commit is contained in:
James Teh 2018-06-27 15:33:08 +10:00
Родитель fadefb87a2
Коммит 31b106cf3a
1 изменённых файлов: 11 добавлений и 0 удалений

Просмотреть файл

@ -131,6 +131,17 @@ void
a11y::ProxyFocusEvent(ProxyAccessible* aTarget,
const LayoutDeviceIntRect& aCaretRect)
{
if (FocusMgr()->FocusedAccessible()) {
// This is a focus event from a remote document, but focus has moved out
// of that document into the chrome since that event was sent. For example,
// this can happen when choosing File menu -> New Tab. See bug 1471466.
// Note that this does not handle the case where a focus event is sent from
// one remote document, but focus moved into a second remote document
// since that event was sent. However, this isn't something anyone has been
// able to trigger.
return;
}
AccessibleWrap::UpdateSystemCaretFor(aTarget, aCaretRect);
AccessibleWrap::FireWinEvent(WrapperFor(aTarget),
nsIAccessibleEvent::EVENT_FOCUS);