+2019-11-12 Megan Gardner <megan_gardner@apple.com>
+
+ Rename _textSelectionAssistant to _textInteractionAssistant to reflect the only class it can now represent
+ https://bugs.webkit.org/show_bug.cgi?id=204103
+
+ Reviewed by Wenson Hsieh.
+
+ No new tests - rename only.
+
+ Now that UIWKSelectionAssistant is no longer, the _textSelectionAssistant can only be a
+ UIWKTextInteractionAssistant. There is enough confusion around all the selection and
+ interaction assistants, renaming this should alleviate some of that confusion.
+
+ * UIProcess/ios/WKContentView.mm:
+ (-[WKContentView _didExitStableState]):
+ * UIProcess/ios/WKContentViewInteraction.h:
+ * UIProcess/ios/WKContentViewInteraction.mm:
+ (-[WKContentView cleanupInteraction]):
+ (-[WKContentView becomeFirstResponderForWebView]):
+ (-[WKContentView endEditingAndUpdateFocusAppearanceWithReason:]):
+ (-[WKContentView _scrollingNodeScrollingWillBegin]):
+ (-[WKContentView _scrollingNodeScrollingDidEnd]):
+ (-[WKContentView gestureRecognizer:canBePreventedByGestureRecognizer:]):
+ (-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]):
+ (-[WKContentView _uiTextSelectionRects]):
+ (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
+ (-[WKContentView setUpTextSelectionAssistant]):
+ (-[WKContentView _willStartScrollingOrZooming]):
+ (-[WKContentView _didEndScrollingOrZooming]):
+ (-[WKContentView _lookupForWebView:]):
+ (-[WKContentView _shareForWebView:]):
+ (-[WKContentView _addShortcutForWebView:]):
+ (-[WKContentView _promptForReplaceForWebView:]):
+ (-[WKContentView _transliterateChineseForWebView:]):
+ (-[WKContentView tintColorDidChange]):
+ (-[WKContentView _didHideMenu:]):
+ (-[WKContentView selectForWebView:]):
+ (-[WKContentView selectAllForWebView:]):
+ (-[WKContentView _showTextStyleOptionsForWebView:]):
+ (-[WKContentView _showDictionary:]):
+ (-[WKContentView interactionAssistant]):
+ (-[WKContentView _showKeyboard]):
+ (-[WKContentView _hideKeyboard]):
+ (-[WKContentView _updateChangedSelection:]):
+ (-[WKContentView _startSuppressingSelectionAssistantForReason:]):
+ (-[WKContentView _stopSuppressingSelectionAssistantForReason:]):
+ (-[WKContentView _restoreCalloutBarIfNeeded]):
+ (-[WKContentView dragInteraction:willAnimateLiftWithAnimator:session:]):
+
2019-11-12 Carlos Alberto Lopez Perez <clopez@igalia.com>
[GTK][WPE] Support Pointer Events
if (!_hasSetUpInteractions)
return;
- _textSelectionAssistant = nil;
+ _textInteractionAssistant = nil;
[_actionSheetAssistant cleanupSheet];
_actionSheetAssistant = nil;
_page->activityStateDidChange(WebCore::ActivityState::IsFocused);
if ([self canShowNonEmptySelectionView])
- [_textSelectionAssistant activateSelection];
+ [_textInteractionAssistant activateSelection];
[self _scheduleResetInputViewDeferralAfterBecomingFirstResponder];
} else
}
[self _cancelInteraction];
- [_textSelectionAssistant deactivateSelection];
+ [_textInteractionAssistant deactivateSelection];
[self _resetInputViewDeferral];
}
- (void)_scrollingNodeScrollingWillBegin
{
- [_textSelectionAssistant willStartScrollingOverflow];
+ [_textInteractionAssistant willStartScrollingOverflow];
}
- (void)_scrollingNodeScrollingDidEnd
return;
}
[self _updateChangedSelection];
- [_textSelectionAssistant didEndScrollingOverflow];
+ [_textInteractionAssistant didEndScrollingOverflow];
}
- (BOOL)shouldShowAutomaticKeyboardUI
// Don't allow the highlight to be prevented by a selection gesture. Press-and-hold on a link should highlight the link, not select it.
bool isForcePressGesture = NO;
#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 120000
- isForcePressGesture = (preventingGestureRecognizer == _textSelectionAssistant.get().forcePressGesture);
+ isForcePressGesture = (preventingGestureRecognizer == _textInteractionAssistant.get().forcePressGesture);
#endif
#if PLATFORM(MACCATALYST)
- if ((preventingGestureRecognizer == _textSelectionAssistant.get().loupeGesture) && (preventedGestureRecognizer == _highlightLongPressGestureRecognizer || preventedGestureRecognizer == _longPressGestureRecognizer || preventedGestureRecognizer == _textSelectionAssistant.get().forcePressGesture))
+ if ((preventingGestureRecognizer == _textInteractionAssistant.get().loupeGesture) && (preventedGestureRecognizer == _highlightLongPressGestureRecognizer || preventedGestureRecognizer == _longPressGestureRecognizer || preventedGestureRecognizer == _textInteractionAssistant.get().forcePressGesture))
return YES;
#endif
- if ((preventingGestureRecognizer == _textSelectionAssistant.get().loupeGesture || isForcePressGesture) && (preventedGestureRecognizer == _highlightLongPressGestureRecognizer || preventedGestureRecognizer == _longPressGestureRecognizer))
+ if ((preventingGestureRecognizer == _textInteractionAssistant.get().loupeGesture || isForcePressGesture) && (preventedGestureRecognizer == _highlightLongPressGestureRecognizer || preventedGestureRecognizer == _longPressGestureRecognizer))
return NO;
return YES;
#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 120000
#if PLATFORM(MACCATALYST)
- if (isSamePair(gestureRecognizer, otherGestureRecognizer, _textSelectionAssistant.get().loupeGesture, _textSelectionAssistant.get().forcePressGesture))
+ if (isSamePair(gestureRecognizer, otherGestureRecognizer, _textInteractionAssistant.get().loupeGesture, _textInteractionAssistant.get().forcePressGesture))
return YES;
- if (isSamePair(gestureRecognizer, otherGestureRecognizer, _singleTapGestureRecognizer.get(), _textSelectionAssistant.get().loupeGesture))
+ if (isSamePair(gestureRecognizer, otherGestureRecognizer, _singleTapGestureRecognizer.get(), _textInteractionAssistant.get().loupeGesture))
return YES;
if (([gestureRecognizer isKindOfClass:[_UILookupGestureRecognizer class]] && [otherGestureRecognizer isKindOfClass:[UILongPressGestureRecognizer class]]) || ([otherGestureRecognizer isKindOfClass:[UILongPressGestureRecognizer class]] && [gestureRecognizer isKindOfClass:[_UILookupGestureRecognizer class]]))
return YES;
#endif
- if (isSamePair(gestureRecognizer, otherGestureRecognizer, _highlightLongPressGestureRecognizer.get(), _textSelectionAssistant.get().forcePressGesture))
+ if (isSamePair(gestureRecognizer, otherGestureRecognizer, _highlightLongPressGestureRecognizer.get(), _textInteractionAssistant.get().forcePressGesture))
return YES;
#endif
- if (isSamePair(gestureRecognizer, otherGestureRecognizer, _singleTapGestureRecognizer.get(), _textSelectionAssistant.get().singleTapGesture))
+ if (isSamePair(gestureRecognizer, otherGestureRecognizer, _singleTapGestureRecognizer.get(), _textInteractionAssistant.get().singleTapGesture))
return YES;
if (isSamePair(gestureRecognizer, otherGestureRecognizer, _singleTapGestureRecognizer.get(), _nonBlockingDoubleTapGestureRecognizer.get()))
{
NSMutableArray *textSelectionRects = [NSMutableArray array];
- if (_textSelectionAssistant) {
- for (WKTextSelectionRect *selectionRect in [_textSelectionAssistant valueForKeyPath:@"selectionView.selection.selectionRects"])
+ if (_textInteractionAssistant) {
+ for (WKTextSelectionRect *selectionRect in [_textInteractionAssistant valueForKeyPath:@"selectionView.selection.selectionRects"])
[textSelectionRects addObject:[NSValue valueWithCGRect:selectionRect.webRect.rect]];
}
if (_suppressNonEditableSingleTapTextInteractionCount > 0)
return NO;
- switch ([_textSelectionAssistant loupeGesture].state) {
+ switch ([_textInteractionAssistant loupeGesture].state) {
case UIGestureRecognizerStateBegan:
case UIGestureRecognizerStateChanged:
case UIGestureRecognizerStateEnded: {
- (void)setUpTextSelectionAssistant
{
- if (!_textSelectionAssistant)
- _textSelectionAssistant = adoptNS([[UIWKTextInteractionAssistant alloc] initWithView:self]);
+ if (!_textInteractionAssistant)
+ _textInteractionAssistant = adoptNS([[UIWKTextInteractionAssistant alloc] initWithView:self]);
else {
// Reset the gesture recognizers in case editability has changed.
- [_textSelectionAssistant setGestureRecognizers];
+ [_textInteractionAssistant setGestureRecognizers];
}
}
- (void)_willStartScrollingOrZooming
{
- if ([_textSelectionAssistant respondsToSelector:@selector(willStartScrollingOrZooming)])
- [_textSelectionAssistant willStartScrollingOrZooming];
+ if ([_textInteractionAssistant respondsToSelector:@selector(willStartScrollingOrZooming)])
+ [_textInteractionAssistant willStartScrollingOrZooming];
else
- [_textSelectionAssistant willStartScrollingOverflow];
+ [_textInteractionAssistant willStartScrollingOverflow];
_page->setIsScrollingOrZooming(true);
#if PLATFORM(WATCHOS)
- (void)_didEndScrollingOrZooming
{
if (!_needsDeferredEndScrollingSelectionUpdate) {
- if ([_textSelectionAssistant respondsToSelector:@selector(didEndScrollingOrZooming)])
- [_textSelectionAssistant didEndScrollingOrZooming];
+ if ([_textInteractionAssistant respondsToSelector:@selector(didEndScrollingOrZooming)])
+ [_textInteractionAssistant didEndScrollingOrZooming];
else
- [_textSelectionAssistant didEndScrollingOverflow];
+ [_textInteractionAssistant didEndScrollingOverflow];
}
_page->setIsScrollingOrZooming(false);
String selectionContext = textBefore + selectedText + textAfter;
NSRange selectedRangeInContext = NSMakeRange(textBefore.length(), selectedText.length());
- if (auto textSelectionAssistant = view->_textSelectionAssistant)
+ if (auto textSelectionAssistant = view->_textInteractionAssistant)
[textSelectionAssistant lookup:selectionContext withRange:selectedRangeInContext fromRect:presentationRect];
});
}
if (error != WebKit::CallbackBase::Error::None)
return;
- if (!view->_textSelectionAssistant || !string || view->_page->editorState().isMissingPostLayoutData)
+ if (!view->_textInteractionAssistant || !string || view->_page->editorState().isMissingPostLayoutData)
return;
auto& selectionRects = view->_page->editorState().postLayoutData().selectionRects;
if (selectionRects.isEmpty())
return;
- [view->_textSelectionAssistant showShareSheetFor:string fromRect:selectionRects.first().rect()];
+ [view->_textInteractionAssistant showShareSheetFor:string fromRect:selectionRects.first().rect()];
});
}
- (void)_addShortcutForWebView:(id)sender
{
- if (_textSelectionAssistant)
- [_textSelectionAssistant showTextServiceFor:[self selectedText] fromRect:_page->editorState().postLayoutData().selectionRects[0].rect()];
+ if (_textInteractionAssistant)
+ [_textInteractionAssistant showTextServiceFor:[self selectedText] fromRect:_page->editorState().postLayoutData().selectionRects[0].rect()];
}
- (NSString *)selectedText
if (wordAtSelection.isEmpty())
return;
- [_textSelectionAssistant scheduleReplacementsForText:wordAtSelection];
+ [_textInteractionAssistant scheduleReplacementsForText:wordAtSelection];
}
- (void)_transliterateChineseForWebView:(id)sender
{
- [_textSelectionAssistant scheduleChineseTransliterationForText:_page->editorState().postLayoutData().wordAtSelection];
+ [_textInteractionAssistant scheduleChineseTransliterationForText:_page->editorState().postLayoutData().wordAtSelection];
}
- (void)replaceForWebView:(id)sender
BOOL shouldUpdateTextSelection = self.isFirstResponder && [self canShowNonEmptySelectionView];
if (shouldUpdateTextSelection)
- [_textSelectionAssistant deactivateSelection];
+ [_textInteractionAssistant deactivateSelection];
[self _updateInteractionTintColor];
if (shouldUpdateTextSelection)
- [_textSelectionAssistant activateSelection];
+ [_textInteractionAssistant activateSelection];
}
- (BOOL)canPerformAction:(SEL)action withSender:(id)sender
- (void)_didHideMenu:(NSNotification *)notification
{
_showingTextStyleOptions = NO;
- [_textSelectionAssistant hideTextStyleOptions];
+ [_textInteractionAssistant hideTextStyleOptions];
}
- (void)_keyboardDidRequestDismissal:(NSNotification *)notification
- (void)selectForWebView:(id)sender
{
- [_textSelectionAssistant selectWord];
+ [_textInteractionAssistant selectWord];
// We cannot use selectWord command, because we want to be able to select the word even when it is the last in the paragraph.
_page->extendSelection(WebCore::WordGranularity);
}
- (void)selectAllForWebView:(id)sender
{
- [_textSelectionAssistant selectAll:sender];
+ [_textInteractionAssistant selectAll:sender];
_page->selectAll();
}
- (void)_showTextStyleOptionsForWebView:(id)sender
{
_showingTextStyleOptions = YES;
- [_textSelectionAssistant showTextStyleOptions];
+ [_textInteractionAssistant showTextStyleOptions];
}
- (void)_showDictionary:(NSString *)text
{
CGRect presentationRect = _page->editorState().postLayoutData().selectionRects[0].rect();
- if (_textSelectionAssistant)
- [_textSelectionAssistant showDictionaryFor:text fromRect:presentationRect];
+ if (_textInteractionAssistant)
+ [_textInteractionAssistant showDictionaryFor:text fromRect:presentationRect];
}
- (void)_defineForWebView:(id)sender
- (UITextInteractionAssistant *)interactionAssistant
{
- return _textSelectionAssistant.get();
+ return _textInteractionAssistant.get();
}
- (id<UISelectionInteractionAssistant>)selectionInteractionAssistant
[self setUpTextSelectionAssistant];
if (self.isFirstResponder && !_suppressSelectionAssistantReasons)
- [_textSelectionAssistant activateSelection];
+ [_textInteractionAssistant activateSelection];
#if !PLATFORM(WATCHOS)
[self reloadInputViews];
self.inputDelegate = nil;
[self setUpTextSelectionAssistant];
- [_textSelectionAssistant deactivateSelection];
+ [_textInteractionAssistant deactivateSelection];
[_formAccessoryView hideAutoFillButton];
// FIXME: Does it make sense to call -reloadInputViews on watchOS?
_lastSelectionDrawingInfo = selectionDrawingInfo;
// FIXME: We need to figure out what to do if the selection is changed by Javascript.
- if (_textSelectionAssistant) {
+ if (_textInteractionAssistant) {
_markedText = (_page->editorState().hasComposition) ? _page->editorState().markedText : String();
- [_textSelectionAssistant selectionChanged];
+ [_textInteractionAssistant selectionChanged];
}
_selectionNeedsUpdate = NO;
if (_shouldRestoreSelection) {
- [_textSelectionAssistant didEndScrollingOverflow];
+ [_textInteractionAssistant didEndScrollingOverflow];
_shouldRestoreSelection = NO;
}
}
[[self selectionInteractionAssistant] showSelectionCommands];
if (!_suppressSelectionAssistantReasons)
- [_textSelectionAssistant activateSelection];
+ [_textInteractionAssistant activateSelection];
- [_textSelectionAssistant didEndScrollingOverflow];
+ [_textInteractionAssistant didEndScrollingOverflow];
_needsDeferredEndScrollingSelectionUpdate = NO;
}
_suppressSelectionAssistantReasons.add(reason);
if (!wasSuppressingSelectionAssistant)
- [_textSelectionAssistant deactivateSelection];
+ [_textInteractionAssistant deactivateSelection];
}
- (void)_stopSuppressingSelectionAssistantForReason:(WebKit::SuppressSelectionAssistantReason)reason
_suppressSelectionAssistantReasons.remove(reason);
if (wasSuppressingSelectionAssistant && !_suppressSelectionAssistantReasons)
- [_textSelectionAssistant activateSelection];
+ [_textInteractionAssistant activateSelection];
}
#if ENABLE(DATALIST_ELEMENT)
return;
// FIXME: This SPI should be renamed in UIKit to reflect a more general purpose of revealing hidden interaction assistant controls.
- [_textSelectionAssistant didEndScrollingOverflow];
+ [_textInteractionAssistant didEndScrollingOverflow];
_shouldRestoreCalloutBarAfterDrop = NO;
}
RELEASE_LOG(DragAndDrop, "Drag session willAnimateLiftWithAnimator: %p", session);
if (!_shouldRestoreCalloutBarAfterDrop && _dragDropInteractionState.anyActiveDragSourceIs(WebCore::DragSourceActionSelection)) {
// FIXME: This SPI should be renamed in UIKit to reflect a more general purpose of hiding interaction assistant controls.
- [_textSelectionAssistant willStartScrollingOverflow];
+ [_textInteractionAssistant willStartScrollingOverflow];
_shouldRestoreCalloutBarAfterDrop = YES;
}