wasm: fix accessibility crash on null parent
The code was a assuming that an a11y interface always has a parent, which is not the case for the root interface. Also factor out to a getWindow() function, to prepare for re-use later on. Change-Id: I52a841bf94c712deb9603e8b9c2c878820c5f117 Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io> (cherry picked from commit 34c36821578f39e9c7f99e1dd0e7887a52418b9d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
79ffb2eb33
commit
577364b0e8
@ -113,17 +113,18 @@ emscripten::val QWasmAccessibility::getContainer(QWindow *window)
|
|||||||
|
|
||||||
emscripten::val QWasmAccessibility::getContainer(QAccessibleInterface *iface)
|
emscripten::val QWasmAccessibility::getContainer(QAccessibleInterface *iface)
|
||||||
{
|
{
|
||||||
QWindow *window = iface->window();
|
if (!iface)
|
||||||
if (!window) {
|
|
||||||
//this is needed to add tabs as the window is not available
|
|
||||||
if (iface->parent()->window()) {
|
|
||||||
window = iface->parent()->window();
|
|
||||||
} else {
|
|
||||||
return emscripten::val::undefined();
|
return emscripten::val::undefined();
|
||||||
}
|
return getContainer(getWindow(iface));
|
||||||
}
|
}
|
||||||
|
|
||||||
return getContainer(window);
|
QWindow *QWasmAccessibility::getWindow(QAccessibleInterface *iface)
|
||||||
|
{
|
||||||
|
QWindow *window = iface->window();
|
||||||
|
// this is needed to add tabs as the window is not available
|
||||||
|
if (!window && iface->parent())
|
||||||
|
window = iface->parent()->window();
|
||||||
|
return window;
|
||||||
}
|
}
|
||||||
|
|
||||||
emscripten::val QWasmAccessibility::getDocument(const emscripten::val &container)
|
emscripten::val QWasmAccessibility::getDocument(const emscripten::val &container)
|
||||||
|
@ -36,6 +36,7 @@ private:
|
|||||||
static emscripten::val getContainer(QAccessibleInterface *iface);
|
static emscripten::val getContainer(QAccessibleInterface *iface);
|
||||||
static emscripten::val getDocument(const emscripten::val &container);
|
static emscripten::val getDocument(const emscripten::val &container);
|
||||||
static emscripten::val getDocument(QAccessibleInterface *iface);
|
static emscripten::val getDocument(QAccessibleInterface *iface);
|
||||||
|
static QWindow *getWindow(QAccessibleInterface *iface);
|
||||||
|
|
||||||
emscripten::val createHtmlElement(QAccessibleInterface *iface);
|
emscripten::val createHtmlElement(QAccessibleInterface *iface);
|
||||||
void destroyHtmlElement(QAccessibleInterface *iface);
|
void destroyHtmlElement(QAccessibleInterface *iface);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user