Bug 1617301 - Fix accessibilityFocusedUIElement to work across processes. r=morgan

This is similar to the fix in bug 1614079 where we need to account
for a descendant that might match past a process boundary.

Differential Revision: https://phabricator.services.mozilla.com/D63974

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Eitan Isaacson 2020-03-02 22:10:37 +00:00
Родитель ee44ad7d4c
Коммит f270ef49e9
1 изменённых файлов: 13 добавлений и 1 удалений

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

@ -18,6 +18,7 @@
#include "TableAccessible.h"
#include "TableCellAccessible.h"
#include "mozilla/a11y/PDocAccessible.h"
#include "mozilla/dom/BrowserParent.h"
#include "OuterDocAccessible.h"
#include "nsRect.h"
@ -544,7 +545,18 @@ static inline NSMutableArray* ConvertToNSArray(nsTArray<ProxyAccessible*>& aArra
mozAccessible* focusedChild = nil;
if (accWrap) {
Accessible* focusedGeckoChild = accWrap->FocusedChild();
if (focusedGeckoChild) focusedChild = GetNativeFromGeckoAccessible(focusedGeckoChild);
if (focusedGeckoChild) {
focusedChild = GetNativeFromGeckoAccessible(focusedGeckoChild);
} else {
dom::BrowserParent* browser = dom::BrowserParent::GetFocused();
if (browser) {
a11y::DocAccessibleParent* proxyDoc = browser->GetTopLevelDocAccessible();
if (proxyDoc) {
mozAccessible* nativeRemoteChild = GetNativeFromProxy(proxyDoc);
return [nativeRemoteChild accessibilityFocusedUIElement];
}
}
}
} else if (proxy) {
ProxyAccessible* focusedGeckoChild = proxy->FocusedChild();
if (focusedGeckoChild) focusedChild = GetNativeFromProxy(focusedGeckoChild);