Bug 1644323: For in-process iframes in content processes, use the emulated window set on the top level DocAccessibleChild (if any). r=MarcoZ

When window emulation is enabled, the emulated window is set on the top level DocAccessibleChild.
However, it isn't set on child documents (in-process iframes).
Therefore, when querying the window handle, we need to check for an emulated window handle on the top level document and return that if present.
This fixes the window handle returned by IAccessible2::get_windowHandle.

Note that the window handle used when firing events was already correct, as that is determined in the parent process.
In the parent process, the emulated window was already being propagated down to child DocAccessibleParents by BrowserParent::RecvPDocAccessibleConstructor.

Differential Revision: https://phabricator.services.mozilla.com/D79035
This commit is contained in:
James Teh committed 2020-06-10 07:11:31 +00:00
1 parent 7f9b16b938
commit 1863480795
1 file changed
+12 -3
+12 -3
View File
@@ -84,9 +84,18 @@ HWND DocAccessibleChild::GetNativeWindowHandle() const {
return mEmulatedWindowHandle;
}
auto tab = static_cast<dom::BrowserChild*>(Manager());
MOZ_ASSERT(tab);
return reinterpret_cast<HWND>(tab->GetNativeWindowHandle());
auto browser = static_cast<dom::BrowserChild*>(Manager());
MOZ_ASSERT(browser);
// Iframe documents use the same window handle as their top level document.
auto topDoc = static_cast<DocAccessibleChild*>(
browser->GetTopLevelDocAccessibleChild());
// Note that topDoc can be null if we're still initializing the top level
// document.
if (topDoc && topDoc != this && topDoc->mEmulatedWindowHandle) {
return topDoc->mEmulatedWindowHandle;
}
return reinterpret_cast<HWND>(browser->GetNativeWindowHandle());
}
void DocAccessibleChild::PushDeferredEvent(UniquePtr<DeferredEvent> aEvent) {