Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 8d8bd7b533234d8443a92ab4690b4099205ab3fc
https://github.com/WebKit/WebKit/commit/8d8bd7b533234d8443a92ab4690b4099205ab3fc
Author: Ahmad Saleem <[email protected]>
Date: 2026-04-20 (Mon, 20 Apr 2026)
Changed paths:
M LayoutTests/http/tests/preload/picture-type-expected.txt
M LayoutTests/http/tests/preload/picture-type.html
M Source/WebCore/html/HTMLImageElement.cpp
M Source/WebCore/html/HTMLImageElement.h
M Source/WebCore/html/parser/HTMLPreloadScanner.cpp
Log Message:
-----------
Preload scanner should not skip <source> with empty type attribute in
<picture>
https://bugs.webkit.org/show_bug.cgi?id=312695
rdar://175094037
Reviewed by Chris Dumez.
The preload scanner passed the raw type attribute value directly to
isSupportedImageVideoOrSVGMIMEType(), which returns false for empty
strings. This caused <source> elements with type="" or type=" " to be
skipped during preloading, even though the main rendering path in
bestFitSourceFromPictureElement() correctly treats them as having no
type constraint.
Add HTMLImageElement::isSupportedImageSourceType() as a shared helper
that extracts the MIME type from the type attribute (trimming whitespace
and stripping parameters after ';') and returns true when the result is
empty. Both bestFitSourceFromPictureElement() and the preload scanner
now call this single function, matching other browser engine (i.e. Blink).
* LayoutTests/http/tests/preload/picture-type-expected.txt:
* LayoutTests/http/tests/preload/picture-type.html:
* Source/WebCore/html/HTMLImageElement.cpp:
(WebCore::HTMLImageElement::isSupportedImageSourceType):
(WebCore::HTMLImageElement::bestFitSourceFromPictureElement):
* Source/WebCore/html/HTMLImageElement.h:
* Source/WebCore/html/parser/HTMLPreloadScanner.cpp:
(WebCore::TokenPreloadScanner::StartTagScanner::processAttribute):
Canonical link: https://commits.webkit.org/311568@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications