Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: ff9a8d3fa6f2b1379322620e12eca1ebeb06fc9c
https://github.com/WebKit/WebKit/commit/ff9a8d3fa6f2b1379322620e12eca1ebeb06fc9c
Author: Alan Baradlay <[email protected]>
Date: 2026-04-07 (Tue, 07 Apr 2026)
Changed paths:
A LayoutTests/editing/selection/first-letter-click-caret-expected.txt
A LayoutTests/editing/selection/first-letter-click-caret.html
M LayoutTests/platform/ios/TestExpectations
M Source/WebCore/rendering/RenderTextFragment.cpp
M Source/WebCore/rendering/RenderTextFragment.h
Log Message:
-----------
[first-letter] Hovering over ::first-letter text shows pointer cursor instead
of I-beam
https://bugs.webkit.org/show_bug.cgi?id=311587
Reviewed by Antti Koivisto.
The ::first-letter pseudo splits text into two renderers: an anonymous
first-letter text inside an anonymous ::first-letter inline, and a
remaining text fragment. When the mouse hovers over the first-letter
text, the hit test needs to find a DOM node to determine the cursor.
The anonymous first-letter text has no DOM node. The hit test walks up
the tree and lands on the containing block (e.g. the div), whose
renderer is a RenderBlock, not RenderText. The cursor logic only shows
I-beam for RenderText nodes, so it shows a pointer instead.
The fix: override nodeForHitTest in RenderTextFragment. When the
fragment is the anonymous first-letter text (no text node), resolve
to the DOM text node via the parent first-letter inline's remaining
text fragment. This gives the hit test a proper text node, so the
cursor logic recognizes it as selectable text and shows I-beam.
Test: editing/selection/first-letter-click-caret.html
* LayoutTests/editing/selection/first-letter-click-caret-expected.txt: Added.
* LayoutTests/editing/selection/first-letter-click-caret.html: Added.
* LayoutTests/platform/ios/TestExpectations:
* Source/WebCore/rendering/RenderTextFragment.cpp:
(WebCore::RenderTextFragment::nodeForHitTest const):
* Source/WebCore/rendering/RenderTextFragment.h:
Canonical link: https://commits.webkit.org/310730@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications