diff options
author | Morten Sørvig <[email protected]> | 2024-09-09 02:18:31 +0200 |
---|---|---|
committer | Morten Sørvig <[email protected]> | 2024-10-22 18:53:57 +0200 |
commit | 92b03232406498d39ecffe4b41c62d2035576508 (patch) | |
tree | 8524e4ec34df73faa8864f29ab51ef4b4a0c924f /src/plugins/platforms/wasm/qwasmwindow.cpp | |
parent | bcbe7e23357c9ef15e82c36a7518fb27edd35660 (diff) |
wasm: remove superfluous m_canvasContainer
Make the canvas and the a11y container element be children
of m_windowContents instead.
Task-number: QTBUG-128732
Change-Id: I6386eaa02a412888ae92beb8a74036b36b9b03db
Reviewed-by: Tor Arne Vestbø <[email protected]>
Diffstat (limited to 'src/plugins/platforms/wasm/qwasmwindow.cpp')
-rw-r--r-- | src/plugins/platforms/wasm/qwasmwindow.cpp | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/plugins/platforms/wasm/qwasmwindow.cpp b/src/plugins/platforms/wasm/qwasmwindow.cpp index ba325bac121..3b898eb29b3 100644 --- a/src/plugins/platforms/wasm/qwasmwindow.cpp +++ b/src/plugins/platforms/wasm/qwasmwindow.cpp @@ -57,7 +57,6 @@ QWasmWindow::QWasmWindow(QWindow *w, QWasmDeadKeySupport *deadKeySupport, m_document(dom::document()), m_qtWindow(m_document.call<emscripten::val>("createElement", emscripten::val("div"))), m_windowContents(m_document.call<emscripten::val>("createElement", emscripten::val("div"))), - m_canvasContainer(m_document.call<emscripten::val>("createElement", emscripten::val("div"))), m_a11yContainer(m_document.call<emscripten::val>("createElement", emscripten::val("div"))), m_canvas(m_document.call<emscripten::val>("createElement", emscripten::val("canvas"))) { @@ -87,14 +86,10 @@ QWasmWindow::QWasmWindow(QWindow *w, QWasmDeadKeySupport *deadKeySupport, // Hide the canvas from screen readers. m_canvas.call<void>("setAttribute", std::string("aria-hidden"), std::string("true")); + m_windowContents.call<void>("appendChild", m_canvas); - m_windowContents.call<void>("appendChild", m_canvasContainer); - - m_canvasContainer["classList"].call<void>("add", emscripten::val("qt-window-canvas-container")); - m_canvasContainer.call<void>("appendChild", m_canvas); - - m_canvasContainer.call<void>("appendChild", m_a11yContainer); m_a11yContainer["classList"].call<void>("add", emscripten::val("qt-window-a11y-container")); + m_windowContents.call<void>("appendChild", m_a11yContainer); const bool rendersTo2dContext = w->surfaceType() != QSurface::OpenGLSurface; if (rendersTo2dContext) @@ -134,7 +129,7 @@ QWasmWindow::QWasmWindow(QWindow *w, QWasmDeadKeySupport *deadKeySupport, QWasmWindow::~QWasmWindow() { emscripten::val::module_property("specialHTMLTargets").delete_(canvasSelector()); - m_canvasContainer.call<void>("removeChild", m_canvas); + m_windowContents.call<void>("removeChild", m_canvas); m_context2d = emscripten::val::undefined(); commitParent(nullptr); if (m_requestAnimationFrameId > -1) @@ -282,8 +277,8 @@ void QWasmWindow::setGeometry(const QRect &rect) m_qtWindow["style"].set("left", std::to_string(frameRect.left()) + "px"); m_qtWindow["style"].set("top", std::to_string(frameRect.top()) + "px"); - m_canvasContainer["style"].set("width", std::to_string(clientAreaRect.width()) + "px"); - m_canvasContainer["style"].set("height", std::to_string(clientAreaRect.height()) + "px"); + m_canvas["style"].set("width", std::to_string(clientAreaRect.width()) + "px"); + m_canvas["style"].set("height", std::to_string(clientAreaRect.height()) + "px"); m_a11yContainer["style"].set("width", std::to_string(clientAreaRect.width()) + "px"); m_a11yContainer["style"].set("height", std::to_string(clientAreaRect.height()) + "px"); |