Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 99ba7bed33ec0c233af78158e583d78545d9a3e7
https://github.com/WebKit/WebKit/commit/99ba7bed33ec0c233af78158e583d78545d9a3e7
Author: Megan Gardner <[email protected]>
Date: 2026-08-06 (Thu, 06 Aug 2026)
Changed paths:
M
LayoutTests/imported/w3c/web-platform-tests/shadow-dom/HighlightRegistry-highlightsFromPoint-expected.txt
M Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml
M Source/WebCore/Modules/highlight/HighlightRegistry.cpp
M Source/WebCore/rendering/RenderObject.cpp
M Source/WebCore/rendering/RenderObject.h
Log Message:
-----------
[Custom Highlight] Support the shadowRoots option in
HighlightRegistry.highlightsFromPoint().
https://bugs.webkit.org/show_bug.cgi?id=321116
rdar://184150480
Reviewed by Ryosuke Niwa, Wenson Hsieh, and Abrar Rahman Protyasha.
Completes highlightsFromPoint() with shadow-tree support. A highlight range
whose content
lives inside a shadow tree is now only returned when every shadow root between
that content
and the document is listed in the options.shadowRoots argument; ranges reached
through an
unlisted shadow root are skipped. Reachability is determined by walking the
range's start
container up through containingShadowRoot()/host() to the document.
Hit-testing also switches from RenderObject::clientBorderAndTextRects() to a
new text-only
RenderObject::clientTextRects(). Custom highlights paint over text, not element
boxes,
but clientBorderAndTextRects() includes the border box of any fully-selected
element.
That caused a highlight whose range spans a block-level element (such as a
shadow host)
to report a spurious hit over that element's box on a line where no text of the
highlight
is actually painted. clientTextRects() returns only the text runs, matching
what is painted.
The new helper is an additive, guarded variant of the existing
borderAndTextRects() path, so
clientBorderAndTextRects()/absoluteBorderAndTextRects() callers are unaffected.
imported/w3c/web-platform-tests/shadow-dom/HighlightRegistry-highlightsFromPoint.html
*
LayoutTests/imported/w3c/web-platform-tests/shadow-dom/HighlightRegistry-highlightsFromPoint-expected.txt:
* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml:
* Source/WebCore/Modules/highlight/HighlightRegistry.cpp:
(WebCore::HighlightRegistry::highlightsFromPoint):
* Source/WebCore/rendering/RenderObject.cpp:
(WebCore::borderAndTextRects):
(WebCore::RenderObject::clientTextRects):
* Source/WebCore/rendering/RenderObject.h:
Canonical link: https://commits.webkit.org/318758@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications