Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 4daa274dd30c8d0537ad986b8f720705f14acf5a
      
https://github.com/WebKit/WebKit/commit/4daa274dd30c8d0537ad986b8f720705f14acf5a
  Author: Megan Gardner <[email protected]>
  Date:   2025-02-19 (Wed, 19 Feb 2025)

  Changed paths:
    M 
LayoutTests/http/tests/scroll-to-text-fragment/generation-does-not-pass-block-boundaries-expected.txt
    A 
LayoutTests/http/tests/scroll-to-text-fragment/generation-prefix-and-suffix-in-different-blocks-expected.txt
    A 
LayoutTests/http/tests/scroll-to-text-fragment/generation-prefix-and-suffix-in-different-blocks.html
    M Source/WebCore/dom/FragmentDirectiveGenerator.cpp
    M Source/WebCore/dom/FragmentDirectiveUtilities.cpp
    M Source/WebCore/dom/FragmentDirectiveUtilities.h

  Log Message:
  -----------
  Copy Link to Highlight doesn't work when selecting text that is its own block 
and that text exists higher up in the document.
https://bugs.webkit.org/show_bug.cgi?id=287915
rdar://144392379

Reviewed by Wenson Hsieh.

The scroll to text fragment generation code has checked to make sure that the 
elements are within the same block. This is correct
but when we start the fragment at the visible position at the beginning of the 
selection, and the selection is at the beginning or
at the end of a block, then the is-same-block check will fail. What we really 
want to do is start at the end of the previous block.
Add beforeStartOfCurrentBlock and afterEndOfCurrentBlock to help facilitate 
this. Then the checks for if we are in the same block
are correct.

* 
LayoutTests/http/tests/scroll-to-text-fragment/generation-does-not-pass-block-boundaries-expected.txt:
* 
LayoutTests/http/tests/scroll-to-text-fragment/generation-prefix-and-suffix-in-different-blocks-expected.txt:
 Copied from 
LayoutTests/http/tests/scroll-to-text-fragment/generation-does-not-pass-block-boundaries-expected.txt.
* 
LayoutTests/http/tests/scroll-to-text-fragment/generation-prefix-and-suffix-in-different-blocks.html:
 Added.
* Source/WebCore/dom/FragmentDirectiveGenerator.cpp:
(WebCore::beforeStartOfCurrentBlock):
(WebCore::afterEndOfCurrentBlock):
(WebCore::FragmentDirectiveGenerator::generateFragmentDirective):

Canonical link: https://commits.webkit.org/290683@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to