-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Remote Inspection] Element targeting should additionally find nearby out-of-flow elements #26435
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
EWS run on previous version of this PR (hash 9e0b588)
|
rr-codes
reviewed
Mar 25, 2024
EWS run on current version of this PR (hash ab0b5e5) |
aprotyas
approved these changes
Mar 25, 2024
… out-of-flow elements https://bugs.webkit.org/show_bug.cgi?id=271616 Reviewed by Abrar Protyasha. When targeting elements for remote inspection, additionally surface nearby elements which aren't precisely under the hit test location. Our strategy for this consists of the following: 1. While collecting targets, aggregate a `Region` containing the rects of all targeted out-of-flow elements (and hit-tested elements underneath targeted elements). 2. After building the list of targets, scan the entire DOM for out-of-flow renderers that are also contained in the "nearby targets" region, which also satisfy the same criteria for element targeting. 3. Add these as "nearby targets" to the final list of target infos, to the end of the array. See below for more details. Test: ElementTargeting.NearbyOutOfFlowElements * Source/WebCore/page/ElementTargeting.cpp: (WebCore::targetedElementInfo): Refactor this code to pull common logic into lambdas, and implement the steps detailed above. (WebCore::findTargetedElements): * Source/WebCore/page/ElementTargetingTypes.h: * Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in: * Source/WebKit/UIProcess/API/APITargetedElementInfo.h: * Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _requestTargetedElementInfo:completionHandler:]): * Source/WebKit/UIProcess/API/Cocoa/_WKTargetedElementInfo.h: Add a new `isUnderPoint` property, which is `YES` for elements that are directly hit-tested, and `NO` for nearby targets. * Source/WebKit/UIProcess/API/Cocoa/_WKTargetedElementInfo.mm: (-[_WKTargetedElementInfo isUnderPoint]): * Source/WebKit/UIProcess/API/Cocoa/_WKTargetedElementRequest.h: Add a new `canIncludeNearbyElements` (default: `YES`) which determines whether or not element targeting should include elements that have not been hit-tested, but are visually contained within another element that has been hit-tested. * Source/WebKit/UIProcess/API/Cocoa/_WKTargetedElementRequest.mm: (-[_WKTargetedElementRequest init]): * Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: * Tools/TestWebKitAPI/Tests/WebKitCocoa/ElementTargetingTests.mm: (TestWebKitAPI::TEST): * Tools/TestWebKitAPI/Tests/WebKitCocoa/element-targeting-2.html: Added. Add a new API test to exercise the change. Canonical link: https://commits.webkit.org/276670@main
e305a09
to
6458185
Compare
Committed 276670@main (6458185): https://commits.webkit.org/276670@main Reviewed commits have been landed. Closing PR #26435 and removing active labels. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Platform
Portability improvements and other general platform improvements not driven directly by site bugs.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
6458185
e305a09
🧪 wpe-wk2🧪 ios-wk2🧪 api-mac🧪 ios-wk2-wpt🧪 api-ios🛠 tv🧪 gtk-wk2🛠 watch