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

  Changed paths:
    M Source/WebCore/html/track/TextTrackList.cpp

  Log Message:
  -----------
  TextTrackList::getTrackById iterates via length()/item() instead of walking 
track vectors directly
https://bugs.webkit.org/show_bug.cgi?id=319159
rdar://181978691

Reviewed by Jer Noble.

Both TextTrackList::getTrackById overloads looped `for (i = 0; i < length();
++i) item(i)`, which recomputed length() and re-did the three-way index
arithmetic (plus a downcast) in item() on every iteration. Since these
lookups run inside SourceBuffer's per-segment-track loops, that cost
compounds during initialization segment processing.

Iterate the three member track vectors
(m_elementTracks, m_addTrackTracks,
m_inbandTracks) directly, in the same element -> addTrack -> inband order
item() uses, so the "first matching TextTrack" semantics are preserved.
This matches the existing AudioTrackList and VideoTrackList implementations.

No change in behavior, so no new tests.

* Source/WebCore/html/track/TextTrackList.cpp:
(WebCore::TextTrackList::getTrackById const):

Canonical link: 
https://flagged.apple.com:443/proxy?t2=DZ6N9e4Dl2&o=aHR0cHM6Ly9jb21taXRzLndlYmtpdC5vcmcvMzE2OTc4QG1haW4=&emid=6c5af99a-0fb3-4eed-89a4-f6e39d521e8b&c=11



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

Reply via email to