Backed out changeset 846e436ca1c2 (bug 1870512) for causing automation.py related Windows failures CLOSED TREE

This commit is contained in:
Norisz Fay 2023-12-18 21:53:13 +02:00
Родитель 1b80057444
Коммит 90733dd7b4
1 изменённых файлов: 23 добавлений и 0 удалений

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

@ -94,6 +94,29 @@ MsaaDocAccessible::get_accParent(
(nsWinUtils::IsWindowEmulationStarted() &&
nsCoreUtils::IsTopLevelContentDocInProcess(docAcc->DocumentNode())))) {
HWND hwnd = static_cast<HWND>(docAcc->GetNativeWindow());
if (hwnd && !docAcc->ParentDocument()) {
nsIFrame* frame = docAcc->GetFrame();
if (frame) {
nsIWidget* widget = frame->GetNearestWidget();
if (widget->GetWindowType() == widget::WindowType::Child &&
!widget->GetParent()) {
// Bug 1427304: Windows opened with popup=yes (such as the WebRTC
// sharing indicator) get two HWNDs. The root widget is associated
// with the inner HWND, but the outer HWND still answers to
// WM_GETOBJECT queries. This means that getting the parent of the
// oleacc window accessible for the inner HWND returns this
// root accessible. Thus, to avoid a loop, we must never return the
// oleacc window accessible for the inner HWND. Instead, we use the
// outer HWND here.
HWND parentHwnd = ::GetParent(hwnd);
if (parentHwnd) {
MOZ_ASSERT(::GetWindowLongW(parentHwnd, GWL_STYLE) & WS_POPUP,
"Parent HWND should be a popup!");
hwnd = parentHwnd;
}
}
}
}
if (hwnd &&
SUCCEEDED(::CreateStdAccessibleObject(
hwnd, OBJID_WINDOW, IID_IAccessible, (void**)ppdispParent))) {