| Summary: | Better type handling in HTMLImageElement resource selection | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Ahmad Saleem <ahmad.saleem792> |
| Component: | Images | Assignee: | Nobody <webkit-unassigned> |
| Status: | NEW --- | ||
| Severity: | Normal | CC: | annevk, bfulgham, karlcow, ntim, sabouhallawa, webkit-bug-importer |
| Priority: | P2 | Keywords: | BrowserCompat, InRadar |
| Version: | WebKit Nightly Build | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
|
Description
Ahmad Saleem
2023-07-22 13:08:22 PDT
Or I am wrong and this is taking care of my question: https://searchfox.org/wubkat/source/Source/WebCore/html/HTMLImageElement.cpp#268 if (!type.isEmpty() && !MIMETypeRegistry::isSupportedImageVideoOrSVGMIMEType(type)) I recommend looking for tests in web-platform-tests or writing some to see how the type attribute is handled and whether that's consistent between browsers. Yes probably a couple of tests would help. And after quickly checking on WPT, I didn't find anything obvious testing the type attribute on the source element. Probably testing: # unknown string <picture> <source type='unknown_type' srcset="something.png 400w, something2.png 800w"> <img src="working_image.jpg"> </picture> # unknown string + a known one. <picture> <source type='unknown_type' srcset="something.png 400w, something2.png 800w"> <source type='image/jpeg' srcset="something.jpg 400w, something2.jpg 800w"> <img src="working_image.jpg"> </picture> # empty string <picture> <source type='' srcset="something.png 400w, something2.png 800w"> <img src="working_image.jpg"> </picture> # space string <picture> <source type='' srcset="something.png 400w, something2.png 800w"> <img src="working_image.jpg"> </picture> # different type <picture> <source type='image/webp' srcset="something.png 400w, something2.png 800w"> <img src="working_image.jpg"> </picture> etc. Note that there is https://wpt.fyi/results/media-source/mediasource-is-type-supported.html |