8000 Report image Element Timing algorithm doesn't report intrinsic size for LCP · Issue #31 · w3c/element-timing · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Report image Element Timing algorithm doesn't report intrinsic size for LCP #31

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

Open
philipwalton opened this issue Aug 9, 2019 · 4 comments
Open
Assignees

Comments

@philipwalton
Copy link
Member

My understanding is LCP is supposed to factor in the intrinsic sizes of images and not consider the rendered size for LCP in cases where the image is stretched or enlarged (e.g. a 1px transparent gif).

But as currently spec'ed, the natural width and height of the image are set after 3.5 sub-item 3:

If exposedElement is not null, call the potentially add a LargestContentfulPaint entry algorithm with intersectionRect, imageRequest, renderTime, loadTime, element, and document.

At this point in the algorithm, intersectionRect has only considered the visual width and height, not the intrinsic width and height, thus 3 sub-item 9 in the LCP spec will report the visual size, which I do not believe is the intention.

Let size be width*height.

@philipwalton
Copy link
Member Author

One other note. The current Chrome implementation doesn't consider image scaling of CSS background images.

I believe the intention is to have scaled background images report the same as they would if they were an <img> tag, so whatever language is used to report these to LCP should also address background images resized via the background-size property.

@npm1
Copy link
Collaborator
npm1 commented Aug 14, 2019

I'll address the original issue on the LCP side by scaling the size by min(display_size, intrinsic_size) / display_size.

Regarding the background-size not being captured in Chrome comment, can you file a new bug in crbug.com/new?

@mmocny
Copy link
Contributor
mmocny commented Feb 11, 2025

This feels like the opposite of the recent feature request to add intersectionRect to LCP: w3c/largest-contentful-paint#127

I suspect Element Timings should have a size and LCP should have intersectionRect.

@mmocny
Copy link
Contributor
mmocny commented Feb 13, 2025

Actually, I think Element Timing exposes naturalWidth and naturalHeight. In theory I think that these multiplied together would be == size, but I'm not sure about viewport intersection...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants
0