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

  Changed paths:
    A LayoutTests/media/track/text-track-find-preferred-language-expected.txt
    A LayoutTests/media/track/text-track-find-preferred-language.html
    M Source/WebCore/dom/Document.cpp
    M Source/WebCore/html/HTMLMediaElement.cpp
    M Source/WebCore/html/HTMLMediaElement.h
    M Source/WebCore/page/Page.cpp
    M Source/WebCore/page/Page.h
    M Source/WebCore/testing/Internals.cpp
    M Source/WebCore/testing/Internals.h
    M Source/WebCore/testing/Internals.idl
    M Source/WebKit/WebProcess/WebPage/FindController.cpp
    M Source/WebKit/WebProcess/WebPage/WebFoundTextRangeController.cpp

  Log Message:
  -----------
  Find in Page can’t find any matches for a video’s captions when turned off
https://bugs.webkit.org/show_bug.cgi?id=320455
rdar://183422611

Reviewed by Eric Carlson.

Find in Page only searched caption tracks that were already showing,so
a word spoken in a video wasn't findable unless the user first turned captions 
on.
Now the cue search lives on HTMLMediaElement.

When a find query runs and no caption or subtitle track is showing,
the element shows the best one, ranked by the user's preferred caption
languages and then the author's default track, so its cues can be searched.
The track's previous mode is restored when Find is dismissed. If a track
is already showing, that one is searched instead.

Adds a layout test that, with captions off, searches across three preferred
languages and confirms Find shows the highest-priority track while searching and
restores it to off when cleared. It also confirms a track the user already has
showing is searched as-is and left untouched.

* Source/WebCore/dom/Document.cpp:
(WebCore::Document::findCueMatches):
* Source/WebCore/html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::removeTextTrack):
(WebCore::isSubtitleOrCaptionTrackKind):
(WebCore::HTMLMediaElement::hasShowingFindSearchableTextTrackExcept const):
(WebCore::HTMLMediaElement::bestFindCaptionTrack const):
(WebCore::HTMLMediaElement::updateFindCaptionTrack):
(WebCore::HTMLMediaElement::clearFindCaptionTrack):
(WebCore::HTMLMediaElement::findCueMatches):
* Source/WebCore/html/HTMLMediaElement.h:
* Source/WebCore/page/Page.cpp:
(WebCore::Page::clearFindCaptionTracks):
* Source/WebCore/page/Page.h:
* Source/WebKit/WebProcess/WebPage/FindController.cpp:
(WebKit::FindController::hideFindUI):
* Source/WebKit/WebProcess/WebPage/WebFoundTextRangeController.cpp:
(WebKit::WebFoundTextRangeController::clearAllDecoratedFoundText):
* LayoutTests/media/track/text-track-find-preferred-language-expected.txt: 
Added.
* LayoutTests/media/track/text-track-find-preferred-language.html: Added.
* Source/WebCore/testing/Internals.cpp:
(WebCore::Internals::clearFindCaptionTracks):
* Source/WebCore/testing/Internals.h:
* Source/WebCore/testing/Internals.idl:

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



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

Reply via email to