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

  Changed paths:
    A 
LayoutTests/http/tests/scroll-to-text-fragment/generation-can-trim-leading-and-trailing-whitespace-expected.txt
    A 
LayoutTests/http/tests/scroll-to-text-fragment/generation-can-trim-leading-and-trailing-whitespace.html
    M Source/WebCore/dom/FragmentDirectiveGenerator.cpp
    M Source/WebCore/editing/TextIterator.h

  Log Message:
  -----------
  Selections that start or end in white space don't create text fragments.
https://bugs.webkit.org/show_bug.cgi?id=288547
rdar://145614181

Reviewed by Wenson Hsieh.

When trying to generate text fragments to attach to the URL,
we check to make sure that the fragment is the same range.
But when searching for fragments, we don't add white space at the
ends, we just find the end of the word. Therefore, if the
original selection starts or ends with whitespace, we will
never match that selection when looking for a fragment.
We can fix this by trimming whitespace off of the highlighted
range before making a fragment.

* Source/WebCore/dom/FragmentDirectiveGenerator.cpp:
(WebCore::startVisiblePositionForRangeRemovingLeadingWhitespace):
(WebCore::endVisiblePositionForRangeRemovingTrailingWhitespace):
(WebCore::FragmentDirectiveGenerator::generateFragmentDirective):
* Source/WebCore/editing/TextIterator.h:
(WebCore::BackwardsCharacterIterator::text const):

Canonical link: https://commits.webkit.org/291146@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