Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 06d1695c9a81233d9f279c8983122dd8909a02e5
https://github.com/WebKit/WebKit/commit/06d1695c9a81233d9f279c8983122dd8909a02e5
Author: Ahmad Saleem <[email protected]>
Date: 2026-07-17 (Fri, 17 Jul 2026)
Changed paths:
M
Source/WebCore/layout/integration/inline/LayoutIntegrationInlineContent.cpp
Log Message:
-----------
shrinkToFit() operates on a temporary copy in
InlineContent::nonRootInlineBoxIndexesForLayoutBox()
https://bugs.webkit.org/show_bug.cgi?id=319724
rdar://182557883
Reviewed by Alan Baradlay.
When building the inline box index cache, the loop that trims each
vector's excess capacity iterated the HashMap by value:
for (auto entry : *m_inlineBoxIndexCache)
entry.value.shrinkToFit();
Since InlineBoxIndexCache is a HashMap<CheckedRef<const Layout::Box>,
Vector<size_t>>, `auto entry` copies each key-value pair, so shrinkToFit()
trims a throwaway copy of the vector while the vector stored in the map
keeps its over-allocated capacity. The optimization was a no-op, and each
iteration paid for a needless copy of the vector (plus CheckedRef churn).
Iterate by reference so shrinkToFit() acts on the stored vector.
* Source/WebCore/layout/integration/inline/LayoutIntegrationInlineContent.cpp:
(WebCore::LayoutIntegration::InlineContent::nonRootInlineBoxIndexesForLayoutBox
const):
Canonical link: https://commits.webkit.org/317456@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications