Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: f463a6d642dd4ffc2f67cb369c3eabadd194a1f9
      
https://github.com/WebKit/WebKit/commit/f463a6d642dd4ffc2f67cb369c3eabadd194a1f9
  Author: Ahmad Saleem <[email protected]>
  Date:   2026-01-20 (Tue, 20 Jan 2026)

  Changed paths:
    M Source/WebCore/svg/animation/SVGSMILElement.cpp

  Log Message:
  -----------
  Modernize SVGSMILElement::findInstanceTime with std::lower_bound and iterators
https://bugs.webkit.org/show_bug.cgi?id=305711

Reviewed by Simon Fraser.

Replace custom approximateBinarySearch with std::lower_bound and refactor
the function to use modern C++ idioms including std::span and iterator-based
logic.

The previous implementation used WTF's approximateBinarySearch which had
unclear semantics - returning arbitrary matches for duplicates and either
the closest lesser or greater value when the key wasn't present. This
required manual index adjustments after the search to correct the result.

Merge (for above): 
https://chromium.googlesource.com/chromium/blink/+/fbc47251cc397c53bb458895436f9c33105aa3ed

In summary, this patch also does:
- Replaces approximateBinarySearch with std::lower_bound, which has
  well-defined semantics (first element not less than the search value).
- Uses a lambda comparator to avoid creating temporary objects.
- Refactors to use std::span for a cleaner view over the vector.
- Eliminates manual index arithmetic in favor of iterator-based logic.
- Replaces the final while loop with a range-based iterator loop.
- Removes the confusing post-search index correction that was needed
  with the old binary search implementation.

* Source/WebCore/svg/animation/SVGSMILElement.cpp:
(WebCore::SVGSMILElement::findInstanceTime const):
(WebCore::extractTimeFromVector): Deleted.

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



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

Reply via email to