Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 54029a1eb934fdc1aca52acaa773a30ee2457204
https://github.com/WebKit/WebKit/commit/54029a1eb934fdc1aca52acaa773a30ee2457204
Author: Wenson Hsieh <[email protected]>
Date: 2026-10-12 (Mon, 12 Oct 2026)
Changed paths:
M Source/WebCore/page/text-extraction/TextExtraction.cpp
M Source/WebCore/page/text-extraction/TextExtractionTypes.h
M Source/WebCore/rendering/RenderObject.h
M Source/WebCore/rendering/RenderObjectInlines.h
M Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp
M Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in
M Source/WebKit/UIProcess/API/Cocoa/WKWebView+TextExtraction.mm
M Source/WebKit/UIProcess/API/Cocoa/_WKTextExtraction.h
M Source/WebKit/UIProcess/API/Cocoa/_WKTextExtraction.mm
M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/TextExtractionTests.swift
Log Message:
-----------
[Text Extraction] Add a property to control whether the extraction includes
content hidden by clipped ancestors
https://bugs.webkit.org/show_bug.cgi?id=327185
rdar://189720484
Reviewed by Abrar Rahman Protyasha.
Add support for a new option to include (or exclude) containers that are
completely (or almost
completely) hidden due to clipping; this ensures, for instance, that the front
page of zoom.us isn't
filled with navigational links that are only user-visible when expanding one of
the submenus in the
top nav.
Test: Tools/TestWebKitAPI/Tests/WebKit/WKWebView/TextExtractionTests.swift
* Source/WebCore/page/text-extraction/TextExtraction.cpp:
(WebCore::TextExtraction::isNearlyEmpty):
(WebCore::TextExtraction::isClippedOutOfView):
(WebCore::TextExtraction::isClippedOutByAncestors):
(WebCore::TextExtraction::extractItemData):
(WebCore::TextExtraction::extractRecursive):
* Source/WebCore/page/text-extraction/TextExtractionTypes.h:
* Source/WebCore/rendering/RenderObject.h:
* Source/WebCore/rendering/RenderObjectInlines.h:
(WebCore::RenderObject::visibleRectContextForTextRepresentation):
(WebCore::RenderObject::absoluteClippedOverflowRectForTextRepresentation const):
(WebCore::RenderObject::visibleRectContextForRenderTreeAsText): Deleted.
Repurpose the existing `absoluteClippedOverflowRectForRenderTreeAsText` to
check whether elements
are completely empty based on ancestor clip rects, but rename it to
`…ForTextRepresentation` to
reflect its broader use.
(WebCore::RenderObject::absoluteClippedOverflowRectForRenderTreeAsText const):
Deleted.
* Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp:
* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:
* Source/WebKit/UIProcess/API/Cocoa/WKWebView+TextExtraction.mm:
(-[WKWebView _requestTextExtractionInternal:completion:]):
* Source/WebKit/UIProcess/API/Cocoa/_WKTextExtraction.h:
* Source/WebKit/UIProcess/API/Cocoa/_WKTextExtraction.mm:
(-[_WKTextExtractionConfiguration init]):
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/TextExtractionTests.swift:
(TextExtractionTests.excludeContentInEmptyClippedContainers):
(TextExtractionTests.excludeContentClippedByAncestors):
Canonical link: https://commits.webkit.org/323469@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications