From 250f5f4a11ed231dfcbd217ab2d2ce13ab2f9105 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20S=C3=B8rvig?= Date: Thu, 12 May 2022 15:41:25 +0200 Subject: [PATCH] wasm: fix specialHtmlTargets code Remove .as_handle() call, which was left over from the previous EM_ASM-based code; see 0ec75f4b9. Change-Id: I220304074f4d17e706726dab086c0330edc9ef25 Reviewed-by: Lorn Potter --- src/plugins/platforms/wasm/qwasmscreen.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/wasm/qwasmscreen.cpp b/src/plugins/platforms/wasm/qwasmscreen.cpp index 03c672b9ba2..84bb6bb86d0 100644 --- a/src/plugins/platforms/wasm/qwasmscreen.cpp +++ b/src/plugins/platforms/wasm/qwasmscreen.cpp @@ -97,7 +97,7 @@ QWasmScreen::QWasmScreen(const emscripten::val &containerOrCanvas) m_onContextMenu = std::make_unique(m_canvas, "contextmenu", [](emscripten::val event){ event.call("preventDefault"); }); - + // Create "specialHTMLTargets" mapping for the canvas. Normally, Emscripten // uses the html element id when targeting elements, for example when registering // event callbacks. However, this approach is limited to supporting single-document @@ -105,9 +105,8 @@ QWasmScreen::QWasmScreen(const emscripten::val &containerOrCanvas) // As a workaround for this, Emscripten supports registering custom mappings in the // "specialHTMLTargets" object. Add a mapping for the canvas for this screen. emscripten::val specialHtmlTargets = emscripten::val::module_property("specialHTMLTargets"); - std::string id = std::string("!qtcanvas_") + std::to_string(uint32_t(this)); - specialHtmlTargets.set(id, m_canvas.as_handle()); + specialHtmlTargets.set(id, m_canvas); // Install event handlers on the container/canvas. This must be // done after the canvas has been created above.