wasm: convert a11y coordinates to window coordinates
The html accessibility elements are positioned relative to the window a11y container. Convert the global (screen) coordinates we get from QAccessibleIntreface::rect() to window coordinates. Pick-to: 6.5 Change-Id: Ifd4eb671def296b1eb418789b7ca85afa365e546 Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>bb10
parent
34c3682157
commit
bf5dbc61b3
|
|
@ -328,7 +328,17 @@ void QWasmAccessibility::setHtmlElementVisibility(QAccessibleInterface *iface, b
|
|||
void QWasmAccessibility::setHtmlElementGeometry(QAccessibleInterface *iface)
|
||||
{
|
||||
emscripten::val element = ensureHtmlElement(iface);
|
||||
setHtmlElementGeometry(element, iface->rect());
|
||||
|
||||
// QAccessibleInterface gives us the geometry in global (screen) coordinates. Translate that
|
||||
// to window geometry in order to position elements relative to window origin.
|
||||
QWindow *window = getWindow(iface);
|
||||
if (!window)
|
||||
qCWarning(lcQpaAccessibility) << "Unable to find window for" << iface << "setting null geometry";
|
||||
QRect screenGeometry = iface->rect();
|
||||
QPoint windowPos = window ? window->mapFromGlobal(screenGeometry.topLeft()) : QPoint();
|
||||
QRect windowGeometry(windowPos, screenGeometry.size());
|
||||
|
||||
setHtmlElementGeometry(element, windowGeometry);
|
||||
}
|
||||
|
||||
void QWasmAccessibility::setHtmlElementGeometry(emscripten::val element, QRect geometry)
|
||||
|
|
|
|||
Loading…
Reference in New Issue