Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: d36ee39e96fea5b6118b75cbc7a3a1597d605f8a
      
https://github.com/WebKit/WebKit/commit/d36ee39e96fea5b6118b75cbc7a3a1597d605f8a
  Author: Ahmad Saleem <[email protected]>
  Date:   2026-07-17 (Fri, 17 Jul 2026)

  Changed paths:
    M Source/WebCore/layout/formattingContexts/inline/InlineLineBoxBuilder.cpp

  Log Message:
  -----------
  Avoid redundant copy and double hash lookup in 
LineBoxBuilder::collectFallbackFonts()
https://bugs.webkit.org/show_bug.cgi?id=319604
rdar://182433929

Reviewed by Alan Baradlay.

collectFallbackFonts() fetched the per-inline-box fallback font set with
HashMap::get() (which returns the SingleThreadWeakHashSet by value, copying
it), mutated the copy, then wrote it back with HashMap::set() when the size
changed. That is two hash lookups and two copies of the weak set on the line
layout path.

Use HashMap::ensure() to obtain a reference to the value in place and mutate
it directly, eliminating both the copies and the second lookup. This is not a
behavior change: the entry is only reached after the fallback font list is
known to be non-empty, and both read sites gate on
isEmptyIgnoringNullReferences(), so the (at most empty) entry ensure() may
create reads identically to a missing one.

* Source/WebCore/layout/formattingContexts/inline/InlineLineBoxBuilder.cpp:
(WebCore::Layout::LineBoxBuilder::collectFallbackFonts):

Canonical link: https://commits.webkit.org/317422@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to