Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 8379f89080920297b5d796680d647b4319dfbed7
      
https://github.com/WebKit/WebKit/commit/8379f89080920297b5d796680d647b4319dfbed7
  Author: Ahmad Saleem <[email protected]>
  Date:   2026-09-10 (Thu, 10 Sep 2026)

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

  Log Message:
  -----------
  Adopt Vector::moveTo in TextTrackCueList::updateCueIndex
https://bugs.webkit.org/show_bug.cgi?id=323844
rdar://187081956

Reviewed by Chris Dumez.

updateCueIndex() repositions a single cue whose sort key changed back into
its sorted slot. It located the target with two upper_bound probes -- one over
the cues before the moved cue, one over those after -- and then shifted the run
between the old and new positions with std::rotate(), plus std::to_address()
bookkeeping to compare the raw iterators against the cue's current position.

That is exactly the "relocate the element at one index to another" operation
Vector::moveTo() was added for (320527@main). Rewrite updateCueIndex() to keep
the same two upper_bound probes but perform the reposition with a single
moveTo() call per branch: moveTo(cueIndex, earlier) when the cue moved toward
the front, moveTo(cueIndex, cueIndex + offset) when it moved toward the back.
Both computed positions are in bounds and differ from cueIndex, so moveTo()'s
bounds and same-position handling apply. Since Ref<TextTrackCue> moves with
memcpy, moveTo() collapses to one bounded memmove instead of std::rotate()'s
swap sequence.

Reading is now done through a const span() rather than mutableSpan() with a raw
cuePosition iterator, since moveTo() owns the mutation.

* Source/WebCore/html/track/TextTrackCueList.cpp:
(WebCore::TextTrackCueList::updateCueIndex):

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



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

Reply via email to