Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: e08a4a0ebf2a2816e0c68686e7235bec313f7628
      
https://github.com/WebKit/WebKit/commit/e08a4a0ebf2a2816e0c68686e7235bec313f7628
  Author: Wenson Hsieh <[email protected]>
  Date:   2026-02-09 (Mon, 09 Feb 2026)

  Changed paths:
    A 
LayoutTests/fast/text-extraction/debug-text-extraction-form-controls-2-expected.txt
    A 
LayoutTests/fast/text-extraction/debug-text-extraction-form-controls-2.html
    M Source/WebCore/page/text-extraction/TextExtraction.cpp
    M Source/WebCore/page/text-extraction/TextExtractionTypes.h
    M Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in
    M Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
    M Source/WebKit/UIProcess/API/Cocoa/_WKTextExtraction.h
    M Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl
    M Tools/TestRunnerShared/UIScriptContext/UIScriptController.h
    M Tools/TestRunnerShared/UIScriptContext/UIScriptControllerShared.cpp
    M Tools/WebKitTestRunner/cocoa/UIScriptControllerCocoa.mm

  Log Message:
  -----------
  [AutoFill Debugging] Add an option to include offscreen password fields
https://bugs.webkit.org/show_bug.cgi?id=307297
rdar://169930774

Reviewed by Megan Gardner and Abrar Rahman Protyasha.

Add a new flag to include text around password fields, even if the password 
fields lie outside of
the target collection rect. See below for more details.

Test: fast/text-extraction/debug-text-extraction-form-controls-2.html

* 
LayoutTests/fast/text-extraction/debug-text-extraction-form-controls-2-expected.txt:
 Added.
* LayoutTests/fast/text-extraction/debug-text-extraction-form-controls-2.html: 
Added.

Add a layout test to exercise the new flag.

* Source/WebCore/page/text-extraction/TextExtraction.cpp:
(WebCore::TextExtraction::extractRecursive):
(WebCore::TextExtraction::findLargeContainerAboveNode):
(WebCore::TextExtraction::findContainerNodeForDataDetectorResults):
(WebCore::TextExtraction::extractItem):

Implement support for this new behavior. If the flag is set and there is a 
target collection rect
specified (note: the absence of a target collection rect means we won't check 
for viewport
intersection in the first place), we scan the extraction root subtree for all 
inputs of type
`password`, and then use the same render tree ancestor heuristic as data 
detectors to find a "large"
ancestor for each node.

While recursively traversing the DOM, keep track of the number of parent nodes 
that are in this set,
via `inAdditionalContainerToCollectCount`. As long as 
`inAdditionalContainerToCollectCount` is
nonzero, we then ignore the viewport intersection check and include context 
from the container
regardless.

* Source/WebCore/page/text-extraction/TextExtractionTypes.h:
* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:
* Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _requestTextExtractionInternal:completion:]):
* Source/WebKit/UIProcess/API/Cocoa/_WKTextExtraction.h:

Add the new property.

* Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
* Tools/TestRunnerShared/UIScriptContext/UIScriptController.h:
* Tools/TestRunnerShared/UIScriptContext/UIScriptControllerShared.cpp:
(WTR::toTextExtractionTestOptions):
* Tools/WebKitTestRunner/cocoa/UIScriptControllerCocoa.mm:
(WTR::createTextExtractionConfiguration):

Add test support for this new property.

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



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

Reply via email to