Skip to content
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

Add sizes=auto to lazy-loaded <img> #8008

Merged
merged 8 commits into from
Jun 2, 2023
Merged

Add sizes=auto to lazy-loaded <img> #8008

merged 8 commits into from
Jun 2, 2023

Conversation

zcorpan
Copy link
Member

@zcorpan zcorpan commented Jun 14, 2022

This allows web developers to omit the sizes attribute, or explicitly specify sizes=auto, for <img> elements that have loading=lazy. The browser will use the layout width of the image as input to the srcset resource selection (lazy images don't start loading until layout is known, at the earliest). For eager-loading images, it's invalid and equivalent to 100vw.

Fixes #4654.

(See WHATWG Working Mode: Changes for more details.)


/embedded-content.html ( diff )
/images.html ( diff )
/infrastructure.html ( diff )
/input.html ( diff )
/semantics.html ( diff )

zcorpan added a commit to web-platform-tests/wpt that referenced this pull request Jun 14, 2022
zcorpan added a commit to web-platform-tests/wpt that referenced this pull request Jun 14, 2022
Copy link
Contributor

@yoavweiss yoavweiss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this! :) A few nits a substantive question on the processing model

source Outdated Show resolved Hide resolved
source Outdated
<p>The keyword <dfn data-x="valdef-sizes-auto">auto</dfn> means the rendered width of the <span
data-x="concept-sizes-associated-img">associated</span> <code>img</code> element, if any, in <span
data-x="'px'">CSS pixels</span>, if that is not <code data-x="">0px</code>, and that
<code>img</code> element is <span>being rendered</span>, is being rendered to a visual medium, and
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it worthwhile to integrate the concept of being rendered to a visual medium into the "being rendered" definition? As is, this is a bit confusing to read.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I think the "is being rendered to a visual medium" is actually bogus. The width and height attributes used that, but I believe the branching should actually happen for "being rendered". Changed in f1d5577.

source Outdated
data-x="'px'">CSS pixels</span>, if that is not <code data-x="">0px</code>, and that
<code>img</code> element is <span>being rendered</span>, is being rendered to a visual medium, and
the <code>img</code> element's <code data-x="attr-img-loading">loading</code> attribute is in the
<span data-x="attr-loading-lazy-state">Lazy</span> state; otherwise, <code
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if we have a situation where the loading=lazy attribute was removed after the initial parsing of the <img> element? It's not a relevant mutation, but I would still expect sizes=auto to give us the layout width of the image, assuming that layout already happened.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be better to ignore "auto" if layout hasn't happened yet, but take it into account if it has, regardless of the loading attribute

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Taking "auto" into account if layout has happened makes it non-deterministic for eager images, as it's racy whether layout has happened before the image fetch starts. I wrote this PR with the assumption that it's better to have deterministic and predictable behavior. Which means that for eager images, auto = 100vw always.

Do we want non-deterministic here?

Or should we add a load() method for images, to explicitly start loading an image (like for media elements)?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right that deterministic behavior would be better, and there's no simple way to enforce that without the loading attribute. I'm not sure there's a strong use-case for "this image was initially lazy, but now we need to load it eagerly", so maybe we can skip this for now, and look into explicit ways to eagerly load images in case it's needed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think loading needs to be a relevant mutation attribute, too, since it can change what sizes=auto means.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added more conditions to relevant mutations.

With the rendered width being a possible relevant mutation, it could trigger on every frame (e.g. if the image dimensions are being animated). Is that a problem?

It sort of interferes with "Reacting to environment changes", since that aborts in 15.1 if there were relevant mutations (but maybe that's what we want for auto).

"update the image data" step 6.3.7.3 will fire a load event even if it's the same url, which doesn't seem great. If the image is broken, it will try to refetch it every time (#4480), which also doesn't seem great.

Copy link
Contributor

@yoavweiss yoavweiss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! One question

source Outdated Show resolved Hide resolved
Copy link
Contributor

@yoavweiss yoavweiss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zcorpan
Copy link
Member Author

zcorpan commented Jul 6, 2022

I wonder if the feature should more explicitly check for the case of no dimensions being specified, since the behavior is a bit weird in that case.

  • When no image is loaded yet, the width will be 0px, in which case the sizes algorithm returns 100vw.
  • When an image is loaded, and a relevant mutation occurs (for example, the viewport width changes, making the rendered width of the image change because the used sizes was 100vw, and this is now a relevant mutation). This time, the parsed sizes will return the current rendered width of the image, in pixels. So it's no longer responsive to further changes of the viewport width.

So, how to fix this? Use 100vw if the computed value (not used value) of the 'width' and 'min-width' properties are both auto?

@yoavweiss
Copy link
Contributor

So, how to fix this? Use 100vw if the computed value (not used value) of the 'width' and 'min-width' properties are both auto?

Using 100vw when we don't have any better alternatives (since we don't know what the layout size would be), SGTM. The "computed-value width isauto" case sounds like it fits that description. I'm not sure if there aren't other cases (but you probably know).

@zcorpan zcorpan added the do not merge yet Pull request must not be merged per rationale in comment label Jul 8, 2022
@zcorpan zcorpan force-pushed the bocoup/img-auto-sizes branch 2 times, most recently from 0908d7e to fc651c8 Compare August 8, 2022 13:51
@zcorpan
Copy link
Member Author

zcorpan commented Aug 8, 2022

So, how to fix this? Use 100vw if the computed value (not used value) of the 'width' and 'min-width' properties are both auto?

Done in fc651c8.

I suppose since the 'aspect-ratio' property now exists, it's possible to specify a width by setting a height and an aspect-ratio. So if width and min-width are both auto, we should check if 'aspect-ratio' and 'height'/'min-height' are also auto.

Are there any other ways to specify a width? cc @whatwg/css

@whatwg whatwg deleted a comment from Masalmasal Aug 8, 2022
@zcorpan
Copy link
Member Author

zcorpan commented Aug 9, 2022

To answer my own question, I think we have these:

So, an img element has a "specified width" if at least one of the following is true:

  • the computed value of 'width' or 'min-width' is a <length-percentage>
  • the computed value of 'aspect-ratio' is not 'auto' and the computed value of 'height' or 'min-height' is a <length-percentage>
  • the computed value of 'writing-mode' is 'horizontal-tb' and
    • the computed value of 'inline-size' or 'min-inline-size' is a <lenght-percentage> or
    • the computed value of 'aspect-ratio' is not 'auto' and is not degenerate and the computed value of 'block-size' or 'min-block-size' is a <length-percentage>
  • the computed value of 'writing-mode' is not 'horizontal-tb' and
    • the computed value of 'block-size' or 'min-block-size' is a <lenght-percentage> or
    • the computed value of 'aspect-ratio' is not 'auto' and is not degenerate and the computed value of 'inline-size' or 'min-inline-size' is a <length-percentage>

Does that seem correct?

Edit: I now also found these properties: https://drafts.csswg.org/css-sizing-4/#intrinsic-size-override

source Outdated Show resolved Hide resolved
@zcorpan
Copy link
Member Author

zcorpan commented Aug 9, 2022

Maybe a more general approach would be:

An element's concrete object size ignoring natural dimensions is its concrete object size but acting as if there are no natural dimensions, thus producing a rectangle with an absolute width and height.

This will match the actual concrete object size before the image has loaded.

Then, we can check that the "concrete object size ignoring natural dimensions" width is > 0, and any changes to this width is a relevant mutation.

@zcorpan
Copy link
Member Author

zcorpan commented Aug 9, 2022

I went with the approach described in the comment above. I believe it solves the problem discussed in #8008 (comment) and, at least in spec terms, doesn't introduce a lot of complexity.

@zcorpan
Copy link
Member Author

zcorpan commented Aug 9, 2022

(Need to rebase this after #8175 is merged.)

@zcorpan
Copy link
Member Author

zcorpan commented Aug 11, 2022

@yoavweiss PTAL :)

@zcorpan
Copy link
Member Author

zcorpan commented Aug 11, 2022

I'm a bit worried about compat for making more things "relevant mutations". Should we gate the new additions on usage of w descriptors in srcset?

source Outdated
descriptor</span>, the <code data-x="attr-img-sizes">sizes</code> attribute may also be present.
If, additionally, the <code data-x="attr-img-loading">loading</code> attribute is in the <span
data-x="attr-loading-eager-state">Eager</span> state, the <code
data-x="attr-img-sizes">sizes</code> attribute must be present. The <dfn element-attr for="img"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also say that when the loading attribute is in the Eager state, the value of the sizes attribute must not be "auto"? Or are we cool with that meaning "100vw"?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

source Outdated
<li><p>If the element's <code data-x="attr-img-loading">loading</code> attribute is in the <span
data-x="attr-loading-lazy-state">Lazy</span> state: the element starts or stops <span>being
rendered</span>, or its <span>concrete object size ignoring natural dimensions</span> width
changes.</p></li>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does that mean for a lazy-loaded image that was already loaded? If its dimensions change, it may get reloaded?

Copy link
Contributor

@yoavweiss yoavweiss Aug 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you remind me of the motivation for this relevant mutations change? I found this, but it's not clear from that discussion what are the use cases this addresses. Apologies if we already went through this! :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yoavweiss
Copy link
Contributor

I'm a bit worried about compat for making more things "relevant mutations". Should we gate the new additions on usage of w descriptors in srcset?

I share that concern, and not sure that gating it would help significantly. I understand the motivations for loading attribute mutation changes, but unclear on mutations when the concrete element size changes.

@zcorpan
Copy link
Member Author

zcorpan commented Aug 15, 2022

The size observer is to keep the image "responsive" to changes in rendered size. For example, consider a gallery with thumbnails and clicking a thumbnail shows the same img as large as possible within the viewport. The environment hasn't changed, only the rendered width. It seems reasonable to assume that sizes=auto would not make the initial size "sticky".

@yoavweiss
Copy link
Contributor

OK, I understand the reasoning to include the concrete size in the relevant mutations, and I think it makes sense to restrict those to only cases where they matter (so when srcset has 'w' descriptors).
Can you run an HTTPArchive analysis to see how often that condition is met?

IIUC, such content currently would be loaded once with a size of 100vw, and once we switch the the proposed behavior, multiple images may be loaded, if the image size is significantly increased or decreased. Is that understanding correct?

@zcorpan zcorpan deleted the bocoup/img-auto-sizes branch June 2, 2023 14:24
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Jun 4, 2023
Auto Sizes allows developers to omit the sizes attribute (or set it to
sizes=auto) for lazy loaded image elements with srcset. For this use
case the image's width should be provided. The browser will use the
layout width of the image in order to select the source url from the
srcset.

Spec PR:
whatwg/html#8008

WPT tests PR:
#34427

Chrome Platform Status link:
https://chromestatus.com/feature/5191555708616704

Intent to Prototype link:
https://groups.google.com/a/chromium.org/g/blink-dev/c/AYoqvNluyeA

R=pdr

Bug: 1359051
Change-Id: I8e9bc836e9582a9209db53d55e0edc96f90499f2
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Jun 5, 2023
Auto Sizes allows developers to omit the sizes attribute (or set it to
sizes=auto) for lazy loaded image elements with srcset. For this use
case the image's width should be provided. The browser will use the
layout width of the image in order to select the source url from the
srcset.

Spec PR:
whatwg/html#8008

WPT tests PR:
#34427

Chrome Platform Status link:
https://chromestatus.com/feature/5191555708616704

Intent to Prototype link:
https://groups.google.com/a/chromium.org/g/blink-dev/c/AYoqvNluyeA

R=pdr

Bug: 1359051
Change-Id: I8e9bc836e9582a9209db53d55e0edc96f90499f2
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Jun 5, 2023
Auto Sizes allows developers to omit the sizes attribute (or set it to
sizes=auto) for lazy loaded image elements with srcset. For this use
case the image's width should be provided. The browser will use the
layout width of the image in order to select the source url from the
srcset.

Spec PR:
whatwg/html#8008

WPT tests PR:
#34427

Chrome Platform Status link:
https://chromestatus.com/feature/5191555708616704

Intent to Prototype link:
https://groups.google.com/a/chromium.org/g/blink-dev/c/AYoqvNluyeA

R=pdr

Bug: 1359051
Change-Id: I8e9bc836e9582a9209db53d55e0edc96f90499f2
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Jun 6, 2023
Auto Sizes allows developers to omit the sizes attribute (or set it to
sizes=auto) for lazy loaded image elements with srcset. For this use
case the image's width should be provided. The browser will use the
layout width of the image in order to select the source url from the
srcset.

Spec PR:
whatwg/html#8008

WPT tests PR:
#34427

Chrome Platform Status link:
https://chromestatus.com/feature/5191555708616704

Intent to Prototype link:
https://groups.google.com/a/chromium.org/g/blink-dev/c/AYoqvNluyeA

R=pdr

Bug: 1359051
Change-Id: I8e9bc836e9582a9209db53d55e0edc96f90499f2
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Jun 6, 2023
Auto Sizes allows developers to omit the sizes attribute (or set it to
sizes=auto) for lazy loaded image elements with srcset. For this use
case the image's width should be provided. The browser will use the
layout width of the image in order to select the source url from the
srcset.

Spec PR:
whatwg/html#8008

WPT tests PR:
#34427

Chrome Platform Status link:
https://chromestatus.com/feature/5191555708616704

Intent to Prototype link:
https://groups.google.com/a/chromium.org/g/blink-dev/c/AYoqvNluyeA

R=pdr

Bug: 1359051
Low-Coverage-Reason: For html_srcset_parser.cc, it should be
                     covered by `image-srcset-cache.html`
                     but there seems to be cov reporing problem.
Change-Id: I8e9bc836e9582a9209db53d55e0edc96f90499f2
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Jun 6, 2023
Auto Sizes allows developers to omit the sizes attribute (or set it to
sizes=auto) for lazy loaded image elements with srcset. For this use
case the image's width should be provided. The browser will use the
layout width of the image in order to select the source url from the
srcset.

Spec PR:
whatwg/html#8008

WPT tests PR:
#34427

Chrome Platform Status link:
https://chromestatus.com/feature/5191555708616704

Intent to Prototype link:
https://groups.google.com/a/chromium.org/g/blink-dev/c/AYoqvNluyeA

R=pdr

Bug: 1359051
Low-Coverage-Reason: For html_srcset_parser.cc, it should be
                     covered by `image-srcset-cache.html`
                     but there seems to be cov reporing problem.
Change-Id: I8e9bc836e9582a9209db53d55e0edc96f90499f2
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Jun 7, 2023
Auto Sizes allows developers to omit the sizes attribute (or set it to
sizes=auto) for lazy loaded image elements with srcset. For this use
case the image's width should be provided. The browser will use the
layout width of the image in order to select the source url from the
srcset.

Spec PR:
whatwg/html#8008

WPT tests PR:
#34427

Chrome Platform Status link:
https://chromestatus.com/feature/5191555708616704

Intent to Prototype link:
https://groups.google.com/a/chromium.org/g/blink-dev/c/AYoqvNluyeA

R=pdr

Bug: 1359051
Low-Coverage-Reason: For html_srcset_parser.cc, it should be
                     covered by `image-srcset-cache.html`
                     but there seems to be cov reporing problem.
Change-Id: I8e9bc836e9582a9209db53d55e0edc96f90499f2
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Jun 8, 2023
Auto Sizes allows developers to omit the sizes attribute (or set it to
sizes=auto) for lazy loaded image elements with srcset. For this use
case the image's width should be provided. The browser will use the
layout width of the image in order to select the source url from the
srcset.

Spec PR:
whatwg/html#8008

WPT tests PR:
#34427

Chrome Platform Status link:
https://chromestatus.com/feature/5191555708616704

Intent to Prototype link:
https://groups.google.com/a/chromium.org/g/blink-dev/c/AYoqvNluyeA

R=pdr

Bug: 1359051
Low-Coverage-Reason: For html_srcset_parser.cc, it should be
                     covered by `image-srcset-cache.html`
                     but there seems to be cov reporing problem.
Change-Id: I8e9bc836e9582a9209db53d55e0edc96f90499f2
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Jun 13, 2023
Automatic update from web-platform-tests
HTML: test <img sizes=auto>

See whatwg/html#8008
--

wpt-commits: 1d96e07ecd4dc9597036afd773f2aa25015df5fd
wpt-pr: 34427
ErichDonGubler pushed a commit to erichdongubler-mozilla/firefox that referenced this pull request Jun 14, 2023
Automatic update from web-platform-tests
HTML: test <img sizes=auto>

See whatwg/html#8008
--

wpt-commits: 1d96e07ecd4dc9597036afd773f2aa25015df5fd
wpt-pr: 34427
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Jun 14, 2023
Auto Sizes allows developers to omit the sizes attribute (or set it to
sizes=auto) for lazy loaded image elements with srcset. For this use
case the image's width should be provided. The browser will use the
layout width of the image in order to select the source url from the
srcset.

Spec PR:
whatwg/html#8008

WPT tests PR:
#34427

Chrome Platform Status link:
https://chromestatus.com/feature/5191555708616704

Intent to Prototype link:
https://groups.google.com/a/chromium.org/g/blink-dev/c/AYoqvNluyeA

R=pdr

Bug: 1359051
Low-Coverage-Reason: For html_srcset_parser.cc, it should be
                     covered by `image-srcset-cache.html`
                     but there seems to be cov reporing problem.
Change-Id: I8e9bc836e9582a9209db53d55e0edc96f90499f2
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Jun 15, 2023
Auto Sizes allows developers to omit the sizes attribute (or set it to
sizes=auto) for lazy loaded image elements with srcset. For this use
case the image's width should be provided. The browser will use the
layout width of the image in order to select the source url from the
srcset.

Spec PR:
whatwg/html#8008

WPT tests PR:
#34427

Chrome Platform Status link:
https://chromestatus.com/feature/5191555708616704

Intent to Prototype link:
https://groups.google.com/a/chromium.org/g/blink-dev/c/AYoqvNluyeA

R=pdr

Bug: 1359051
Low-Coverage-Reason: For html_srcset_parser.cc, it should be
                     covered by `image-srcset-cache.html`
                     but there seems to be cov reporing problem.
Change-Id: I8e9bc836e9582a9209db53d55e0edc96f90499f2
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Jun 15, 2023
Auto Sizes allows developers to omit the sizes attribute (or set it to
sizes=auto) for lazy loaded image elements with srcset. For this use
case the image's width should be provided. The browser will use the
layout width of the image in order to select the source url from the
srcset.

Spec PR:
whatwg/html#8008

WPT tests PR:
#34427

Chrome Platform Status link:
https://chromestatus.com/feature/5191555708616704

Intent to Prototype link:
https://groups.google.com/a/chromium.org/g/blink-dev/c/AYoqvNluyeA

R=pdr

Bug: 1359051
Low-Coverage-Reason: For html_srcset_parser.cc, it should be
                     covered by `image-srcset-cache.html`
                     but there seems to be cov reporing problem.
Change-Id: I8e9bc836e9582a9209db53d55e0edc96f90499f2
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Jun 15, 2023
Auto Sizes allows developers to omit the sizes attribute (or set it to
sizes=auto) for lazy loaded image elements with srcset. For this use
case the image's width should be provided. The browser will use the
layout width of the image in order to select the source url from the
srcset.

Spec PR:
whatwg/html#8008

WPT tests PR:
#34427

Chrome Platform Status link:
https://chromestatus.com/feature/5191555708616704

Intent to Prototype link:
https://groups.google.com/a/chromium.org/g/blink-dev/c/AYoqvNluyeA

R=pdr

Bug: 1359051
Low-Coverage-Reason: For html_srcset_parser.cc, it should be
                     covered by `image-srcset-cache.html`
                     but there seems to be cov reporing problem.
Change-Id: I8e9bc836e9582a9209db53d55e0edc96f90499f2
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Jun 15, 2023
Auto Sizes allows developers to omit the sizes attribute (or set it to
sizes=auto) for lazy loaded image elements with srcset. For this use
case the image's width should be provided. The browser will use the
layout width of the image in order to select the source url from the
srcset.

Spec PR:
whatwg/html#8008

WPT tests PR:
#34427

Chrome Platform Status link:
https://chromestatus.com/feature/5191555708616704

Intent to Prototype link:
https://groups.google.com/a/chromium.org/g/blink-dev/c/AYoqvNluyeA

R=pdr

Bug: 1359051
Low-Coverage-Reason: For html_srcset_parser.cc, it should be
                     covered by `image-srcset-cache.html`
                     but there seems to be cov reporing problem.
Change-Id: I8e9bc836e9582a9209db53d55e0edc96f90499f2
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Jun 15, 2023
Auto Sizes allows developers to omit the sizes attribute (or set it to
sizes=auto) for lazy loaded image elements with srcset. For this use
case the image's width should be provided. The browser will use the
layout width of the image in order to select the source url from the
srcset.

Spec PR:
whatwg/html#8008

WPT tests PR:
#34427

Chrome Platform Status link:
https://chromestatus.com/feature/5191555708616704

Intent to Prototype link:
https://groups.google.com/a/chromium.org/g/blink-dev/c/AYoqvNluyeA

R=pdr

Bug: 1359051
Low-Coverage-Reason: For html_srcset_parser.cc, it should be
                     covered by `image-srcset-cache.html`
                     but there seems to be cov reporing problem.
Change-Id: I8e9bc836e9582a9209db53d55e0edc96f90499f2
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Jun 16, 2023
Automatic update from web-platform-tests
HTML: test <img sizes=auto>

See whatwg/html#8008
--

wpt-commits: 1d96e07ecd4dc9597036afd773f2aa25015df5fd
wpt-pr: 34427

UltraBlame original commit: eed1029e905a955343124475089f6b881fe123f5
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this pull request Jun 16, 2023
Automatic update from web-platform-tests
HTML: test <img sizes=auto>

See whatwg/html#8008
--

wpt-commits: 1d96e07ecd4dc9597036afd773f2aa25015df5fd
wpt-pr: 34427

UltraBlame original commit: eed1029e905a955343124475089f6b881fe123f5
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request Jun 16, 2023
Automatic update from web-platform-tests
HTML: test <img sizes=auto>

See whatwg/html#8008
--

wpt-commits: 1d96e07ecd4dc9597036afd773f2aa25015df5fd
wpt-pr: 34427

UltraBlame original commit: eed1029e905a955343124475089f6b881fe123f5
pento pushed a commit to WordPress/wordpress-develop that referenced this pull request Sep 11, 2024
This implements the HTML spec for applying auto sizes to lazy-loaded images by prepending `auto` to the `sizes` attribute generated by WordPress if the image has a `loading` attribute set to `lazy`. For browser that support this HTML spec, the image's size value will be set to the concrete object size of the image. For browsers that don't support the spec, the word "auto" will be ignored when parsing the sizes value.

References:
- https://html.spec.whatwg.org/multipage/images.html#sizes-attributes
- whatwg/html#8008

Props mukesh27, flixos90, joemcgill, westonruter, peterwilsoncc.
Fixes #61847.


git-svn-id: https://develop.svn.wordpress.org/trunk@59008 602fd350-edb4-49c9-b593-d223f7449a82
markjaquith pushed a commit to markjaquith/WordPress that referenced this pull request Sep 11, 2024
This implements the HTML spec for applying auto sizes to lazy-loaded images by prepending `auto` to the `sizes` attribute generated by WordPress if the image has a `loading` attribute set to `lazy`. For browser that support this HTML spec, the image's size value will be set to the concrete object size of the image. For browsers that don't support the spec, the word "auto" will be ignored when parsing the sizes value.

References:
- https://html.spec.whatwg.org/multipage/images.html#sizes-attributes
- whatwg/html#8008

Props mukesh27, flixos90, joemcgill, westonruter, peterwilsoncc.
Fixes #61847.

Built from https://develop.svn.wordpress.org/trunk@59008


git-svn-id: http://core.svn.wordpress.org/trunk@58404 1a063a9b-81f0-0310-95a4-ce76da25c4cd
github-actions bot pushed a commit to platformsh/wordpress-performance that referenced this pull request Sep 11, 2024
This implements the HTML spec for applying auto sizes to lazy-loaded images by prepending `auto` to the `sizes` attribute generated by WordPress if the image has a `loading` attribute set to `lazy`. For browser that support this HTML spec, the image's size value will be set to the concrete object size of the image. For browsers that don't support the spec, the word "auto" will be ignored when parsing the sizes value.

References:
- https://html.spec.whatwg.org/multipage/images.html#sizes-attributes
- whatwg/html#8008

Props mukesh27, flixos90, joemcgill, westonruter, peterwilsoncc.
Fixes #61847.

Built from https://develop.svn.wordpress.org/trunk@59008


git-svn-id: https://core.svn.wordpress.org/trunk@58404 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Add "auto sizes" for lazy-loaded images
8 participants