-
Notifications
You must be signed in to change notification settings - Fork 9k
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
fix: element screenshot issue in headful mode #8018
Conversation
d38b47a
to
52074e4
Compare
src/common/JSHandle.ts
Outdated
// Fallback to `layoutViewport` in case of using Firefox. | ||
const { pageX, pageY } = | ||
layoutMetrics.cssLayoutViewport || layoutMetrics.layoutViewport; | ||
const { pageX, pageY } = layoutMetrics.layoutViewport; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a temp workaround we can get the cssPixel / deprecatedPixel ratio and normalize the layoutViewport.pageX, layoutViewport.pageY by that ratio.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
smth like
const pixelRatio = layoutMetrics.cssLayoutViewport.clientWidth / layoutMetrics.layoutViewport.clientWidth;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, according to the implementation, it looks like we have to use cssVisualViewport
instead. DevTools uses it and screenshots in Canary DevTools works well.
My experiment showed the cssLayoutViewport.Page[X/Y]
shows the window's position on the screen.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const { pageX, pageY } = layoutMetrics.layoutViewport; | |
const { pageX, pageY } = layoutMetrics.cssVisualViewport; |
52074e4
to
24b2347
Compare
24b2347
to
4e65f34
Compare
4e65f34
to
4572e9a
Compare
4572e9a
to
d8a1ade
Compare
d8a1ade
to
fa8e5e2
Compare
Fixes: #7999