[webkit-changes] [WebKit/WebKit] e23f17: [Text Extraction] Ignore transparent (or nearly-tr...

Wenson Hsieh noreply at github.com
Wed Mar 6 18:00:39 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: e23f17abb853a4aab8361f679ed5ca467d6e46fa
      https://github.com/WebKit/WebKit/commit/e23f17abb853a4aab8361f679ed5ca467d6e46fa
  Author: Wenson Hsieh <wenson_hsieh at apple.com>
  Date:   2024-03-06 (Wed, 06 Mar 2024)

  Changed paths:
    M LayoutTests/fast/text-extraction/basic-text-extraction.html
    M Source/WebCore/page/text-extraction/TextExtraction.cpp

  Log Message:
  -----------
  [Text Extraction] Ignore transparent (or nearly-transparent) elements when extracting text
https://bugs.webkit.org/show_bug.cgi?id=270598
rdar://124102506

Reviewed by Megan Gardner and Abrar Rahman Protyasha.

When extracting visible text, ignore subtrees where the renderer is transparent (or nearly
transparent). To do this, we adjust `extractItemData` to return an enum (`SkipExtraction`)
indicating whether we should skip text extraction for just the current node, or for the entire
subtree; we then use this to skip subtrees where there is either no renderer (i.e. `display: none;`)
or the opacity is near 0.

* LayoutTests/fast/text-extraction/basic-text-extraction.html:
* Source/WebCore/page/text-extraction/TextExtraction.cpp:
(WebCore::TextExtraction::extractItemData):
(WebCore::TextExtraction::extractRecursive):
(WebCore::TextExtraction::extractRenderedText):

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



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


More information about the webkit-changes mailing list