-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect width and height of full page screenshot #14824
Comments
Running a bisect identifies #14418 to be the change that caused a regression.
|
I spent some more time with it — I think our full page screenshot dimension calculations could be improved. The reason why this specific site's audit is producing a difference between declared screenshot dimensions (that's in LHR) and actual dimensions (that of WebP image) is due to the page's horizontal overflow. Any page that has a horizontal overflow (a horizontal scrollbar for that matter) should be able to reproduce the inconsistency. The root cause of this inconsistency comes from the way we calculate screenshot area. For a page with horizontal overflow, Chromium produces a Similarly, the height calculation is a scaled approximation between device height, content height and viewport client height. I haven't fully understood the reasoning behind this calculation, but it seems to produce enough shortage from actual content height in most cases and results in a screenshot that's shorter than full height of the page. As a side effect of this, all element screenshot coordinate calculations are off for the page. FWIW, I propose that we simplify this calculations to the following:
Once we do that, we could avoid reading I'm testing this out in a branch and it seems to work, assuming our Thoughts? Are there cases where I might have had an oversight? |
I haven't fully digested everything about horizontal overflow, but it does appear that the placement of our element bounding boxes are off if there is horizontal overflow. Your branch seems to fix this issue at least so I think it's close to a solution.
It's important to point out that This is the reasoning behind the current |
FAQ
URL
https://wp-rocket.me
What happened?
I generated a JSON report for this URL: https://wp-rocket.me
From the JSON report, I extracted the webp image buffer and converted it to a file.
While I was checking the file attributes, I noticed the width and height mentioned in the report are different compared to what the actual size is.
Actual Size: 412 × 8795 pixels
Size mentioned in report: 417 x 8902 pixels
What did you expect?
I expect the full-page screenshot image buffer to be the same size as mentioned in the report.
What have you tried?
I found this issue only for this particular URL. All other URLs I tried are working fine.
Also, I'm getting the correct width and height with lighthouse 9.6.6.
How were you running Lighthouse?
CLI, node
Lighthouse Version
10.0.1
Chrome Version
109.0.5414.119 (Official Build) (arm64)
Node Version
16.18.1
OS
Mac
Relevant log output
The text was updated successfully, but these errors were encountered: