Accessibility macOS: fix parentElement
Try to return the immediate parent first, nothing else makes sense. The original code relied on the window pointer usually being nullptr, which is not reliable. Make sure to check the validity of the handle returned, since it's possible to have the platform window being nullptr. It's not quite clear to me how to end up with a null window though. Task-number: QTBUG-52304 Change-Id: Id3e70cdab980fb0a86cebbb7c10d824d8a7dd80b Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
This commit is contained in:
parent
47de2ef27f
commit
fafdb171e0
@ -235,19 +235,19 @@ static void convertLineOffset(QAccessibleTextInterface *text, int *line, int *of
|
||||
if (!iface || !iface->isValid())
|
||||
return nil;
|
||||
|
||||
if (QAccessibleInterface *parent = iface->parent()) {
|
||||
QAccessible::Id parentId = QAccessible::uniqueId(parent);
|
||||
return [QMacAccessibilityElement elementWithId: parentId];
|
||||
}
|
||||
|
||||
if (QWindow *window = iface->window()) {
|
||||
QCocoaWindow *win = static_cast<QCocoaWindow*>(window->handle());
|
||||
return qnsview_cast(win->view());
|
||||
QPlatformWindow *platformWindow = window->handle();
|
||||
if (platformWindow) {
|
||||
QCocoaWindow *win = static_cast<QCocoaWindow*>(platformWindow);
|
||||
return qnsview_cast(win->view());
|
||||
}
|
||||
}
|
||||
|
||||
QAccessibleInterface *parent = iface->parent();
|
||||
if (!parent) {
|
||||
qWarning() << "INVALID PARENT FOR INTERFACE: " << iface;
|
||||
return nil;
|
||||
}
|
||||
|
||||
QAccessible::Id parentId = QAccessible::uniqueId(parent);
|
||||
return [QMacAccessibilityElement elementWithId: parentId];
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user