[webkit-changes] [WebKit/WebKit] c33f54: [Remote Inspection] _WKTargetedElementInfo should ...

Wenson Hsieh noreply at github.com
Mon Mar 25 13:39:56 PDT 2024


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

  Changed paths:
    M Source/WebCore/page/ElementTargeting.cpp
    M Source/WebCore/page/ElementTargetingTypes.h
    M Source/WebKit/Shared/API/APIObject.h
    M Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in
    M Source/WebKit/UIProcess/API/APIFrameInfo.cpp
    M Source/WebKit/UIProcess/API/APIFrameInfo.h
    M Source/WebKit/UIProcess/API/APITargetedElementInfo.cpp
    M Source/WebKit/UIProcess/API/APITargetedElementInfo.h
    M Source/WebKit/UIProcess/API/Cocoa/WKFrameInfo.mm
    M Source/WebKit/UIProcess/API/Cocoa/WKFrameInfoPrivate.h
    M Source/WebKit/UIProcess/API/Cocoa/_WKTargetedElementInfo.h
    M Source/WebKit/UIProcess/API/Cocoa/_WKTargetedElementInfo.mm
    M Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/ElementTargetingTests.mm
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/element-targeting-1.html
    A Tools/TestWebKitAPI/Tests/WebKitCocoa/nested-frames.html

  Log Message:
  -----------
  [Remote Inspection] _WKTargetedElementInfo should expose a method to get contained subframes
https://bugs.webkit.org/show_bug.cgi?id=271510

Reviewed by Megan Gardner.

Add a new method on `_WKTargetedElementInfo` to request `_WKFrameTreeNode`s that correspond to the
subframes underneath the targeted element. See below for more details.

* Source/WebCore/page/ElementTargeting.cpp:
(WebCore::collectChildFrameIdentifiers):
(WebCore::targetedElementInfo):

Plumb frame IDs for subframes underneath the targeted element from the web process to the UI
process.

* Source/WebCore/page/ElementTargetingTypes.h:
* Source/WebKit/Shared/API/APIObject.h:

Drive-by fix a typo in a comment: `namespace Object` should be `namespace API`.

* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:
* Source/WebKit/UIProcess/API/APIFrameInfo.cpp:
(API::FrameInfo::title const):

Add a getter for `title` on `FrameInfo`, which calls into `WebFrameProxy`.

* Source/WebKit/UIProcess/API/APIFrameInfo.h:
* Source/WebKit/UIProcess/API/APITargetedElementInfo.cpp:
(API::TargetedElementInfo::isSameElement const):
(API::TargetedElementInfo::childFrames const):
* Source/WebKit/UIProcess/API/APITargetedElementInfo.h:
* Source/WebKit/UIProcess/API/Cocoa/WKFrameInfo.mm:
(-[WKFrameInfo _title]):

Add a new SPI method on `WKFrameInfo`, which allows clients to read the last cached `title` for the
given frame.

* Source/WebKit/UIProcess/API/Cocoa/WKFrameInfoPrivate.h:
* Source/WebKit/UIProcess/API/Cocoa/_WKTargetedElementInfo.h:
* Source/WebKit/UIProcess/API/Cocoa/_WKTargetedElementInfo.mm:
(-[_WKTargetedElementInfo getChildFrames:]):

Implement the new API method. Using the list of subframe IDs from the targeting results, request
`FrameTreeNodeData` for each subframe and call the completion handler once all the async calls are
complete.

* Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/ElementTargetingTests.mm:
(-[_WKTargetedElementInfo childFrames]):
(TestWebKitAPI::TEST):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/element-targeting-1.html:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/nested-frames.html: Added.

Augment an existing API test to cover this new method as well.

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