Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 7bfe33497d6e15b8511f36daea4677daa11ec92c
https://github.com/WebKit/WebKit/commit/7bfe33497d6e15b8511f36daea4677daa11ec92c
Author: Megan Gardner <[email protected]>
Date: 2025-12-18 (Thu, 18 Dec 2025)
Changed paths:
M
LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/text-selection-expected.txt
M Source/WebCore/rendering/HitTestResult.cpp
M Source/WebCore/rendering/HitTestResult.h
M Source/WebCore/rendering/RenderObject.cpp
Log Message:
-----------
Dragging a selection into a pseudo element results in incorrect selection of
the host element.
https://bugs.webkit.org/show_bug.cgi?id=304434
rdar://142905243
Reviewed by Tim Nguyen.
We do not support selection in pseudo elements.
So when we drag a selection across a pseudo element,
and we set the inner node for the hit test, if
it is a pseudo element, we set the node to the
host element instead. However, when we do this,
we did nothing to set the localPoint in that element
to something that made sense.
In the following illustration, 'Pseudo' is a pseudo
element, 'Element' is the host element that is a
regular div otherwise.
Pseudo Element
^ ^
| |
When the cursor is at 'e' in Pseudo, and the element is
reset, the cursor is then effectively at the second 'e'
in Element.
If you started your selection after the first
'E' and dragged backwards, once you reached the 'e' in
Pseudo, you selection would be 'le', not just the first
'E' as you would expect.
To avoid this issue, when setting the local point
we check to see if the pseudo element identifier has been
set, and if so, we zero out the point instead of using the
offset that is not longer applicable.
Progressed imported/w3c/web-platform-tests/css/css-pseudo/text-selection.html
* Source/WebCore/rendering/HitTestResult.cpp:
(WebCore::HitTestResult::setLocalPoint):
* Source/WebCore/rendering/HitTestResult.h:
(WebCore::HitTestResult::setLocalPoint): Deleted.
* Source/WebCore/rendering/RenderObject.cpp:
(WebCore::RenderObject::updateHitTestResult const):
Canonical link: https://commits.webkit.org/304719@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications