Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 2b3618997e3d2ac35a41df8cf3fed94fd9dde423
      
https://github.com/WebKit/WebKit/commit/2b3618997e3d2ac35a41df8cf3fed94fd9dde423
  Author: Josh Hernandez <[email protected]>
  Date:   2026-07-09 (Thu, 09 Jul 2026)

  Changed paths:
    M Source/WebKit/Shared/WebFoundTextRange.cpp
    M Source/WebKit/Shared/WebFoundTextRange.h
    M Source/WebKit/Shared/WebFoundTextRange.serialization.in
    M Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
    M Source/WebKit/WebProcess/WebPage/WebFoundTextRangeController.cpp
    M Source/WebKit/WebProcess/WebPage/WebFoundTextRangeController.h
    A Tools/TestWebKitAPI/Resources/lots-of-text-and-video.html
    A Tools/TestWebKitAPI/Resources/video-with-caption-cues.html
    M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/FindInPage.mm

  Log Message:
  -----------
  Include video caption cues in Find-in-Page navigation on iOS
https://bugs.webkit.org/show_bug.cgi?id=318377
rdar://181166823

Reviewed by Aditya Keerthi and Cole Carley.

Make video caption text searchable in Find-in-Page on iOS and
let matches seek the video.

WebFoundTextRange now carries a cue variant (media element identifier, document 
offset,
seek time) so cue matches travel over IPC alongside DOM and PDF matches.

WebFoundTextRangeController now handles cues: it gathers cue matches during a
find, orders them by the media element's position in the document so they
interleave with page-text matches, seeks the video to the cue time when a cue
becomes the current match, scrolls the video into view, and reports the video's
bounds as the match rect.

WKContentViewInteraction now represents cue matches on iOS and orders them
together with DOM matches in document order, so Find-in-Page steps through page
text and captions in the order they appear on screen.

Adds API tests in FindInPage.mm: FindInPageVideoCaptionCues checks that caption
cues are returned interleaved with page-text matches, 
FindInPageVideoCaptionCuesInSubframe
covers cues in a same-origin subframe, and FindInPageVideoCaptionCueSeeksVideo
checks that highlighting a cue seeks the video to its start time while
highlighting page text does not.

* Source/WebKit/Shared/WebFoundTextRange.cpp:
(WebKit::WebFoundTextRange::CueData::hash const):
(WebKit::WebFoundTextRange::hash const):
(WebKit::operator<<):
* Source/WebKit/Shared/WebFoundTextRange.h:
* Source/WebKit/Shared/WebFoundTextRange.serialization.in:
* Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView offsetFromPosition:toPosition:]):
(+[WKFoundTextRange foundTextRangeWithWebFoundTextRange:]):
(-[WKFoundCueTextRange start]):
(-[WKFoundCueTextRange end]):
(-[WKFoundCueTextRange webFoundTextRange]):
(+[WKFoundCueTextPosition 
textPositionWithDocumentOffset:seekTimeMillis:order:]):
(+[WKFoundCueTextPosition 
textPositionWithDocumentOffset:seekTimeMilliseconds:order:]):
* Source/WebKit/WebProcess/WebPage/WebFoundTextRangeController.cpp:
(WebKit::WebFoundTextRangeController::findTextRangesForStringMatches):
(WebKit::WebFoundTextRangeController::mediaElementForCueRange const):
(WebKit::WebFoundTextRangeController::decorateTextRangeWithStyle):
(WebKit::WebFoundTextRangeController::scrollTextRangeToVisible):
(WebKit::WebFoundTextRangeController::requestRectForFoundTextRange):
(WebKit::WebFoundTextRangeController::redraw):
(WebKit::findCueMatchesInFrame):
* Source/WebKit/WebProcess/WebPage/WebFoundTextRangeController.h:
* Tools/TestWebKitAPI/Resources/lots-of-text-and-video.html: Added.
* Tools/TestWebKitAPI/Resources/video-with-caption-cues.html: Added.
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/FindInPage.mm:
(configurationWithFindInVideoEnabled):
(TEST(WebKit, FindInPageVideoCaptionCues)):
(currentTimeAfterHighlighting):
(TEST(WebKit, FindInPageVideoCaptionCueSeeksVideo)):
(TEST(WebKit, FindInPageVideoCaptionCuesInSubframe)):

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



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

Reply via email to