In first repaint events innerWidth/innerHeight do not consider browser zoom
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
People
(Reporter: bugzilla, Unassigned)
Details
Attachments
(1 file)
592 bytes,
text/html
|
Details |
User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36
Steps to reproduce:
When a page is loaded the innerWidth
and innerHeight
do not take into consideration the browser scaling.
To reproduce open the attached file, set a zoom (ctrl/+ a few times) then close firefox. Then from command line type firefox bug.html
; you will see two different pairs of numbers. Pressing Ctrl-R or F5 will show instead identical pairs of numers.
Actual results:
In a web app that displays an image properly centered and zoomed when first loaded (but that doesn't change zoom/scale if you resize the window) the initial behavior is incorrect if there is a browser zoom.
The problem has been tracked down to the fact that when the DOM completes the loading and the rendering computes scaling/pan factors the information about the view is incorrect because is not considering browser zoom.
Note that the problem is visible only when starting FirefFox on the page from the command line; not when opening the file from an already opened browser and also just using Ctrl-R or F5 fixes.
Using document.onreadystatechange
doesn't help (even at "complete"
the logical zoom is not yet active).
An ugly workaround is to just start a timer on DOM completion event (with setTimeout
). Also 0 cannot be used as delay as even in that event the view parameters are incorrect... 100ms works.
Expected results:
If a browser has a zoom active then logical pixels should be considered even for first script processing, not later. In other words innerWidth/innerHeight should be considering zoom from the beginning of scripts.
Reporter | ||
Updated•3 years ago
|
Comment 1•3 years ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::DOM: Core & HTML' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
![]() |
||
Updated•3 years ago
|
Updated•3 years ago
|
Description
•