Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 3e936c54fdd6e4bc82d98a23891c5d807ba27f77
https://github.com/WebKit/WebKit/commit/3e936c54fdd6e4bc82d98a23891c5d807ba27f77
Author: Chris Dumez <[email protected]>
Date: 2026-04-21 (Tue, 21 Apr 2026)
Changed paths:
M Source/WebCore/html/parser/HTMLPreloadScanner.cpp
M Source/WebCore/html/parser/HTMLSrcsetParser.cpp
M Source/WebCore/html/parser/HTMLSrcsetParser.h
M Source/WebCore/loader/LinkLoader.cpp
Log Message:
-----------
Avoid unnecessary AtomString creation in bestFitSourceForImageAttributes
callers
https://bugs.webkit.org/show_bug.cgi?id=312863
Reviewed by Darin Adler and Ryosuke Niwa.
bestFitSourceForImageAttributes() was taking `const AtomString&` for its
srcAttribute parameter, but only calls isNull(), isEmpty(), and passed it to
StringViewWithUnderlyingString — none of which require AtomString. Three of its
five callers constructed a temporary AtomString from a String just to satisfy
the
signature, which hashes the string and inserts it into the global atom table for
no benefit.
Change the parameter type to `const String&`. The two callers that already pass
AtomString (HTMLImageElement) work without changes via implicit conversion.
* Source/WebCore/html/parser/HTMLPreloadScanner.cpp:
(WebCore::TokenPreloadScanner::StartTagScanner::processAttributes):
* Source/WebCore/html/parser/HTMLSrcsetParser.cpp:
(WebCore::bestFitSourceForImageAttributes):
* Source/WebCore/html/parser/HTMLSrcsetParser.h:
(WebCore::bestFitSourceForImageAttributes):
* Source/WebCore/loader/LinkLoader.cpp:
(WebCore::LinkLoader::preloadIfNeeded):
Canonical link: https://commits.webkit.org/311751@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications