[webkit-changes] [WebKit/WebKit] 694cb0: Remove an unused SPI method from WKWebView

Wenson Hsieh noreply at github.com
Thu Mar 28 22:21:34 PDT 2024


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

  Changed paths:
    A LayoutTests/fast/element-targeting/resources/subframe.html
    A LayoutTests/fast/element-targeting/target-rendered-text-with-subframe-expected.txt
    A LayoutTests/fast/element-targeting/target-rendered-text-with-subframe.html
    R LayoutTests/fast/text-extraction/extract-rendered-text-with-subframe-expected.txt
    R LayoutTests/fast/text-extraction/extract-rendered-text-with-subframe.html
    R LayoutTests/fast/text-extraction/resources/subframe.html
    M LayoutTests/resources/ui-helper.js
    M Source/WebCore/page/ElementTargetingController.cpp
    M Source/WebCore/page/text-extraction/TextExtraction.cpp
    M Source/WebCore/page/text-extraction/TextExtraction.h
    M Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
    M Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h
    M Source/WebKit/UIProcess/WebPageProxy.cpp
    M Source/WebKit/UIProcess/WebPageProxy.h
    M Source/WebKit/WebProcess/WebPage/WebPage.cpp
    M Source/WebKit/WebProcess/WebPage/WebPage.h
    M Source/WebKit/WebProcess/WebPage/WebPage.messages.in
    M Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl
    M Tools/TestRunnerShared/UIScriptContext/UIScriptController.h
    M Tools/WebKitTestRunner/cocoa/UIScriptControllerCocoa.h
    M Tools/WebKitTestRunner/cocoa/UIScriptControllerCocoa.mm

  Log Message:
  -----------
  Remove an unused SPI method from WKWebView
https://bugs.webkit.org/show_bug.cgi?id=271852

Reviewed by Abrar Rahman Protyasha and Megan Gardner.

Remove `-_requestRenderedTextForElementSelector:completionHandler:` (which hasn't shipped in any SDK
yet), since we don't actually expect any internal clients to rely on it. See below for more details.

* LayoutTests/fast/element-targeting/resources/subframe.html: Renamed from LayoutTests/fast/text-extraction/resources/subframe.html.
* LayoutTests/fast/element-targeting/target-rendered-text-with-subframe-expected.txt: Renamed from LayoutTests/fast/text-extraction/extract-rendered-text-with-subframe-expected.txt.
* LayoutTests/fast/element-targeting/target-rendered-text-with-subframe.html: Renamed from LayoutTests/fast/text-extraction/extract-rendered-text-with-subframe.html.

Move the layout test previously associated with this SPI to another directory, and make it use the
targeted element request SPI instead.

* LayoutTests/resources/ui-helper.js:
(window.UIHelper.requestRenderedTextForFrontmostTarget):
(window.UIHelper.requestRenderedTextForSelector): Deleted.
* Source/WebCore/page/ElementTargetingController.cpp:
(WebCore::elementAndAncestorsAreOnlyRenderedChildren):
(WebCore::isTargetCandidate):

Drive-by fix: ascend the render tree (instead of just the DOM) when finding elements to avoid
surfacing as target candidates. We only care about rendered content here, since this is about not
accidentally adjusting visibility for elements that would cause the entire page to become unusable.

(WebCore::elementAndAncestorsAreOnlyChildren): Deleted.
* Source/WebCore/page/text-extraction/TextExtraction.cpp:
* Source/WebCore/page/text-extraction/TextExtraction.h:
* Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _requestRenderedTextForElementSelector:completionHandler:]): Deleted.
* Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h:
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::requestRenderedTextForElementSelector): Deleted.
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::requestRenderedTextForElementSelector): Deleted.
* Source/WebKit/WebProcess/WebPage/WebPage.h:
* Source/WebKit/WebProcess/WebPage/WebPage.messages.in:
* Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
* Tools/TestRunnerShared/UIScriptContext/UIScriptController.h:

Rename this testing hook from `requestRenderedTextForSelector` to
`requestRenderedTextForFrontmostTarget`, and use the element targeting SPI instead.

(WTR::UIScriptController::requestTextExtraction):
(WTR::UIScriptController::requestRenderedTextForFrontmostTarget):
(WTR::UIScriptController::requestRenderedTextForSelector): Deleted.
* Tools/WebKitTestRunner/cocoa/UIScriptControllerCocoa.h:
* Tools/WebKitTestRunner/cocoa/UIScriptControllerCocoa.mm:
(WTR::UIScriptControllerCocoa::requestRenderedTextForFrontmostTarget):
(WTR::UIScriptControllerCocoa::requestRenderedTextForSelector): Deleted.

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