-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Force size containment for auto-sizes #9493
Conversation
This may be somewhat off-topic (please feel free to redirect me, if so) but one aspect of the parsing algorithm is still unclear to me. If a platform (e.g. WordPress) generated image markup that looks like this (note the omission of a <img src="200.jpg" width="200" height="200" srcset="200.jpg 200w, 400.jpg 400w, 600.jpg 600w" sizes="auto, 200px" /> Would the omission of the loading attribute cause |
@joemcgill right now, the intent is that |
The 'concrete object size ignoring natural dimensions' concept was not implementable. This change makes `sizes=auto` required on `img` to use auto-sizes (still optional on `source`) and forces size containment so that the image size is the same before and after an image has loaded, to prevent double downloads. Fixes #9448.
bdf7972
to
e90b823
Compare
I wrote tests for the UA stylesheet in web-platform-tests/wpt#41817 I pushed 1b6f84a to fix #9648 and #9649. Still need to write tests for the sizes parser changes. |
@zcorpan any idea why PR preview is failing here? What's the best way to retry it? |
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.
I've done an editorial review and tried to ensure this PR does what it claims, but I have not gone through the history of #9448 to understand this deeply. I trust that prospective implementers will evaluate the implementability when reviewing this.
1b6f84a
to
5ee976b
Compare
Also update tests in size-auto to match spec update: whatwg/html#9493 Spec: https://html.spec.whatwg.org/#parsing-a-sizes-attribute https://whatpr.org/html/9493/images.html#parsing-a-sizes-attribute R=pdr Bug: 1359051 Change-Id: I77ecbfef3a5a63101929f67025699550cc7f6413
Also update tests in size-auto to match spec update: whatwg/html#9493 Spec: https://html.spec.whatwg.org/#parsing-a-sizes-attribute https://whatpr.org/html/9493/images.html#parsing-a-sizes-attribute R=pdr Bug: 1359051 Change-Id: I77ecbfef3a5a63101929f67025699550cc7f6413
Also update tests in size-auto to match spec update: whatwg/html#9493 Spec: https://html.spec.whatwg.org/#parsing-a-sizes-attribute https://whatpr.org/html/9493/images.html#parsing-a-sizes-attribute R=pdr Bug: 1359051 Change-Id: I77ecbfef3a5a63101929f67025699550cc7f6413
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.
LGTM
Also update tests in size-auto to match spec update: whatwg/html#9493 Spec: https://html.spec.whatwg.org/#parsing-a-sizes-attribute https://whatpr.org/html/9493/images.html#parsing-a-sizes-attribute R=pdr Bug: 1359051 Change-Id: I77ecbfef3a5a63101929f67025699550cc7f6413
@tcaptan-cr has implemented this in Chromium and created remaining tests, see https://bugs.chromium.org/p/chromium/issues/detail?id=1359051 I believe this is ready to merge! |
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.
I've reviewed the changes since #9493 (review)
Also update tests in size-auto to match spec update: whatwg/html#9493 Spec: https://html.spec.whatwg.org/#parsing-a-sizes-attribute https://whatpr.org/html/9493/images.html#parsing-a-sizes-attribute R=pdr Bug: 1359051 Change-Id: I77ecbfef3a5a63101929f67025699550cc7f6413
Also update tests in size-auto to match spec update: whatwg/html#9493 Spec: https://html.spec.whatwg.org/#parsing-a-sizes-attribute https://whatpr.org/html/9493/images.html#parsing-a-sizes-attribute R=pdr Bug: 1359051 Change-Id: I77ecbfef3a5a63101929f67025699550cc7f6413 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5064461 Commit-Queue: Traian Captan <[email protected]> Reviewed-by: Philip Rogers <[email protected]> Cr-Commit-Position: refs/heads/main@{#1231380}
Also update tests in size-auto to match spec update: whatwg/html#9493 Spec: https://html.spec.whatwg.org/#parsing-a-sizes-attribute https://whatpr.org/html/9493/images.html#parsing-a-sizes-attribute R=pdr Bug: 1359051 Change-Id: I77ecbfef3a5a63101929f67025699550cc7f6413 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5064461 Commit-Queue: Traian Captan <[email protected]> Reviewed-by: Philip Rogers <[email protected]> Cr-Commit-Position: refs/heads/main@{#1231380}
Also update tests in size-auto to match spec update: whatwg/html#9493 Spec: https://html.spec.whatwg.org/#parsing-a-sizes-attribute https://whatpr.org/html/9493/images.html#parsing-a-sizes-attribute R=pdr Bug: 1359051 Change-Id: I77ecbfef3a5a63101929f67025699550cc7f6413 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5064461 Commit-Queue: Traian Captan <[email protected]> Reviewed-by: Philip Rogers <[email protected]> Cr-Commit-Position: refs/heads/main@{#1231380}
…>, a=testonly Automatic update from web-platform-tests HTML: test UA styles for <img sizes=auto> See whatwg/html#9493 -- wpt-commits: 0f673999acbd28c5584e03f61da96a30e38ac092 wpt-pr: 41817
…stonly Automatic update from web-platform-tests Add auto sizes wpt rendering tests Also update tests in size-auto to match spec update: whatwg/html#9493 Spec: https://html.spec.whatwg.org/#parsing-a-sizes-attribute https://whatpr.org/html/9493/images.html#parsing-a-sizes-attribute R=pdr Bug: 1359051 Change-Id: I77ecbfef3a5a63101929f67025699550cc7f6413 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5064461 Commit-Queue: Traian Captan <[email protected]> Reviewed-by: Philip Rogers <[email protected]> Cr-Commit-Position: refs/heads/main@{#1231380} -- wpt-commits: 5904d197e1d4318c4fefb12bf406c921fbd123f3 wpt-pr: 43385
…>, a=testonly Automatic update from web-platform-tests HTML: test UA styles for <img sizes=auto> See whatwg/html#9493 -- wpt-commits: 0f673999acbd28c5584e03f61da96a30e38ac092 wpt-pr: 41817
…stonly Automatic update from web-platform-tests Add auto sizes wpt rendering tests Also update tests in size-auto to match spec update: whatwg/html#9493 Spec: https://html.spec.whatwg.org/#parsing-a-sizes-attribute https://whatpr.org/html/9493/images.html#parsing-a-sizes-attribute R=pdr Bug: 1359051 Change-Id: I77ecbfef3a5a63101929f67025699550cc7f6413 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5064461 Commit-Queue: Traian Captan <[email protected]> Reviewed-by: Philip Rogers <[email protected]> Cr-Commit-Position: refs/heads/main@{#1231380} -- wpt-commits: 5904d197e1d4318c4fefb12bf406c921fbd123f3 wpt-pr: 43385
…>, a=testonly Automatic update from web-platform-tests HTML: test UA styles for <img sizes=auto> See whatwg/html#9493 -- wpt-commits: 0f673999acbd28c5584e03f61da96a30e38ac092 wpt-pr: 41817 UltraBlame original commit: fdb4314a7244387e3eab803734be403fd4d82471
…stonly Automatic update from web-platform-tests Add auto sizes wpt rendering tests Also update tests in size-auto to match spec update: whatwg/html#9493 Spec: https://html.spec.whatwg.org/#parsing-a-sizes-attribute https://whatpr.org/html/9493/images.html#parsing-a-sizes-attribute R=pdr Bug: 1359051 Change-Id: I77ecbfef3a5a63101929f67025699550cc7f6413 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5064461 Commit-Queue: Traian Captan <tcaptanchromium.org> Reviewed-by: Philip Rogers <pdrchromium.org> Cr-Commit-Position: refs/heads/main{#1231380} -- wpt-commits: 5904d197e1d4318c4fefb12bf406c921fbd123f3 wpt-pr: 43385 UltraBlame original commit: 5a6d84b529aebea9ea7277cc8a9aed89a7d2e349
…>, a=testonly Automatic update from web-platform-tests HTML: test UA styles for <img sizes=auto> See whatwg/html#9493 -- wpt-commits: 0f673999acbd28c5584e03f61da96a30e38ac092 wpt-pr: 41817 UltraBlame original commit: fdb4314a7244387e3eab803734be403fd4d82471
…stonly Automatic update from web-platform-tests Add auto sizes wpt rendering tests Also update tests in size-auto to match spec update: whatwg/html#9493 Spec: https://html.spec.whatwg.org/#parsing-a-sizes-attribute https://whatpr.org/html/9493/images.html#parsing-a-sizes-attribute R=pdr Bug: 1359051 Change-Id: I77ecbfef3a5a63101929f67025699550cc7f6413 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5064461 Commit-Queue: Traian Captan <tcaptanchromium.org> Reviewed-by: Philip Rogers <pdrchromium.org> Cr-Commit-Position: refs/heads/main{#1231380} -- wpt-commits: 5904d197e1d4318c4fefb12bf406c921fbd123f3 wpt-pr: 43385 UltraBlame original commit: 5a6d84b529aebea9ea7277cc8a9aed89a7d2e349
…>, a=testonly Automatic update from web-platform-tests HTML: test UA styles for <img sizes=auto> See whatwg/html#9493 -- wpt-commits: 0f673999acbd28c5584e03f61da96a30e38ac092 wpt-pr: 41817 UltraBlame original commit: fdb4314a7244387e3eab803734be403fd4d82471
…stonly Automatic update from web-platform-tests Add auto sizes wpt rendering tests Also update tests in size-auto to match spec update: whatwg/html#9493 Spec: https://html.spec.whatwg.org/#parsing-a-sizes-attribute https://whatpr.org/html/9493/images.html#parsing-a-sizes-attribute R=pdr Bug: 1359051 Change-Id: I77ecbfef3a5a63101929f67025699550cc7f6413 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5064461 Commit-Queue: Traian Captan <tcaptanchromium.org> Reviewed-by: Philip Rogers <pdrchromium.org> Cr-Commit-Position: refs/heads/main{#1231380} -- wpt-commits: 5904d197e1d4318c4fefb12bf406c921fbd123f3 wpt-pr: 43385 UltraBlame original commit: 5a6d84b529aebea9ea7277cc8a9aed89a7d2e349
…>, a=testonly Automatic update from web-platform-tests HTML: test UA styles for <img sizes=auto> See whatwg/html#9493 -- wpt-commits: 0f673999acbd28c5584e03f61da96a30e38ac092 wpt-pr: 41817
…stonly Automatic update from web-platform-tests Add auto sizes wpt rendering tests Also update tests in size-auto to match spec update: whatwg/html#9493 Spec: https://html.spec.whatwg.org/#parsing-a-sizes-attribute https://whatpr.org/html/9493/images.html#parsing-a-sizes-attribute R=pdr Bug: 1359051 Change-Id: I77ecbfef3a5a63101929f67025699550cc7f6413 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5064461 Commit-Queue: Traian Captan <[email protected]> Reviewed-by: Philip Rogers <[email protected]> Cr-Commit-Position: refs/heads/main@{#1231380} -- wpt-commits: 5904d197e1d4318c4fefb12bf406c921fbd123f3 wpt-pr: 43385
…>, a=testonly Automatic update from web-platform-tests HTML: test UA styles for <img sizes=auto> See whatwg/html#9493 -- wpt-commits: 0f673999acbd28c5584e03f61da96a30e38ac092 wpt-pr: 41817
…stonly Automatic update from web-platform-tests Add auto sizes wpt rendering tests Also update tests in size-auto to match spec update: whatwg/html#9493 Spec: https://html.spec.whatwg.org/#parsing-a-sizes-attribute https://whatpr.org/html/9493/images.html#parsing-a-sizes-attribute R=pdr Bug: 1359051 Change-Id: I77ecbfef3a5a63101929f67025699550cc7f6413 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5064461 Commit-Queue: Traian Captan <[email protected]> Reviewed-by: Philip Rogers <[email protected]> Cr-Commit-Position: refs/heads/main@{#1231380} -- wpt-commits: 5904d197e1d4318c4fefb12bf406c921fbd123f3 wpt-pr: 43385
…>, a=testonly Automatic update from web-platform-tests HTML: test UA styles for <img sizes=auto> See whatwg/html#9493 -- wpt-commits: 0f673999acbd28c5584e03f61da96a30e38ac092 wpt-pr: 41817 UltraBlame original commit: 5e6766903b9d6ff31473311f3e87774095251eda
…stonly Automatic update from web-platform-tests Add auto sizes wpt rendering tests Also update tests in size-auto to match spec update: whatwg/html#9493 Spec: https://html.spec.whatwg.org/#parsing-a-sizes-attribute https://whatpr.org/html/9493/images.html#parsing-a-sizes-attribute R=pdr Bug: 1359051 Change-Id: I77ecbfef3a5a63101929f67025699550cc7f6413 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5064461 Commit-Queue: Traian Captan <tcaptanchromium.org> Reviewed-by: Philip Rogers <pdrchromium.org> Cr-Commit-Position: refs/heads/main{#1231380} -- wpt-commits: 5904d197e1d4318c4fefb12bf406c921fbd123f3 wpt-pr: 43385 UltraBlame original commit: 4b7ff7848d33231d5746355ea34056b07ac6ed1d
…>, a=testonly Automatic update from web-platform-tests HTML: test UA styles for <img sizes=auto> See whatwg/html#9493 -- wpt-commits: 0f673999acbd28c5584e03f61da96a30e38ac092 wpt-pr: 41817 UltraBlame original commit: 5e6766903b9d6ff31473311f3e87774095251eda
…stonly Automatic update from web-platform-tests Add auto sizes wpt rendering tests Also update tests in size-auto to match spec update: whatwg/html#9493 Spec: https://html.spec.whatwg.org/#parsing-a-sizes-attribute https://whatpr.org/html/9493/images.html#parsing-a-sizes-attribute R=pdr Bug: 1359051 Change-Id: I77ecbfef3a5a63101929f67025699550cc7f6413 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5064461 Commit-Queue: Traian Captan <tcaptanchromium.org> Reviewed-by: Philip Rogers <pdrchromium.org> Cr-Commit-Position: refs/heads/main{#1231380} -- wpt-commits: 5904d197e1d4318c4fefb12bf406c921fbd123f3 wpt-pr: 43385 UltraBlame original commit: 4b7ff7848d33231d5746355ea34056b07ac6ed1d
…>, a=testonly Automatic update from web-platform-tests HTML: test UA styles for <img sizes=auto> See whatwg/html#9493 -- wpt-commits: 0f673999acbd28c5584e03f61da96a30e38ac092 wpt-pr: 41817 UltraBlame original commit: 5e6766903b9d6ff31473311f3e87774095251eda
…stonly Automatic update from web-platform-tests Add auto sizes wpt rendering tests Also update tests in size-auto to match spec update: whatwg/html#9493 Spec: https://html.spec.whatwg.org/#parsing-a-sizes-attribute https://whatpr.org/html/9493/images.html#parsing-a-sizes-attribute R=pdr Bug: 1359051 Change-Id: I77ecbfef3a5a63101929f67025699550cc7f6413 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5064461 Commit-Queue: Traian Captan <tcaptanchromium.org> Reviewed-by: Philip Rogers <pdrchromium.org> Cr-Commit-Position: refs/heads/main{#1231380} -- wpt-commits: 5904d197e1d4318c4fefb12bf406c921fbd123f3 wpt-pr: 43385 UltraBlame original commit: 4b7ff7848d33231d5746355ea34056b07ac6ed1d
The 'concrete object size ignoring natural dimensions' concept was not implementable. This change makes
sizes=auto
required onimg
to use auto-sizes (still optional onsource
) and forces size containment so that the image size is the same before and after an image has loaded, to prevent double downloads.Fixes #9448.
(See WHATWG Working Mode: Changes for more details.)
/embedded-content.html ( diff )
/images.html ( diff )
/rendering.html ( diff )