[webkit-changes] [WebKit/WebKit] ddae86: Scroll To Text Fragment Text Directives don't find...

megangardner noreply at github.com
Sat Jan 13 15:07:09 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ddae86e7776380e5f787464d595a6d44dac3cf1b
      https://github.com/WebKit/WebKit/commit/ddae86e7776380e5f787464d595a6d44dac3cf1b
  Author: Megan Gardner <megan_gardner at apple.com>
  Date:   2024-01-13 (Sat, 13 Jan 2024)

  Changed paths:
    A LayoutTests/http/tests/scroll-to-text-fragment/whitespace-collapse-expected.html
    A LayoutTests/http/tests/scroll-to-text-fragment/whitespace-collapse.html
    M LayoutTests/imported/w3c/web-platform-tests/scroll-to-text-fragment/scroll-to-text-fragment-expected.txt
    A LayoutTests/platform/glib/http/tests/scroll-to-text-fragment/whitespace-collapse-expected.html
    M LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/scroll-to-text-fragment/scroll-to-text-fragment-expected.txt
    A LayoutTests/platform/wincairo/http/tests/scroll-to-text-fragment/whitespace-collapse-expected.html
    M Source/WebCore/dom/FragmentDirectiveRangeFinder.cpp

  Log Message:
  -----------
  Scroll To Text Fragment Text Directives don't find text with additional unrendered white space in their node data.
https://bugs.webkit.org/show_bug.cgi?id=267460
rdar://120913588

Reviewed by Ryosuke Niwa.

The spec for Scroll to Text Fragment says to just look a the .data() on the node
to determine it's text content and search for the fragment directive in the page
text. However, this does not account for extra white space that is removed when rendering.
Therefore, we should use TextItterator which does account for a remove this unrendered white
space. This is technically against the spec, but other engines similarly ignore this
extraneous white space when searching, so the spec should be updated accordingly.
If TextItterator does not find the text, we fall back to the original spec way of finding
the text.

* LayoutTests/http/tests/scroll-to-text-fragment/whitespace-collapse-expected.html: Added.
* LayoutTests/http/tests/scroll-to-text-fragment/whitespace-collapse.html: Added.
* Source/WebCore/dom/FragmentDirectiveRangeFinder.cpp:
(WebCore::FragmentDirectiveRangeFinder::findRangeFromNodeList):

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




More information about the webkit-changes mailing list