Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 635808d7603e771d21ea17bccf831aa917ad5b5a
https://github.com/WebKit/WebKit/commit/635808d7603e771d21ea17bccf831aa917ad5b5a
Author: Cole Carley <[email protected]>
Date: 2026-03-02 (Mon, 02 Mar 2026)
Changed paths:
A
LayoutTests/editing/text-iterator/findString-selection-disabled-multiple-expected.txt
A
LayoutTests/editing/text-iterator/findString-selection-disabled-multiple.html
M Source/WebCore/editing/Editor.cpp
Log Message:
-----------
Fix find in page for content with -webkit-user-select: none
rdar://85000322
https://bugs.webkit.org/show_bug.cgi?id=307877
Reviewed by Ryosuke Niwa and Megan Gardner.
The find-in-page feature relies on the selection API for finding strings. If
a string is found and it looks to be the same selection as the last found
string,
it will redo the search.
The selection api will collapse user-select: none text, so when you have two
matches
in a user-select: none block, both matches will be collapsed to the same point.
Because they are the same point, they look like the same selection, and the
match
is skipped. To address this, I saved the start and end positions BEFORE
canonicalization, which represent the positions before adjusting to account for
user-select: none. Then, these saved points are used when comparing found
strings.
* Source/WebCore/editing/Editor.cpp:
(WebCore::Editor::findString):
(WebCore::Editor::rangeOfString):
* Source/WebCore/editing/VisibleSelection.cpp:
(WebCore::VisibleSelection::rawRange const):
(WebCore::VisibleSelection::setBaseAndExtentToDeepEquivalents):
* Source/WebCore/editing/VisibleSelection.h:
(WebCore::VisibleSelection::rawStart const):
(WebCore::VisibleSelection::rawEnd const):
Canonical link: https://commits.webkit.org/308508@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications