Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 208745c0c095eda0e5fa99542804b712d4fd26da
      
https://github.com/WebKit/WebKit/commit/208745c0c095eda0e5fa99542804b712d4fd26da
  Author: Rich <[email protected]>
  Date:   2026-06-01 (Mon, 01 Jun 2026)

  Changed paths:
    A 
LayoutTests/http/tests/scroll-to-text-fragment/prefix-word-bounded-at-doc-start-expected.html
    A 
LayoutTests/http/tests/scroll-to-text-fragment/prefix-word-bounded-at-doc-start.html
    M Source/WebCore/editing/TextIterator.cpp

  Log Message:
  -----------
  Text fragment can match a prefix that isn't word-bounded on left near start 
of document
https://bugs.webkit.org/show_bug.cgi?id=315536

Reviewed by Darin Adler.

The change makes the SearchBuffer::prependContext function live up to its name 
and prepend context instead of appending context. Prior to the change, that 
appending could leave the buffer sent to isWordStartMatch in the wrong order. 
That resulted in the wrong character being examined for a word boundary, which 
caused acceptance of a match that should've been rejected. The fix properly 
inserts into the front of the buffer so that the characters sent to 
isWordStartMatch are in the correct order, and that fixes the boundary check so 
that it properly rejects that non-bounded pattern.

Test: http/tests/scroll-to-text-fragment/prefix-word-bounded-at-doc-start.html

* 
LayoutTests/http/tests/scroll-to-text-fragment/prefix-word-bounded-at-doc-start-expected.html:
 Added.
* 
LayoutTests/http/tests/scroll-to-text-fragment/prefix-word-bounded-at-doc-start.html:
 Added.
* Source/WebCore/editing/TextIterator.cpp:
(WebCore::prepend):
(WebCore::SearchBuffer::prependContext): Insert the gathered context at front 
of buffer instead of appending to end.

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to