Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: f64b87c276020871c1c34becc730b6d61b068a0f
https://github.com/WebKit/WebKit/commit/f64b87c276020871c1c34becc730b6d61b068a0f
Author: Yulun Wu <[email protected]>
Date: 2025-10-02 (Thu, 02 Oct 2025)
Changed paths:
M Source/WebCore/editing/Editor.cpp
M Source/WebCore/editing/TextIterator.cpp
M Source/WebCore/editing/TextIterator.h
Log Message:
-----------
[Text Matching] Improve performance of Editor::countMatchesForText
https://bugs.webkit.org/show_bug.cgi?id=299571
<rdar://160011859>
Reviewed by Ryosuke Niwa.
This PR improves the performance of countMatchesForText() by replacing
looped calls to findPlainText() to findAllPlainText() which finds all
matches in a single pass using forEachMatch.
This PR also inlines construction of SimpleRange instead of relying on
the expensive rangeForMatch() function used by findPlainText.
Finally, this PR allows us to countMatchesForText() while only constructing
a single iterator over the range, where as we were previously making very
expensive calls to rangeForMatch() and constructing/tearing down O(matches)
iterators to build our ranges.
https://searchfox.org/wubkat/source/Source/WebCore/editing/TextIterator.cpp#2662-2684
* Source/WebCore/editing/Editor.cpp:
(WebCore::Editor::countMatchesForText):
* Source/WebCore/page/Page.cpp:
(WebCore::Page::findTextMatches):
* Source/WebKit/WebProcess/WebPage/FindController.cpp:
(WebKit::FindController::countStringMatches):
(WebKit::FindController::findStringMatches):
Canonical link: https://commits.webkit.org/300894@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes