Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 0f96b26db8ad2125cb066fc544ee76f7b0cc93c8
https://github.com/WebKit/WebKit/commit/0f96b26db8ad2125cb066fc544ee76f7b0cc93c8
Author: Megan Gardner <[email protected]>
Date: 2026-07-06 (Mon, 06 Jul 2026)
Changed paths:
A
LayoutTests/http/tests/scroll-to-text-fragment/generation-inside-display-contents-expected.txt
A
LayoutTests/http/tests/scroll-to-text-fragment/generation-inside-display-contents-start-and-end-expected.txt
A
LayoutTests/http/tests/scroll-to-text-fragment/generation-inside-display-contents-start-and-end.html
A
LayoutTests/http/tests/scroll-to-text-fragment/generation-inside-display-contents.html
M Source/WebCore/dom/FragmentDirectiveRangeFinder.cpp
Log Message:
-----------
REGRESSION(310112@main): Copy link with highlight just uses the original page
link
https://bugs.webkit.org/show_bug.cgi?id=318741
rdar://178547114
Reviewed by Tim Horton and Abrar Rahman Protyasha.
The range finder skips anything in a "search-invisible" subtree, and it wrongly
counted display:contents as invisible: such an element has no renderer (so no
RenderStyle)
even though its subtree is rendered and searchable. This latent bug only bites
the *second* search the finder runs, because the first one starts at the top of
the
document and findPlainText locates the text before the block walk's skip
matters.
That's why 310112@main exposed it: dropping the inline limit from 300 to 100
turned
these mid-length selections into start+end text instead of one inlined string,
and the
end-text search begins inside the display:contents subtree (right after the
start
match) where the whole subtree gets skipped -- so we never find the end and
fall back
to the plain page URL. GitHub wraps pull-request content in display:contents
wrappers,
which is why it shows up there. Fix: don't treat display:contents as
search-invisible.
Test: http/tests/scroll-to-text-fragment/generation-inside-display-contents.html
*
LayoutTests/http/tests/scroll-to-text-fragment/generation-inside-display-contents-expected.txt:
Added.
*
LayoutTests/http/tests/scroll-to-text-fragment/generation-inside-display-contents-start-and-end-expected.txt:
Added.
*
LayoutTests/http/tests/scroll-to-text-fragment/generation-inside-display-contents-start-and-end.html:
Added.
*
LayoutTests/http/tests/scroll-to-text-fragment/generation-inside-display-contents.html:
Added.
* Source/WebCore/dom/FragmentDirectiveRangeFinder.cpp:
(WebCore::FragmentDirectiveRangeFinder::isSearchInvisible):
Canonical link: https://commits.webkit.org/316597@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications