Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (252366 => 252367)
--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm 2019-11-12 16:35:55 UTC (rev 252366)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm 2019-11-12 16:51:58 UTC (rev 252367)
@@ -868,7 +868,7 @@
if (!_hasSetUpInteractions)
return;
- _textSelectionAssistant = nil;
+ _textInteractionAssistant = nil;
[_actionSheetAssistant cleanupSheet];
_actionSheetAssistant = nil;
@@ -1291,7 +1291,7 @@
_page->activityStateDidChange(WebCore::ActivityState::IsFocused);
if ([self canShowNonEmptySelectionView])
- [_textSelectionAssistant activateSelection];
+ [_textInteractionAssistant activateSelection];
[self _scheduleResetInputViewDeferralAfterBecomingFirstResponder];
} else
@@ -1324,7 +1324,7 @@
}
[self _cancelInteraction];
- [_textSelectionAssistant deactivateSelection];
+ [_textInteractionAssistant deactivateSelection];
[self _resetInputViewDeferral];
}
@@ -1796,7 +1796,7 @@
- (void)_scrollingNodeScrollingWillBegin
{
- [_textSelectionAssistant willStartScrollingOverflow];
+ [_textInteractionAssistant willStartScrollingOverflow];
}
- (void)_scrollingNodeScrollingDidEnd
@@ -1808,7 +1808,7 @@
return;
}
[self _updateChangedSelection];
- [_textSelectionAssistant didEndScrollingOverflow];
+ [_textInteractionAssistant didEndScrollingOverflow];
}
- (BOOL)shouldShowAutomaticKeyboardUI
@@ -1948,14 +1948,14 @@
// 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;
@@ -1978,19 +1978,19 @@
#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()))
@@ -2185,8 +2185,8 @@
{
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]];
}
@@ -2416,7 +2416,7 @@
if (_suppressNonEditableSingleTapTextInteractionCount > 0)
return NO;
- switch ([_textSelectionAssistant loupeGesture].state) {
+ switch ([_textInteractionAssistant loupeGesture].state) {
case UIGestureRecognizerStateBegan:
case UIGestureRecognizerStateChanged:
case UIGestureRecognizerStateEnded: {
@@ -2739,11 +2739,11 @@
- (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];
}
}
@@ -2777,10 +2777,10 @@
- (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)
@@ -2800,10 +2800,10 @@
- (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);
@@ -2930,7 +2930,7 @@
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];
});
}
@@ -2942,7 +2942,7 @@
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;
@@ -2949,14 +2949,14 @@
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
@@ -3002,12 +3002,12 @@
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
@@ -3159,10 +3159,10 @@
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
@@ -3383,7 +3383,7 @@
- (void)_didHideMenu:(NSNotification *)notification
{
_showingTextStyleOptions = NO;
- [_textSelectionAssistant hideTextStyleOptions];
+ [_textInteractionAssistant hideTextStyleOptions];
}
- (void)_keyboardDidRequestDismissal:(NSNotification *)notification
@@ -3418,7 +3418,7 @@
- (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);
}
@@ -3425,7 +3425,7 @@
- (void)selectAllForWebView:(id)sender
{
- [_textSelectionAssistant selectAll:sender];
+ [_textInteractionAssistant selectAll:sender];
_page->selectAll();
}
@@ -3472,14 +3472,14 @@
- (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
@@ -4818,7 +4818,7 @@
- (UITextInteractionAssistant *)interactionAssistant
{
- return _textSelectionAssistant.get();
+ return _textInteractionAssistant.get();
}
- (id<UISelectionInteractionAssistant>)selectionInteractionAssistant
@@ -5351,7 +5351,7 @@
[self setUpTextSelectionAssistant];
if (self.isFirstResponder && !_suppressSelectionAssistantReasons)
- [_textSelectionAssistant activateSelection];
+ [_textInteractionAssistant activateSelection];
#if !PLATFORM(WATCHOS)
[self reloadInputViews];
@@ -5363,7 +5363,7 @@
self.inputDelegate = nil;
[self setUpTextSelectionAssistant];
- [_textSelectionAssistant deactivateSelection];
+ [_textInteractionAssistant deactivateSelection];
[_formAccessoryView hideAutoFillButton];
// FIXME: Does it make sense to call -reloadInputViews on watchOS?
@@ -6233,14 +6233,14 @@
_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;
}
}
@@ -6249,9 +6249,9 @@
[[self selectionInteractionAssistant] showSelectionCommands];
if (!_suppressSelectionAssistantReasons)
- [_textSelectionAssistant activateSelection];
+ [_textInteractionAssistant activateSelection];
- [_textSelectionAssistant didEndScrollingOverflow];
+ [_textInteractionAssistant didEndScrollingOverflow];
_needsDeferredEndScrollingSelectionUpdate = NO;
}
@@ -6279,7 +6279,7 @@
_suppressSelectionAssistantReasons.add(reason);
if (!wasSuppressingSelectionAssistant)
- [_textSelectionAssistant deactivateSelection];
+ [_textInteractionAssistant deactivateSelection];
}
- (void)_stopSuppressingSelectionAssistantForReason:(WebKit::SuppressSelectionAssistantReason)reason
@@ -6288,7 +6288,7 @@
_suppressSelectionAssistantReasons.remove(reason);
if (wasSuppressingSelectionAssistant && !_suppressSelectionAssistantReasons)
- [_textSelectionAssistant activateSelection];
+ [_textInteractionAssistant activateSelection];
}
#if ENABLE(DATALIST_ELEMENT)
@@ -7041,7 +7041,7 @@
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;
}
@@ -7346,7 +7346,7 @@
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;
}