Skip to content
Permalink
Browse files
Delete WKHoverPlatter
https://bugs.webkit.org/show_bug.cgi?id=240623

Reviewed by Wenson Hsieh.

* Source/WebKit/SourcesCocoa.txt:
* Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm:
(-[WKWebView _allowsDoubleTapGestures]):
* Source/WebKit/UIProcess/ios/WKContentViewInteraction.h:
* Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _createAndConfigureHighlightLongPressGestureRecognizer]):
(-[WKContentView setUpInteraction]):
(-[WKContentView cleanUpInteraction]):
(-[WKContentView _locationForGesture:]):
(-[WKContentView _startPointForGesture:]):
(-[WKContentView _longPressRecognized:]):
(-[WKContentView _singleTapIdentified:]):
(-[WKContentView _singleTapRecognized:]):
(-[WKContentView _doubleTapRecognized:]):
(-[WKContentView _didCommitLoadForMainFrame]):
(-[WKContentView _shouldUseContextMenus]):
(-[WKContentView setUpDragAndDropInteractions]):
(-[WKContentView mouseGestureRecognizerChanged:]):
(-[WKContentView positionInformationForHoverPlatter:withRequest:completionHandler:]): Deleted.
(-[WKContentView interactionRegionsForHoverPlatter:inRect:completionHandler:]): Deleted.
* Source/WebKit/UIProcess/ios/WKHoverPlatter.h: Removed.
* Source/WebKit/UIProcess/ios/WKHoverPlatter.mm: Removed.
* Source/WebKit/UIProcess/ios/WKHoverPlatterParameters.h: Removed.
* Source/WebKit/UIProcess/ios/WKHoverPlatterParameters.mm: Removed.
* Source/WebKit/WebKit.xcodeproj/project.pbxproj:

Canonical link: https://commits.webkit.org/250754@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@294495 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
hortont424 committed May 19, 2022
1 parent 8ab9b26 commit fd3414ac7fff072561ecae846608de17770a04a8
Showing 9 changed files with 9 additions and 769 deletions.
@@ -507,8 +507,6 @@ UIProcess/ios/WKDeferringGestureRecognizer.mm
UIProcess/ios/WKGeolocationProviderIOS.mm
UIProcess/ios/WKGeolocationProviderIOSObjCSecurityOrigin.mm
UIProcess/ios/WKHighlightLongPressGestureRecognizer.mm
UIProcess/ios/WKHoverPlatter.mm
UIProcess/ios/WKHoverPlatterParameters.mm
UIProcess/ios/WKImageAnalysisGestureRecognizer.mm
UIProcess/ios/WKKeyboardScrollingAnimator.mm
UIProcess/ios/WKModelInteractionGestureRecognizer.mm
@@ -41,7 +41,6 @@
#import "ViewGestureController.h"
#import "WKBackForwardListItemInternal.h"
#import "WKContentView.h"
#import "WKHoverPlatterParameters.h"
#import "WKPasswordView.h"
#import "WKSafeBrowsingWarning.h"
#import "WKScrollView.h"
@@ -1598,11 +1597,6 @@ - (void)setBackgroundColor:(UIColor *)backgroundColor

- (BOOL)_allowsDoubleTapGestures
{
#if HAVE(UIKIT_WITH_MOUSE_SUPPORT)
if (WKHoverPlatterDomain.rootSettings.platterEnabledForDoubleTap)
return YES;
#endif

if (_fastClickingIsDisabled)
return YES;

@@ -40,7 +40,6 @@
#import "TextCheckingController.h"
#import "TransactionID.h"
#import "UIKitSPI.h"
#import "WKHoverPlatter.h"
#import <WebKit/WKActionSheetAssistant.h>
#import <WebKit/WKAirPlayRoutePicker.h>
#import <WebKit/WKContactPicker.h>
@@ -225,7 +224,6 @@ enum SuppressSelectionAssistantReason : uint8_t {
EditableRootIsTransparentOrFullyClipped = 1 << 0,
FocusedElementIsTooSmall = 1 << 1,
InteractionIsHappening = 1 << 2,
HoverPlatterEnabled = 1 << 3,
};

struct WKSelectionDrawingInfo {
@@ -319,10 +317,6 @@ using ImageAnalysisRequestIdentifier = ObjectIdentifier<ImageAnalysisRequestIden
WebCore::MouseEventPolicy _mouseEventPolicy;
#endif

#if HAVE(UIKIT_WITH_MOUSE_SUPPORT)
RetainPtr<WKHoverPlatter> _hoverPlatter;
#endif

#if HAVE(PENCILKIT_TEXT_INPUT)
RetainPtr<UIIndirectScribbleInteraction> _scribbleInteraction;
#endif
@@ -562,9 +556,6 @@ using ImageAnalysisRequestIdentifier = ObjectIdentifier<ImageAnalysisRequestIden
, UIDragInteractionDelegate, UIDropInteractionDelegate
#endif
, WKTouchActionGestureRecognizerDelegate
#if HAVE(UIKIT_WITH_MOUSE_SUPPORT)
, WKHoverPlatterDelegate
#endif
#if HAVE(UIFINDINTERACTION)
, UITextSearching
#endif
@@ -59,8 +59,6 @@
#import "WKFormSelectControl.h"
#import "WKFrameInfoInternal.h"
#import "WKHighlightLongPressGestureRecognizer.h"
#import "WKHoverPlatter.h"
#import "WKHoverPlatterParameters.h"
#import "WKImageAnalysisGestureRecognizer.h"
#import "WKImagePreviewViewController.h"
#import "WKInspectorNodeSearchGestureRecognizer.h"
@@ -902,11 +900,6 @@ - (void)_createAndConfigureDoubleTapGestureRecognizer

- (void)_createAndConfigureHighlightLongPressGestureRecognizer
{
#if HAVE(UIKIT_WITH_MOUSE_SUPPORT)
if (WKHoverPlatterDomain.rootSettings.platterEnabledForLongPress)
return;
#endif

_highlightLongPressGestureRecognizer = adoptNS([[WKHighlightLongPressGestureRecognizer alloc] initWithTarget:self action:@selector(_highlightLongPressRecognized:)]);
[_highlightLongPressGestureRecognizer setDelay:highlightDelay];
[_highlightLongPressGestureRecognizer setDelegate:self];
@@ -1005,10 +998,6 @@ - (void)setUpInteraction
[self setUpMouseGestureRecognizer];
#endif

#if HAVE(UIKIT_WITH_MOUSE_SUPPORT)
_hoverPlatter = adoptNS([[WKHoverPlatter alloc] initWithView:self.rootContentView delegate:self]);
#endif

#if HAVE(LOOKUP_GESTURE_RECOGNIZER)
_lookupGestureRecognizer = adoptNS([[_UILookupGestureRecognizer alloc] initWithTarget:self action:@selector(_lookupGestureRecognized:)]);
[_lookupGestureRecognizer setDelegate:self];
@@ -1199,11 +1188,6 @@ - (void)cleanUpInteraction

#endif

#if HAVE(UIKIT_WITH_MOUSE_SUPPORT)
[_hoverPlatter invalidate];
_hoverPlatter = nil;
#endif

#if HAVE(LOOKUP_GESTURE_RECOGNIZER)
[_lookupGestureRecognizer setDelegate:nil];
[self removeGestureRecognizer:_lookupGestureRecognizer.get()];
@@ -1316,11 +1300,6 @@ - (void)cleanUpInteraction
[self _handleDOMPasteRequestWithResult:WebCore::DOMPasteAccessResponse::DeniedForGesture];
[self _cancelPendingKeyEventHandler];

#if HAVE(UIKIT_WITH_MOUSE_SUPPORT)
if (WKHoverPlatterDomain.rootSettings.platterEnabledForLongPress)
[self _startSuppressingSelectionAssistantForReason:WebKit::HoverPlatterEnabled];
#endif

_cachedSelectedTextRange = nil;
}

@@ -3167,36 +3146,12 @@ - (NSArray *)webSelectionRects
return _latestTapID;
}

- (CGPoint)_locationForGesture:(UIGestureRecognizer *)gestureRecognizer
{
auto location = [gestureRecognizer locationInView:self];

#if HAVE(UIKIT_WITH_MOUSE_SUPPORT)
if (WKHoverPlatterDomain.rootSettings.enabled)
return [_hoverPlatter adjustedPointForPoint:location];
#endif

return location;
}

- (CGPoint)_startPointForGesture:(UILongPressGestureRecognizer *)gestureRecognizer
{
auto location = [gestureRecognizer startPoint];

#if HAVE(UIKIT_WITH_MOUSE_SUPPORT)
if (WKHoverPlatterDomain.rootSettings.enabled)
return [_hoverPlatter adjustedPointForPoint:location];
#endif

return location;
}

- (void)_highlightLongPressRecognized:(UILongPressGestureRecognizer *)gestureRecognizer
{
ASSERT(gestureRecognizer == _highlightLongPressGestureRecognizer);
[self _resetIsDoubleTapPending];

auto startPoint = [self _startPointForGesture:gestureRecognizer];
auto startPoint = [gestureRecognizer startPoint];

_lastInteractionLocation = startPoint;

@@ -3226,14 +3181,14 @@ - (void)_highlightLongPressRecognized:(UILongPressGestureRecognizer *)gestureRec

- (void)_doubleTapRecognizedForDoubleClick:(UITapGestureRecognizer *)gestureRecognizer
{
_page->handleDoubleTapForDoubleClickAtPoint(WebCore::IntPoint([self _locationForGesture:gestureRecognizer]), WebKit::webEventModifierFlags(gestureRecognizer.modifierFlags), _layerTreeTransactionIdAtLastInteractionStart);
_page->handleDoubleTapForDoubleClickAtPoint(WebCore::IntPoint([gestureRecognizer locationInView:self]), WebKit::webEventModifierFlags(gestureRecognizer.modifierFlags), _layerTreeTransactionIdAtLastInteractionStart);
}

- (void)_twoFingerSingleTapGestureRecognized:(UITapGestureRecognizer *)gestureRecognizer
{
_isTapHighlightIDValid = YES;
_isExpectingFastSingleTapCommit = YES;
_page->handleTwoFingerTapAtPoint(WebCore::roundedIntPoint([self _locationForGesture:gestureRecognizer]), WebKit::webEventModifierFlags(gestureRecognizer.modifierFlags | UIKeyModifierCommand), [self nextTapIdentifier]);
_page->handleTwoFingerTapAtPoint(WebCore::roundedIntPoint([gestureRecognizer locationInView:self]), WebKit::webEventModifierFlags(gestureRecognizer.modifierFlags | UIKeyModifierCommand), [self nextTapIdentifier]);
}

- (void)_longPressRecognized:(UILongPressGestureRecognizer *)gestureRecognizer
@@ -3242,17 +3197,9 @@ - (void)_longPressRecognized:(UILongPressGestureRecognizer *)gestureRecognizer
[self _resetIsDoubleTapPending];
[self _cancelTouchEventGestureRecognizer];

#if HAVE(UIKIT_WITH_MOUSE_SUPPORT)
if (WKHoverPlatterDomain.rootSettings.platterEnabledForLongPress) {
[_hoverPlatter didLongPressAtPoint:gestureRecognizer.startPoint];
_lastInteractionLocation = gestureRecognizer.startPoint;
return;
}
#endif

_page->didRecognizeLongPress();

_lastInteractionLocation = [self _startPointForGesture:gestureRecognizer];
_lastInteractionLocation = [gestureRecognizer startPoint];

if ([gestureRecognizer state] == UIGestureRecognizerStateBegan) {
SEL action = [self _actionForLongPress];
@@ -3278,7 +3225,7 @@ - (void)_endPotentialTapAndEnableDoubleTapGesturesIfNecessary

- (void)_singleTapIdentified:(UITapGestureRecognizer *)gestureRecognizer
{
auto position = [self _locationForGesture:gestureRecognizer];
auto position = [gestureRecognizer locationInView:self];
#if ENABLE(IMAGE_ANALYSIS_ENHANCEMENTS)
if (UIButton *analysisButton = [_imageAnalysisInteraction analysisButton]) {
auto hitTestedView = dynamic_objc_cast<UIButton>([self hitTest:position withEvent:nil]);
@@ -3298,12 +3245,6 @@ - (void)_singleTapIdentified:(UITapGestureRecognizer *)gestureRecognizer
[_inputPeripheral setSingleTapShouldEndEditing:[_inputPeripheral isEditing]];

bool shouldRequestMagnificationInformation = _page->preferences().fasterClicksEnabled();

#if HAVE(UIKIT_WITH_MOUSE_SUPPORT)
if (WKHoverPlatterDomain.rootSettings.platterEnabledForDoubleTap)
shouldRequestMagnificationInformation = NO;
#endif

if (shouldRequestMagnificationInformation)
RELEASE_LOG(ViewGestures, "Single tap identified. Request details on potential zoom. (%p, pageProxyID=%llu)", self, _page->identifier().toUInt64());

@@ -3381,7 +3322,7 @@ - (void)_singleTapRecognized:(UITapGestureRecognizer *)gestureRecognizer

ASSERT(_potentialTapInProgress);

_lastInteractionLocation = [self _locationForGesture:gestureRecognizer];
_lastInteractionLocation = [gestureRecognizer locationInView:self];

[self _endPotentialTapAndEnableDoubleTapGesturesIfNecessary];

@@ -3394,14 +3335,6 @@ - (void)_singleTapRecognized:(UITapGestureRecognizer *)gestureRecognizer
[_inputPeripheral endEditing];

RELEASE_LOG(ViewGestures, "Single tap recognized - commit potential tap (%p, pageProxyID=%llu)", self, _page->identifier().toUInt64());


#if HAVE(UIKIT_WITH_MOUSE_SUPPORT)
if (WKHoverPlatterDomain.rootSettings.platterEnabledForSingleTap && ![_hoverPlatter isVisible]) {
[_hoverPlatter didSingleTapAtPoint:_lastInteractionLocation];
return;
}
#endif

WebCore::PointerID pointerId = WebCore::mousePointerID;
if (auto* singleTapTouchIdentifier = [_singleTapGestureRecognizer lastActiveTouchIdentifier]) {
@@ -3425,16 +3358,8 @@ - (void)_doubleTapRecognized:(UITapGestureRecognizer *)gestureRecognizer

[self _resetIsDoubleTapPending];

auto location = [self _locationForGesture:gestureRecognizer];
auto location = [gestureRecognizer locationInView:self];
_lastInteractionLocation = location;

#if HAVE(UIKIT_WITH_MOUSE_SUPPORT)
if (WKHoverPlatterDomain.rootSettings.platterEnabledForDoubleTap) {
[_hoverPlatter didDoubleTapAtPoint:location];
return;
}
#endif

_smartMagnificationController->handleSmartMagnificationGesture(location);
}

@@ -3445,15 +3370,15 @@ - (void)_resetIsDoubleTapPending

- (void)_nonBlockingDoubleTapRecognized:(UITapGestureRecognizer *)gestureRecognizer
{
_lastInteractionLocation = [self _locationForGesture:gestureRecognizer];
_lastInteractionLocation = [gestureRecognizer locationInView:self];
_isDoubleTapPending = YES;
}

- (void)_twoFingerDoubleTapRecognized:(UITapGestureRecognizer *)gestureRecognizer
{
[self _resetIsDoubleTapPending];

auto location = [self _locationForGesture:gestureRecognizer];
auto location = [gestureRecognizer locationInView:self];
_lastInteractionLocation = location;
_smartMagnificationController->handleResetMagnificationGesture(location);
}
@@ -5136,10 +5061,6 @@ - (void)_didCommitLoadForMainFrame
_treatAsContentEditableUntilNextEditorStateUpdate = NO;
[self _invalidateCurrentPositionInformation];

#if HAVE(UIKIT_WITH_MOUSE_SUPPORT)
[_hoverPlatter dismissPlatterWithAnimation:NO];
#endif

#if ENABLE(IMAGE_ANALYSIS_ENHANCEMENTS)
[self uninstallImageAnalysisInteraction];
#endif
@@ -8193,10 +8114,6 @@ - (void)_targetedPreviewContainerDidRemoveLastSubview:(WKTargetedPreviewContaine

- (BOOL)_shouldUseContextMenus
{
#if HAVE(UIKIT_WITH_MOUSE_SUPPORT)
if (WKHoverPlatterDomain.rootSettings.platterEnabledForLongPress)
return NO;
#endif
#if HAVE(LINK_PREVIEW) && USE(UICONTEXTMENU)
return linkedOnOrAfterSDKWithBehavior(SDKAlignedBehavior::HasUIContextMenuInteraction);
#endif
@@ -8585,11 +8502,6 @@ - (NSTimeInterval)dragLiftDelay

- (void)setUpDragAndDropInteractions
{
#if HAVE(UIKIT_WITH_MOUSE_SUPPORT)
if (WKHoverPlatterDomain.rootSettings.platterEnabledForLongPress)
return;
#endif

_dragInteraction = adoptNS([[UIDragInteraction alloc] initWithDelegate:self]);
_dropInteraction = adoptNS([[UIDropInteraction alloc] initWithDelegate:self]);
[_dragInteraction _setLiftDelay:self.dragLiftDelay];
@@ -10048,12 +9960,6 @@ - (void)mouseGestureRecognizerChanged:(WKMouseGestureRecognizer *)gestureRecogni
if (event->type() == WebKit::WebEvent::MouseUp && self.hasHiddenContentEditable && self._hasFocusedElement && !self.window.keyWindow)
[self.window makeKeyWindow];

if (WKHoverPlatterDomain.rootSettings.enabled) {
[_hoverPlatter didReceiveMouseEvent:*event];
_page->handleMouseEvent([_hoverPlatter adjustedEventForEvent:*event]);
return;
}

_page->handleMouseEvent(*event);
}

@@ -10072,18 +9978,6 @@ - (void)_setMouseEventPolicy:(WebCore::MouseEventPolicy)policy
[self _configureMouseGestureRecognizer];
}

- (void)positionInformationForHoverPlatter:(WKHoverPlatter *)hoverPlatter withRequest:(WebKit::InteractionInformationRequest&)request completionHandler:(void (^)(WebKit::InteractionInformationAtPosition))completionHandler
{
[self doAfterPositionInformationUpdate:completionHandler forRequest:request];
}

- (void)interactionRegionsForHoverPlatter:(WKHoverPlatter *)platter inRect:(WebCore::FloatRect)rectInContentCoordinates completionHandler:(void (^)(Vector<WebCore::InteractionRegion>))completionHandler
{
_page->interactionRegions(rectInContentCoordinates, [completionHandler = makeBlockPtr(completionHandler)] (Vector<WebCore::InteractionRegion> regions) {
completionHandler(regions);
});
}

#endif

#if ENABLE(MEDIA_CONTROLS_CONTEXT_MENUS) && USE(UICONTEXTMENU)

0 comments on commit fd3414a

Please sign in to comment.