Bug 1777409: Fix IAccessible::accFocus for non-tab remote documents such as extension sidebars. r=morgan

Previously, we retrieved the active tab.
However, remote documents might not be within a tab; e.g. extension sidebars.
Instead, we now use BrowserParent::GetFocused to get the focused document.

Differential Revision: https://phabricator.services.mozilla.com/D150706
This commit is contained in:
James Teh 2022-07-05 21:04:27 +00:00
Родитель 71f8cac441
Коммит 7558f52d0c
1 изменённых файлов: 6 добавлений и 5 удалений

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

@ -3,6 +3,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 "mozilla/a11y/DocAccessibleParent.h"
#include "mozilla/dom/BrowserParent.h"
#include "mozilla/WindowsVersion.h"
#include "MsaaRootAccessible.h"
#include "Relation.h"
@ -129,12 +131,11 @@ MsaaRootAccessible::get_accFocus(
if (StaticPrefs::accessibility_cache_enabled_AtStartup()) {
return S_FALSE;
}
// Get the document in the active tab.
RootAccessible* rootAcc = RootAcc();
if (!rootAcc) {
return CO_E_OBJNOTCONNECTED;
dom::BrowserParent* browser = dom::BrowserParent::GetFocused();
if (!browser) {
return hr;
}
RemoteAccessible* docProxy = rootAcc->GetPrimaryRemoteTopLevelContentDoc();
DocAccessibleParent* docProxy = browser->GetTopLevelDocAccessible();
if (!docProxy) {
return hr;
}