New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 813452 link

Starred by 9 users

Issue metadata

Status: Fixed
Owner:
Closed: Jan 16
Cc:
Components:
EstimatedDays: ----
NextAction: 2019-03-10
OS: ----
Pri: 1
Type: Feature

Blocking:
issue 803776



Sign in to add a comment

Implement imagesrcset and imagesizes attributes on link rel=preload

Project Member Reported by kinuko@chromium.org, Feb 19 2018

Issue description

Spec discussion: https://github.com/w3c/preload/issues/120

Looks like it's useful if sites can ask UA to selectively preload images like what we do for regular image loading with `srcset` and `sizes` attributes.

(Intent to implement is to be sent separately)

 

Comment 1 by kinuko@chromium.org, Feb 19 2018

Cc: kenjibaheux@chromium.org y...@yoav.ws
Sizes already has 2 meanings, one for image/source and one for link rel=icon.
It seems cleaner to just re-use the same attribute and its meaning for image/source.

But, I saw some complexity concerns in the github issue so for experiment purposes, we can temporarily use a new attribute (e.g. imgsizes as was suggested on the spec issue).

Comment 3 by kouhei@chromium.org, Feb 19 2018

I personally prefer to have different attribute, since it simplifies the implementation.
The rel=icon and img sizes attribute has two completely different value syntax.
Project Member

Comment 4 by bugdroid1@chromium.org, Feb 22 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/99d6dc1fc439451c9aff69ef32f29032f1b55859

commit 99d6dc1fc439451c9aff69ef32f29032f1b55859
Author: Kunihiko Sakamoto <ksakamoto@chromium.org>
Date: Thu Feb 22 02:24:55 2018

Add srcset/imgsizes support for <link rel=preload> in HTMLPreloadScanner

This patch implements srcset and imgsizes attributes support in
HTMLPreloadScanner, behind the Experimental Web Platform feature flag.

Note that the attribute name is temporary and may change as the spec
discussion progresses.

This CL also slightly changes how srcset attribute in <img> is
precessed; now the preload scanner always see only the first srcset=
attribute even if it's empty.

Bug:  813452 
Change-Id: If2571a75b6b4d6780e9902be3e8b2ef8d5d887bd
Reviewed-on: https://chromium-review.googlesource.com/923241
Reviewed-by: Kouhei Ueno <kouhei@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Commit-Queue: Kunihiko Sakamoto <ksakamoto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#538322}
[add] https://crrev.com/99d6dc1fc439451c9aff69ef32f29032f1b55859/third_party/WebKit/LayoutTests/http/tests/loading/link-preload-image-sizes-2x-expected.txt
[add] https://crrev.com/99d6dc1fc439451c9aff69ef32f29032f1b55859/third_party/WebKit/LayoutTests/http/tests/loading/link-preload-image-sizes-2x.html
[add] https://crrev.com/99d6dc1fc439451c9aff69ef32f29032f1b55859/third_party/WebKit/LayoutTests/http/tests/loading/link-preload-image-sizes-expected.txt
[add] https://crrev.com/99d6dc1fc439451c9aff69ef32f29032f1b55859/third_party/WebKit/LayoutTests/http/tests/loading/link-preload-image-sizes.html
[add] https://crrev.com/99d6dc1fc439451c9aff69ef32f29032f1b55859/third_party/WebKit/LayoutTests/http/tests/loading/link-preload-image-srcset-2x-expected.txt
[add] https://crrev.com/99d6dc1fc439451c9aff69ef32f29032f1b55859/third_party/WebKit/LayoutTests/http/tests/loading/link-preload-image-srcset-2x.html
[add] https://crrev.com/99d6dc1fc439451c9aff69ef32f29032f1b55859/third_party/WebKit/LayoutTests/http/tests/loading/link-preload-image-srcset-expected.txt
[add] https://crrev.com/99d6dc1fc439451c9aff69ef32f29032f1b55859/third_party/WebKit/LayoutTests/http/tests/loading/link-preload-image-srcset.html
[modify] https://crrev.com/99d6dc1fc439451c9aff69ef32f29032f1b55859/third_party/WebKit/Source/core/html/HTMLAttributeNames.json5
[modify] https://crrev.com/99d6dc1fc439451c9aff69ef32f29032f1b55859/third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.cpp
[modify] https://crrev.com/99d6dc1fc439451c9aff69ef32f29032f1b55859/third_party/WebKit/Source/platform/runtime_enabled_features.json5

Project Member

Comment 5 by bugdroid1@chromium.org, Feb 22 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/8eaae0b1d1c61b848ef3e40a052c0ee90287ca08

commit 8eaae0b1d1c61b848ef3e40a052c0ee90287ca08
Author: Kunihiko Sakamoto <ksakamoto@chromium.org>
Date: Thu Feb 22 06:23:08 2018

Add srcset/imgsizes support for <link rel=preload> in LinkLoader

This patch teaches LinkLoader to recognize srcset / imgsizes attributes
when preloading images.

This feature is behind the Experimental Web Platform feature flag. Also
note that the attribute name is temporary and may change as the spec
discussion progresses.

Bug:  813452 
Change-Id: I82770edd7a99ec328c3748f192f98cf9df0af274
Reviewed-on: https://chromium-review.googlesource.com/927930
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: Kouhei Ueno <kouhei@chromium.org>
Commit-Queue: Kunihiko Sakamoto <ksakamoto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#538365}
[add] https://crrev.com/8eaae0b1d1c61b848ef3e40a052c0ee90287ca08/third_party/WebKit/LayoutTests/external/wpt/preload/link-header-preload-srcset.html
[add] https://crrev.com/8eaae0b1d1c61b848ef3e40a052c0ee90287ca08/third_party/WebKit/LayoutTests/external/wpt/preload/link-header-preload-srcset.html.headers
[modify] https://crrev.com/8eaae0b1d1c61b848ef3e40a052c0ee90287ca08/third_party/WebKit/Source/core/html/LinkStyle.cpp
[modify] https://crrev.com/8eaae0b1d1c61b848ef3e40a052c0ee90287ca08/third_party/WebKit/Source/core/loader/LinkLoader.cpp
[modify] https://crrev.com/8eaae0b1d1c61b848ef3e40a052c0ee90287ca08/third_party/WebKit/Source/core/loader/LinkLoader.h
[modify] https://crrev.com/8eaae0b1d1c61b848ef3e40a052c0ee90287ca08/third_party/WebKit/Source/core/loader/LinkLoaderTest.cpp
[modify] https://crrev.com/8eaae0b1d1c61b848ef3e40a052c0ee90287ca08/third_party/WebKit/Source/platform/loader/LinkHeader.cpp
[modify] https://crrev.com/8eaae0b1d1c61b848ef3e40a052c0ee90287ca08/third_party/WebKit/Source/platform/loader/LinkHeader.h

Initial implementation is in, behind the chrome://flags/#enable-experimental-web-platform-features flag.

Current implementation uses "srcset" and "imgsizes", but note that these names are in flux / experimental. (See https://github.com/w3c/preload/issues/120)

Project Member

Comment 7 by bugdroid1@chromium.org, Mar 3 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/d557c31303b6c0993a6e9df388888a0ba090a87a

commit d557c31303b6c0993a6e9df388888a0ba090a87a
Author: Kouhei Ueno <kouhei@chromium.org>
Date: Sat Mar 03 14:41:28 2018

Mark link preload srcset tests as tentative

Bug:  813452 
Change-Id: I31e68cd13b258516db7eac83fc5e8758d3912f51
Reviewed-on: https://chromium-review.googlesource.com/946908
Reviewed-by: Yoav Weiss <yoav@yoav.ws>
Commit-Queue: Kouhei Ueno <kouhei@chromium.org>
Cr-Commit-Position: refs/heads/master@{#540749}
[rename] https://crrev.com/d557c31303b6c0993a6e9df388888a0ba090a87a/third_party/WebKit/LayoutTests/external/wpt/preload/link-header-preload-srcset.tentative.html
[rename] https://crrev.com/d557c31303b6c0993a6e9df388888a0ba090a87a/third_party/WebKit/LayoutTests/external/wpt/preload/link-header-preload-srcset.tentative.html.headers

Project Member

Comment 8 by bugdroid1@chromium.org, Mar 14 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/fe25ed29068d88b85ad60aaef164e7fa537c63ce

commit fe25ed29068d88b85ad60aaef164e7fa537c63ce
Author: Kunihiko Sakamoto <ksakamoto@chromium.org>
Date: Wed Mar 14 08:31:55 2018

Make srcset on link rel=preload work with SignedHTTPExchange flag too

<link rel=preload> will play an important role in signed-exchange
prefetching. This patch makes srcset/imgsizes on <link rel=preload> work
with the SignedHTTPExchange flag too (in addition to the Experimental
Web Platform features flag), so that people can easily try out it.

Bug: 803774, 813452 
Change-Id: I976d007c73b9cb5459d35e0e178f8d8d90484709
Reviewed-on: https://chromium-review.googlesource.com/961627
Reviewed-by: Kouhei Ueno <kouhei@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Commit-Queue: Kunihiko Sakamoto <ksakamoto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#543029}
[modify] https://crrev.com/fe25ed29068d88b85ad60aaef164e7fa537c63ce/content/child/runtime_features.cc
[modify] https://crrev.com/fe25ed29068d88b85ad60aaef164e7fa537c63ce/third_party/WebKit/Source/platform/exported/WebRuntimeFeatures.cpp
[modify] https://crrev.com/fe25ed29068d88b85ad60aaef164e7fa537c63ce/third_party/WebKit/public/platform/WebRuntimeFeatures.h

Cc: kinuko@chromium.org
Status update:

Explainer: https://docs.google.com/document/d/1wob4u9AER1kmUodqIEp78BuziSJChBl54A5ZRXPRCUI/edit?usp=sharing
Intent to Implement: https://groups.google.com/a/chromium.org/forum/?utm_medium=email&utm_source=footer#!msg/blink-dev/8tVgAyS47y0/e9L-NbatBwAJ
Spec discussion: https://github.com/w3c/preload/issues/120

Behind-the-flag implementation and WPT tests landed. Next steps:

1. Have draft spec in https://w3c.github.io/preload/
2. Request TAG review
3. Send Intent-to-Ship

Cc: domfarolino@gmail.com jasonjmi...@chromium.org
ksakamoto@ I noticed the new attributes introduced are not added as IDL attributes (via html_link_element.idl under a REF). Is the plan to eventually make them IDL attributes as well, similar to the already-existing `sizes` attribute? Asking so I know how this'll be spec'ed.
Ah good catch, not adding them was an oversight.

Yes these should be IDL attributes. Thanks!

Project Member

Comment 13 by bugdroid1@chromium.org, Nov 26

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/60e8ad52c5eb92b813acd3804d789c39ca746729

commit 60e8ad52c5eb92b813acd3804d789c39ca746729
Author: Kunihiko Sakamoto <ksakamoto@chromium.org>
Date: Mon Nov 26 07:57:28 2018

Rename srcset/imgsizes link attributes to imagesrcset/imagesizes

This patch renames "srcset" and "imgsizes" attributes on link
to "imagesrcset" and "imagesizes" respectively, to match the latest
spec PR [1].

Note: this feature is behind experimental-web-platform-features flag.

[1] https://github.com/whatwg/html/pull/4048

Bug:  813452 
Change-Id: I8eabfbd734e2f29e36b7f7a3c4a32f1237b042b1
Reviewed-on: https://chromium-review.googlesource.com/c/1350414
Reviewed-by: Kouhei Ueno <kouhei@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Commit-Queue: Kunihiko Sakamoto <ksakamoto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#610782}
[modify] https://crrev.com/60e8ad52c5eb92b813acd3804d789c39ca746729/third_party/blink/renderer/core/html/html_attribute_names.json5
[modify] https://crrev.com/60e8ad52c5eb92b813acd3804d789c39ca746729/third_party/blink/renderer/core/html/link_style.cc
[modify] https://crrev.com/60e8ad52c5eb92b813acd3804d789c39ca746729/third_party/blink/renderer/core/html/parser/html_preload_scanner.cc
[modify] https://crrev.com/60e8ad52c5eb92b813acd3804d789c39ca746729/third_party/blink/renderer/core/loader/link_loader.cc
[modify] https://crrev.com/60e8ad52c5eb92b813acd3804d789c39ca746729/third_party/blink/renderer/core/loader/link_loader.h
[modify] https://crrev.com/60e8ad52c5eb92b813acd3804d789c39ca746729/third_party/blink/renderer/core/loader/link_loader_test.cc
[modify] https://crrev.com/60e8ad52c5eb92b813acd3804d789c39ca746729/third_party/blink/renderer/platform/loader/link_header.cc
[modify] https://crrev.com/60e8ad52c5eb92b813acd3804d789c39ca746729/third_party/blink/renderer/platform/loader/link_header.h
[modify] https://crrev.com/60e8ad52c5eb92b813acd3804d789c39ca746729/third_party/blink/web_tests/external/wpt/preload/link-header-preload-srcset.tentative.html
[modify] https://crrev.com/60e8ad52c5eb92b813acd3804d789c39ca746729/third_party/blink/web_tests/external/wpt/preload/link-header-preload-srcset.tentative.html.headers
[modify] https://crrev.com/60e8ad52c5eb92b813acd3804d789c39ca746729/third_party/blink/web_tests/http/tests/loading/link-preload-image-sizes-2x.html
[modify] https://crrev.com/60e8ad52c5eb92b813acd3804d789c39ca746729/third_party/blink/web_tests/http/tests/loading/link-preload-image-sizes.html
[modify] https://crrev.com/60e8ad52c5eb92b813acd3804d789c39ca746729/third_party/blink/web_tests/http/tests/loading/link-preload-image-srcset-2x-expected.txt
[modify] https://crrev.com/60e8ad52c5eb92b813acd3804d789c39ca746729/third_party/blink/web_tests/http/tests/loading/link-preload-image-srcset-2x.html
[modify] https://crrev.com/60e8ad52c5eb92b813acd3804d789c39ca746729/third_party/blink/web_tests/http/tests/loading/link-preload-image-srcset-expected.txt
[modify] https://crrev.com/60e8ad52c5eb92b813acd3804d789c39ca746729/third_party/blink/web_tests/http/tests/loading/link-preload-image-srcset.html

Project Member

Comment 15 by bugdroid1@chromium.org, Dec 6

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/10bb83df93723eeecec3590fdf14904adf835795

commit 10bb83df93723eeecec3590fdf14904adf835795
Author: Kunihiko Sakamoto <ksakamoto@chromium.org>
Date: Thu Dec 06 03:10:20 2018

Defer preloads with imagesrcset/imagesizes until the first chunk is parsed

Preloads from link headers with the media attribute are deferred until
the first chunk of the document is parsed, so that ViewportDescription
from the preload scanner can be taken into account. Preloads with
imagesrcset or imagesizes depend on the viewport, so such preloads
should be deferred as well.

Note: This applies to only preloads dispatched by DocumentLoader. Link
rel=preload headers from subresources (e.g. prefetch) are not deferred
even if they have media/imagesrcset/imagesizes attributes.

Bug:  813452 
Change-Id: Iccc6ec12cf5bd53b71824463378c854cbd23a5ba
Reviewed-on: https://chromium-review.googlesource.com/c/1360193
Reviewed-by: Dominic Farolino <domfarolino@gmail.com>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: Yoav Weiss <yoavweiss@chromium.org>
Commit-Queue: Kunihiko Sakamoto <ksakamoto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#614253}
[modify] https://crrev.com/10bb83df93723eeecec3590fdf14904adf835795/third_party/blink/renderer/core/loader/link_loader.cc
[modify] https://crrev.com/10bb83df93723eeecec3590fdf14904adf835795/third_party/blink/renderer/platform/loader/link_header.h
[add] https://crrev.com/10bb83df93723eeecec3590fdf14904adf835795/third_party/blink/web_tests/http/tests/preload/meta-viewport-link-headers-imagesrcset.html
[add] https://crrev.com/10bb83df93723eeecec3590fdf14904adf835795/third_party/blink/web_tests/http/tests/preload/resources/media-link-headers-imagesrcset.php

Project Member

Comment 16 by bugdroid1@chromium.org, Dec 7

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/d7692e1f3e7a07d088557a8c765d9218775daaf7

commit d7692e1f3e7a07d088557a8c765d9218775daaf7
Author: Kunihiko Sakamoto <ksakamoto@chromium.org>
Date: Fri Dec 07 04:37:49 2018

Fix length calculation in imagesizes when <meta> viewport is present

This fixes a bug where "vw" length calculation of imagesizes attribute
coming from Link rel=preload header did not reflect the content
width from <meta name=viewport>.

MediaValuesDynamic::ComputeLength() did not use overridden viewport
dimensions.

Bug:  813452 
Change-Id: Icbc8f124e552b681bfffa80f407543078f851ed3
Reviewed-on: https://chromium-review.googlesource.com/c/1365051
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Commit-Queue: Kunihiko Sakamoto <ksakamoto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#614594}
[modify] https://crrev.com/d7692e1f3e7a07d088557a8c765d9218775daaf7/third_party/blink/renderer/core/css/media_values_dynamic.cc
[modify] https://crrev.com/d7692e1f3e7a07d088557a8c765d9218775daaf7/third_party/blink/web_tests/http/tests/preload/meta-viewport-link-headers-imagesrcset.html
[modify] https://crrev.com/d7692e1f3e7a07d088557a8c765d9218775daaf7/third_party/blink/web_tests/http/tests/preload/resources/media-link-headers-imagesrcset.php

Summary: Implement imagesrcset and imagesizes attributes on link rel=preload (was: Implement srcset and sizes (or imgsizes) attributes on preload)
Project Member

Comment 18 by bugdroid1@chromium.org, Dec 21

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/2cdce56d51dd48b27774907f062ae3f469c0df6d

commit 2cdce56d51dd48b27774907f062ae3f469c0df6d
Author: Kunihiko Sakamoto <ksakamoto@chromium.org>
Date: Fri Dec 21 05:01:35 2018

imagesrcset / imagesizes: Fix candidate selection when imagesizes is absent

This fixes a bug where image source size is calculated to be zero when
<link rel=preload imagesrcset=...> does not have an imagesizes attribute.

If imagesizes attribute is absent or does not have a valid value, it
should be treated as "100vw" [1]. In HTMLPreloadScanner, this is done by
initializing |source_size_| in the StartTagScanner constructor, but we
did not do that for <link> tags.

[1] https://html.spec.whatwg.org/multipage/images.html#parsing-a-sizes-attribute

Bug:  813452 
Change-Id: Ib7609c7de2a305d3e7ca142c9ce7f0c5f8cf7e3a
Reviewed-on: https://chromium-review.googlesource.com/c/1388047
Reviewed-by: Kouhei Ueno <kouhei@chromium.org>
Commit-Queue: Kunihiko Sakamoto <ksakamoto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#618462}
[modify] https://crrev.com/2cdce56d51dd48b27774907f062ae3f469c0df6d/third_party/blink/renderer/core/html/parser/html_preload_scanner.cc
[modify] https://crrev.com/2cdce56d51dd48b27774907f062ae3f469c0df6d/third_party/blink/web_tests/http/tests/loading/link-preload-image-sizes-expected.txt
[modify] https://crrev.com/2cdce56d51dd48b27774907f062ae3f469c0df6d/third_party/blink/web_tests/http/tests/loading/link-preload-image-sizes.html

Comment 20 by ksakamoto@chromium.org, Jan 16 (3 days ago)

Labels: M-73
NextAction: 2019-03-10
Status: Fixed (was: Assigned)
Enabled by default in M73.

Setting NextAction date for flag removal.

Sign in to add a comment