Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 1623bf99b0424e05403acc6124bea75f8b75c22a
      
https://github.com/WebKit/WebKit/commit/1623bf99b0424e05403acc6124bea75f8b75c22a
  Author: Wenson Hsieh <[email protected]>
  Date:   2025-02-06 (Thu, 06 Feb 2025)

  Changed paths:
    A 
LayoutTests/fast/text-extraction/text-extraction-display-contents-expected.txt
    A LayoutTests/fast/text-extraction/text-extraction-display-contents.html
    M Source/WebCore/page/text-extraction/TextExtraction.cpp

  Log Message:
  -----------
  [UIIntelligenceSupport] [iOS] Text extraction fails for web content in the 
Notion app
https://bugs.webkit.org/show_bug.cgi?id=287191
rdar://144279805

Reviewed by Abrar Rahman Protyasha.

Currently, the implementation of `TextExtraction::extractItemData` (which pulls 
data from DOM nodes
for the purposes of context retrieval and resolution) works by traversing the 
DOM in depth-first
order, building a tree of text extraction items which preserve only a subset of 
DOM nodes that
contain rendered text, or are otherwise "interesting" to the system (e.g. 
images, scrollable areas,
editable elements).

This algorithm currently skips entire DOM subtrees for elements that don't have 
a renderer, which
works well for `display: none;` content. However, this also causes us to omit 
nodes inside of
`display: contents;` subtrees, which are visible to the user.

Fix this by only skipping the current element rather than the whole subtree, if 
the current element
has `display: contents;`.

* 
LayoutTests/fast/text-extraction/text-extraction-display-contents-expected.txt: 
Added.
* LayoutTests/fast/text-extraction/text-extraction-display-contents.html: Added.

Add a layout test to exercise the change.

* Source/WebCore/page/text-extraction/TextExtraction.cpp:
(WebCore::TextExtraction::extractItemData):

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