[webkit-changes] [WebKit/WebKit] 57c030: [Remote Inspection] Add a way for clients to contr...
Wenson Hsieh
noreply at github.com
Tue Apr 30 11:09:05 PDT 2024
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 57c0300c572968342e81b3aeea68b98462b0315a
https://github.com/WebKit/WebKit/commit/57c0300c572968342e81b3aeea68b98462b0315a
Author: Wenson Hsieh <wenson_hsieh at apple.com>
Date: 2024-04-30 (Tue, 30 Apr 2024)
Changed paths:
M Source/WebCore/page/ElementTargetingController.cpp
M Source/WebCore/page/ElementTargetingController.h
M Source/WebCore/page/ElementTargetingTypes.h
M Source/WebKit/CMakeLists.txt
M Source/WebKit/DerivedSources-input.xcfilelist
M Source/WebKit/DerivedSources.make
M Source/WebKit/Shared/API/APIObject.h
M Source/WebKit/Shared/Cocoa/APIObject.mm
R Source/WebKit/Shared/FontInfo.h
R Source/WebKit/Shared/FontInfo.serialization.in
A Source/WebKit/Shared/PlatformFontInfo.h
A Source/WebKit/Shared/PlatformFontInfo.serialization.in
M Source/WebKit/Shared/PlatformPopupMenuData.h
M Source/WebKit/Shared/PlatformPopupMenuData.serialization.in
M Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in
M Source/WebKit/Sources.txt
A Source/WebKit/UIProcess/API/APITargetedElementRequest.cpp
A Source/WebKit/UIProcess/API/APITargetedElementRequest.h
M Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
M Source/WebKit/UIProcess/API/Cocoa/_WKTargetedElementRequest.h
M Source/WebKit/UIProcess/API/Cocoa/_WKTargetedElementRequest.mm
A Source/WebKit/UIProcess/API/Cocoa/_WKTargetedElementRequestInternal.h
M Source/WebKit/UIProcess/PageClient.h
M Source/WebKit/UIProcess/WebPageProxy.cpp
M Source/WebKit/UIProcess/WebPageProxy.h
M Source/WebKit/UIProcess/ios/PageClientImplIOS.h
M Source/WebKit/UIProcess/ios/PageClientImplIOS.mm
M Source/WebKit/UIProcess/mac/WebPageProxyMac.mm
M Source/WebKit/UIProcess/mac/WebViewImpl.mm
M Source/WebKit/WebKit.xcodeproj/project.pbxproj
M Source/WebKit/WebProcess/WebPage/WebPage.h
M Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm
M Tools/TestWebKitAPI/Tests/WebKitCocoa/ElementTargetingTests.mm
Log Message:
-----------
[Remote Inspection] Add a way for clients to control whether to ignore or honor pointer-events: none;
https://bugs.webkit.org/show_bug.cgi?id=273458
rdar://126302333
Reviewed by Tim Horton.
Add support for a `-[_WKTargetedElementRequest shouldIgnorePointerEventsNone]` property that can be
used by clients to determine whether or not `pointer-events: none;` should be accounted for, when
hit-testing to find targets.
This PR also refactors `_WKTargetedElementRequest` so that it's built on top of a proper WebKit API
object (instead of bridging directly into the WebCore struct in ObjC code). I originally just kept
the bridging between `_WKTargetedElementRequest` and `WebCore::TargetedElementRequest` in platform
code because it was just a trivial wrapper around a single `FloatPoint`. However, since it is
beginning to accumulate more complexity, it makes more sense to pull it out into its own
`API::Object` type so that the platform-specific code is kept to a minimum (and other ports could
more easily take advantage of this infrastructure in the future).
See below for more details.
Test: ElementTargeting.DoNotIgnorePointerEventsNone
* Source/WebCore/page/ElementTargetingController.cpp:
(WebCore::ElementTargetingController::findTargets):
(WebCore::ElementTargetingController::findNodes):
Add support for the new boolean option by adding (or omitting) the corresponding hit-test type.
* Source/WebCore/page/ElementTargetingController.h:
* Source/WebCore/page/ElementTargetingTypes.h:
* Source/WebKit/CMakeLists.txt:
* Source/WebKit/DerivedSources-input.xcfilelist:
* Source/WebKit/DerivedSources.make:
* Source/WebKit/Shared/API/APIObject.h:
* Source/WebKit/Shared/Cocoa/APIObject.mm:
Add the new API object type, and related boilerplate.
(API::Object::newObject):
* Source/WebKit/Shared/PlatformFontInfo.h: Copied from Source/WebKit/Shared/FontInfo.h.
* Source/WebKit/Shared/PlatformFontInfo.serialization.in: Renamed from Source/WebKit/Shared/FontInfo.serialization.in.
Rename the `FontInfo` struct to `PlatformFontInfo`, to avoid a name collision between our struct and
the name of a struct in the global namespace, in `QuickDraw.h`:
```
/Users/whsieh/Build/Release/DerivedSources/WebKit/GeneratedSerializers.h:2198:8: note: candidate found by name lookup is 'WebKit::FontInfo'
2198 | struct FontInfo;
```
vs:
```
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/…/System/Library/Frameworks/ApplicationServices.framework/Frameworks/HIServices.framework/Headers/HIServices.h:26:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/…/System/Library/Frameworks/ApplicationServices.framework/Frameworks/HIServices.framework/Headers/HIShape.h:22:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/…/System/Library/Frameworks/ApplicationServices.framework/Frameworks/QD.framework/Headers/Quickdraw.h:282:116: error: reference to 'FontInfo' is ambiguous
282 | typedef CALLBACK_API( short , QDTxMeasProcPtr )(short byteCount, const void *textAddr, Point *numer, Point *denom, FontInfo *info);
```
This is only a problem now because of changes to unified source ordering, which now make these
symbols collide in the same compilation unit.
* Source/WebKit/Shared/PlatformPopupMenuData.h:
* Source/WebKit/Shared/PlatformPopupMenuData.serialization.in:
* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:
* Source/WebKit/Sources.txt:
* Source/WebKit/UIProcess/API/APITargetedElementRequest.cpp: Copied from Source/WebKit/UIProcess/API/Cocoa/_WKTargetedElementRequest.mm.
(API::TargetedElementRequest::point const):
(API::TargetedElementRequest::setPoint):
(API::TargetedElementRequest::searchText const):
(API::TargetedElementRequest::setSearchText):
(API::TargetedElementRequest::makeRequest const):
* Source/WebKit/UIProcess/API/APITargetedElementRequest.h: Copied from Source/WebKit/UIProcess/API/Cocoa/_WKTargetedElementRequest.h.
* Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _requestTargetedElementInfo:completionHandler:]):
* Source/WebKit/UIProcess/API/Cocoa/_WKTargetedElementRequest.h:
* Source/WebKit/UIProcess/API/Cocoa/_WKTargetedElementRequest.mm:
(-[_WKTargetedElementRequest dealloc]):
(-[_WKTargetedElementRequest _apiObject]):
(-[_WKTargetedElementRequest init]):
(-[_WKTargetedElementRequest initWithSearchText:]):
(-[_WKTargetedElementRequest initWithPoint:]):
(-[_WKTargetedElementRequest canIncludeNearbyElements]):
(-[_WKTargetedElementRequest setCanIncludeNearbyElements:]):
(-[_WKTargetedElementRequest shouldIgnorePointerEventsNone]):
(-[_WKTargetedElementRequest setShouldIgnorePointerEventsNone:]):
(-[_WKTargetedElementRequest searchText]):
(-[_WKTargetedElementRequest point]):
Make this ObjC object a real `API::Object` wrapper, backed by `API::TargetedElementRequest`.
* Source/WebKit/UIProcess/API/Cocoa/_WKTargetedElementRequestInternal.h: Renamed from Source/WebKit/Shared/FontInfo.h.
* Source/WebKit/UIProcess/PageClient.h:
(WebKit::PageClient::webViewToRootView const):
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::requestTargetedElement):
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/UIProcess/ios/PageClientImplIOS.h:
* Source/WebKit/UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::webViewToRootView const):
Add a platform client hook to map from web view coordinates to root view coordinates. We use this
when transforming the `API::TargetedElementRequest` into `WebCore::TargetedElementRequest`, as the
`point` in the former class is in web view coordinates, but the latter expects `pointInRootView`.
* Source/WebKit/UIProcess/mac/WebPageProxyMac.mm:
* Source/WebKit/UIProcess/mac/WebViewImpl.mm:
* Source/WebKit/WebKit.xcodeproj/project.pbxproj:
* Source/WebKit/WebProcess/WebPage/WebPage.h:
* Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/ElementTargetingTests.mm:
(-[WKWebView targetedElementInfo:]):
(-[WKWebView targetedElementInfoAt:]):
(-[WKWebView targetedElementInfoWithText:]):
(TestWebKitAPI::TEST(ElementTargeting, DoNotIgnorePointerEventsNone)):
Add an API test to exercise the new property.
(-[WKWebView _targetedElementInfo:]): Deleted.
Canonical link: https://commits.webkit.org/278178@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