Fix image preloading for <picture> elements with explicitly empty image types
HTMLPreloadScanner and HTMLImageElement were using slightly different logic to determine if an image type is supported. In particular, HTMLImageElement considered an empty image type as supported and HTMLPreloadScanner did not. In the following case, it'd result in HTMLPreloadScanner trying to preload a resource (.png) that will not be used by HTMLImageElement (it will use .avif): ``` <picture> <source srcset="images/test.avif" type=""> <img src="images/test.png"> </picture> ``` This CL adds a static method HTMLImageElement::SupportedImageType that is used by HTMLPreloadScanner to check if an image type is supported. Also, redundant checks for type emptiness are removed from HTMLImageElement. Fixed: 1141776 Change-Id: I89ed95c18bbbc86613f6b362ba935f428e1d05b2 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2494720 Commit-Queue: Alex Rudenko <alexrudenko@chromium.org> Reviewed-by:Fredrik Söderquist <fs@opera.com> Cr-Commit-Position: refs/heads/master@{#820206}
Showing
Please register or sign in to comment