diff options
author | Morten Johan Sørvig <morten.sorvig@qt.io> | 2022-02-14 17:19:40 +0100 |
---|---|---|
committer | Morten Johan Sørvig <morten.sorvig@qt.io> | 2022-02-17 20:17:38 +0000 |
commit | 738a11eeac0ae9056fda9b28563139924a8bc88f (patch) | |
tree | 82aa7d6edd53d3ceec6a7bc1a5a45d8c9f69552b /tests/auto/other | |
parent | 17c7af722c33e7347e99906ae836ad855244a6dc (diff) |
wasm: reliably determine QScreen position
Fix bug where QWindow content would be drawn with an
offset from the QScreen’s topLeft if the page was scrolled.
On Qt for WebAssembly, screen geometry is equivalent
to canvas geometry, where the canvas position is the
position of the canvas on the document body.
getBoundingClientRect() is the correct function to use
here, however it returns a rect relative to the viewport.
Offsetting this rect by offsetLeft/Top can work in some
bases, but this offset is relative to HTMLElement.offsetParent
and not necessarily to the document body.
Determine the correct QScreen position by subtracting
the body position from the canvas position (both relative
to the viewport).
Change-Id: Ifb7fd28adedbf997d63f79f9b626cfcf3664ff54
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
Diffstat (limited to 'tests/auto/other')
0 files changed, 0 insertions, 0 deletions