https://bugs.webkit.org/show_bug.cgi?id=228700
rdar://81210248
Reviewed by Tim Horton.
Source/WebCore:
Make a couple of small adjustments to allow the cursor to change to an I-beam when hovering over selectable Live
Text inside images in links, but only in the case where the computed cursor type is Auto. Currently, this always
results in a Hand cursor type because of the link ancestor, despite the injected Live Text being selectable.
Test: fast/images/text-recognition/mac/cursor-types-for-recognized-text.html
* html/HTMLElement.cpp:
(WebCore::HTMLElement::updateWithTextRecognitionResult):
Drive-by fix an adjacent bug, wherein we try to check whether the image element has `user-select: none;` before
the style has been resolved, which results in injecting selectable Live Text even when the page has explicitly
disabled text selection on the image element. Instead, move this code to right after we update layout after
ensuring the UA shadow DOM structure for Live Text, so that the bool flag is meaningful.
* page/EventHandler.cpp:
(WebCore::EventHandler::selectCursor):
LayoutTests:
Add a layout test that hovers over Live Text in several different image elements, and checks their respective
cursor types.
* fast/images/text-recognition/mac/cursor-types-for-recognized-text-expected.txt: Added.
* fast/images/text-recognition/mac/cursor-types-for-recognized-text.html: Added.
Canonical link: https://commits.webkit.org/240175@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280548 268f45cc-cd09-0410-ab3c-d52691b4dbfc