Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: dca7909abc1adcba44fa11379ae05c0833513ed4
https://github.com/WebKit/WebKit/commit/dca7909abc1adcba44fa11379ae05c0833513ed4
Author: Cole Carley <[email protected]>
Date: 2026-07-24 (Fri, 24 Jul 2026)
Changed paths:
M Source/WebCore/editing/CachedMatchFinder.cpp
M Source/WebCore/editing/CachedMatchFinder.h
M Source/WebCore/editing/Editor.cpp
M Source/WebCore/editing/Editor.h
M Source/WebCore/page/Page.cpp
M Source/WebKit/WebProcess/WebPage/FindController.cpp
Log Message:
-----------
Cache Find in Page Text Markers
https://bugs.webkit.org/show_bug.cgi?id=320032
rdar://182967087
Reviewed by Sammy Gill.
Find in Page text markers are removed and readded every time the
user finds a new match. We improve performance by only removing
and readding if the DOM or search criteria has changed.
Note that I had to decouple the counting and matching in Editor.h
for this to work. Editor::countMatchesForText and
Editor::markAllMatchesForText both use a common helper
Editor::findAllMatches, which calls into
CachedMatchFinder::findMatches. This simplifies the code, and
allows us the benefit of caching the markers, which out weighs
the cost of calling CachedMatchFinder::findMatches in the case
we that only count.
* Source/WebCore/editing/CachedMatchFinder.cpp:
(WebCore::CachedMatchFinder::findMatches):
(WebCore::CachedMatchFinder::clearTextBufferCache):
(WebCore::CachedMatchFinder::setMatchesMarked):
(WebCore::CachedMatchFinder::clearMatchesMarked):
(WebCore::CachedMatchFinder::matchesAreMarked const):
* Source/WebCore/editing/CachedMatchFinder.h:
* Source/WebCore/editing/Editor.cpp:
(WebCore::Editor::countMatchesForText):
(WebCore::Editor::textMatchMarkersWereCleared):
* Source/WebCore/editing/Editor.h:
* Source/WebCore/page/Page.cpp:
(WebCore::Page::unmarkAllTextMatches):
* Source/WebKit/WebProcess/WebPage/FindController.cpp:
(WebKit::FindController::countStringMatches):
(WebKit::FindController::markMatches):
(WebKit::FindController::updateFindUIAfterFindingAllMatches):
Canonical link: https://commits.webkit.org/317897@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications