Changeset 252367 in webkit


Ignore:
Timestamp:
Nov 12, 2019 8:51:58 AM (4 years ago)
Author:
Megan Gardner
Message:

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:]):

Location:
trunk/Source/WebKit
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r252366 r252367  
     12019-11-12  Megan Gardner  <megan_gardner@apple.com>
     2
     3        Rename _textSelectionAssistant to _textInteractionAssistant to reflect the only class it can now represent
     4        https://bugs.webkit.org/show_bug.cgi?id=204103
     5
     6        Reviewed by Wenson Hsieh.
     7
     8        No new tests - rename only.
     9
     10        Now that UIWKSelectionAssistant is no longer, the _textSelectionAssistant can only be a
     11        UIWKTextInteractionAssistant. There is enough confusion around all the selection and
     12        interaction assistants, renaming this should alleviate some of that confusion.
     13
     14        * UIProcess/ios/WKContentView.mm:
     15        (-[WKContentView _didExitStableState]):
     16        * UIProcess/ios/WKContentViewInteraction.h:
     17        * UIProcess/ios/WKContentViewInteraction.mm:
     18        (-[WKContentView cleanupInteraction]):
     19        (-[WKContentView becomeFirstResponderForWebView]):
     20        (-[WKContentView endEditingAndUpdateFocusAppearanceWithReason:]):
     21        (-[WKContentView _scrollingNodeScrollingWillBegin]):
     22        (-[WKContentView _scrollingNodeScrollingDidEnd]):
     23        (-[WKContentView gestureRecognizer:canBePreventedByGestureRecognizer:]):
     24        (-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]):
     25        (-[WKContentView _uiTextSelectionRects]):
     26        (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
     27        (-[WKContentView setUpTextSelectionAssistant]):
     28        (-[WKContentView _willStartScrollingOrZooming]):
     29        (-[WKContentView _didEndScrollingOrZooming]):
     30        (-[WKContentView _lookupForWebView:]):
     31        (-[WKContentView _shareForWebView:]):
     32        (-[WKContentView _addShortcutForWebView:]):
     33        (-[WKContentView _promptForReplaceForWebView:]):
     34        (-[WKContentView _transliterateChineseForWebView:]):
     35        (-[WKContentView tintColorDidChange]):
     36        (-[WKContentView _didHideMenu:]):
     37        (-[WKContentView selectForWebView:]):
     38        (-[WKContentView selectAllForWebView:]):
     39        (-[WKContentView _showTextStyleOptionsForWebView:]):
     40        (-[WKContentView _showDictionary:]):
     41        (-[WKContentView interactionAssistant]):
     42        (-[WKContentView _showKeyboard]):
     43        (-[WKContentView _hideKeyboard]):
     44        (-[WKContentView _updateChangedSelection:]):
     45        (-[WKContentView _startSuppressingSelectionAssistantForReason:]):
     46        (-[WKContentView _stopSuppressingSelectionAssistantForReason:]):
     47        (-[WKContentView _restoreCalloutBarIfNeeded]):
     48        (-[WKContentView dragInteraction:willAnimateLiftWithAnimator:session:]):
     49
    1502019-11-12  Carlos Alberto Lopez Perez  <clopez@igalia.com>
    251
  • trunk/Source/WebKit/UIProcess/ios/WKContentView.mm

    r252175 r252367  
    365365        return;
    366366
    367     [_textSelectionAssistant deactivateSelection];
     367    [_textInteractionAssistant deactivateSelection];
    368368}
    369369
  • trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h

    r251320 r252367  
    240240#endif
    241241
    242     RetainPtr<UIWKTextInteractionAssistant> _textSelectionAssistant;
     242    RetainPtr<UIWKTextInteractionAssistant> _textInteractionAssistant;
    243243    OptionSet<WebKit::SuppressSelectionAssistantReason> _suppressSelectionAssistantReasons;
    244244
  • trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm

    r252309 r252367  
    869869        return;
    870870
    871     _textSelectionAssistant = nil;
     871    _textInteractionAssistant = nil;
    872872   
    873873    [_actionSheetAssistant cleanupSheet];
     
    12921292
    12931293        if ([self canShowNonEmptySelectionView])
    1294             [_textSelectionAssistant activateSelection];
     1294            [_textInteractionAssistant activateSelection];
    12951295
    12961296        [self _scheduleResetInputViewDeferralAfterBecomingFirstResponder];
     
    13251325
    13261326    [self _cancelInteraction];
    1327     [_textSelectionAssistant deactivateSelection];
     1327    [_textInteractionAssistant deactivateSelection];
    13281328
    13291329    [self _resetInputViewDeferral];
     
    17971797- (void)_scrollingNodeScrollingWillBegin
    17981798{
    1799     [_textSelectionAssistant willStartScrollingOverflow];   
     1799    [_textInteractionAssistant willStartScrollingOverflow];
    18001800}
    18011801
     
    18091809    }
    18101810    [self _updateChangedSelection];
    1811     [_textSelectionAssistant didEndScrollingOverflow];
     1811    [_textInteractionAssistant didEndScrollingOverflow];
    18121812}
    18131813
     
    19491949    bool isForcePressGesture = NO;
    19501950#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 120000
    1951     isForcePressGesture = (preventingGestureRecognizer == _textSelectionAssistant.get().forcePressGesture);
     1951    isForcePressGesture = (preventingGestureRecognizer == _textInteractionAssistant.get().forcePressGesture);
    19521952#endif
    19531953#if PLATFORM(MACCATALYST)
    1954     if ((preventingGestureRecognizer == _textSelectionAssistant.get().loupeGesture) && (preventedGestureRecognizer == _highlightLongPressGestureRecognizer || preventedGestureRecognizer == _longPressGestureRecognizer || preventedGestureRecognizer == _textSelectionAssistant.get().forcePressGesture))
     1954    if ((preventingGestureRecognizer == _textInteractionAssistant.get().loupeGesture) && (preventedGestureRecognizer == _highlightLongPressGestureRecognizer || preventedGestureRecognizer == _longPressGestureRecognizer || preventedGestureRecognizer == _textInteractionAssistant.get().forcePressGesture))
    19551955        return YES;
    19561956#endif
    19571957   
    1958     if ((preventingGestureRecognizer == _textSelectionAssistant.get().loupeGesture || isForcePressGesture) && (preventedGestureRecognizer == _highlightLongPressGestureRecognizer || preventedGestureRecognizer == _longPressGestureRecognizer))
     1958    if ((preventingGestureRecognizer == _textInteractionAssistant.get().loupeGesture || isForcePressGesture) && (preventedGestureRecognizer == _highlightLongPressGestureRecognizer || preventedGestureRecognizer == _longPressGestureRecognizer))
    19591959        return NO;
    19601960
     
    19791979#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 120000
    19801980#if PLATFORM(MACCATALYST)
    1981     if (isSamePair(gestureRecognizer, otherGestureRecognizer, _textSelectionAssistant.get().loupeGesture, _textSelectionAssistant.get().forcePressGesture))
     1981    if (isSamePair(gestureRecognizer, otherGestureRecognizer, _textInteractionAssistant.get().loupeGesture, _textInteractionAssistant.get().forcePressGesture))
    19821982        return YES;
    19831983
    1984     if (isSamePair(gestureRecognizer, otherGestureRecognizer, _singleTapGestureRecognizer.get(), _textSelectionAssistant.get().loupeGesture))
     1984    if (isSamePair(gestureRecognizer, otherGestureRecognizer, _singleTapGestureRecognizer.get(), _textInteractionAssistant.get().loupeGesture))
    19851985        return YES;
    19861986
     
    19881988        return YES;
    19891989#endif
    1990     if (isSamePair(gestureRecognizer, otherGestureRecognizer, _highlightLongPressGestureRecognizer.get(), _textSelectionAssistant.get().forcePressGesture))
     1990    if (isSamePair(gestureRecognizer, otherGestureRecognizer, _highlightLongPressGestureRecognizer.get(), _textInteractionAssistant.get().forcePressGesture))
    19911991        return YES;
    19921992#endif
    1993     if (isSamePair(gestureRecognizer, otherGestureRecognizer, _singleTapGestureRecognizer.get(), _textSelectionAssistant.get().singleTapGesture))
     1993    if (isSamePair(gestureRecognizer, otherGestureRecognizer, _singleTapGestureRecognizer.get(), _textInteractionAssistant.get().singleTapGesture))
    19941994        return YES;
    19951995
     
    21862186    NSMutableArray *textSelectionRects = [NSMutableArray array];
    21872187
    2188     if (_textSelectionAssistant) {
    2189         for (WKTextSelectionRect *selectionRect in [_textSelectionAssistant valueForKeyPath:@"selectionView.selection.selectionRects"])
     2188    if (_textInteractionAssistant) {
     2189        for (WKTextSelectionRect *selectionRect in [_textInteractionAssistant valueForKeyPath:@"selectionView.selection.selectionRects"])
    21902190            [textSelectionRects addObject:[NSValue valueWithCGRect:selectionRect.webRect.rect]];
    21912191    }
     
    24172417                return NO;
    24182418
    2419             switch ([_textSelectionAssistant loupeGesture].state) {
     2419            switch ([_textInteractionAssistant loupeGesture].state) {
    24202420            case UIGestureRecognizerStateBegan:
    24212421            case UIGestureRecognizerStateChanged:
     
    27402740- (void)setUpTextSelectionAssistant
    27412741{
    2742     if (!_textSelectionAssistant)
    2743         _textSelectionAssistant = adoptNS([[UIWKTextInteractionAssistant alloc] initWithView:self]);
     2742    if (!_textInteractionAssistant)
     2743        _textInteractionAssistant = adoptNS([[UIWKTextInteractionAssistant alloc] initWithView:self]);
    27442744    else {
    27452745        // Reset the gesture recognizers in case editability has changed.
    2746         [_textSelectionAssistant setGestureRecognizers];
     2746        [_textInteractionAssistant setGestureRecognizers];
    27472747    }
    27482748}
     
    27782778- (void)_willStartScrollingOrZooming
    27792779{
    2780     if ([_textSelectionAssistant respondsToSelector:@selector(willStartScrollingOrZooming)])
    2781         [_textSelectionAssistant willStartScrollingOrZooming];
     2780    if ([_textInteractionAssistant respondsToSelector:@selector(willStartScrollingOrZooming)])
     2781        [_textInteractionAssistant willStartScrollingOrZooming];
    27822782    else
    2783         [_textSelectionAssistant willStartScrollingOverflow];
     2783        [_textInteractionAssistant willStartScrollingOverflow];
    27842784    _page->setIsScrollingOrZooming(true);
    27852785
     
    28012801{
    28022802    if (!_needsDeferredEndScrollingSelectionUpdate) {
    2803         if ([_textSelectionAssistant respondsToSelector:@selector(didEndScrollingOrZooming)])
    2804             [_textSelectionAssistant didEndScrollingOrZooming];
     2803        if ([_textInteractionAssistant respondsToSelector:@selector(didEndScrollingOrZooming)])
     2804            [_textInteractionAssistant didEndScrollingOrZooming];
    28052805        else
    2806             [_textSelectionAssistant didEndScrollingOverflow];
     2806            [_textInteractionAssistant didEndScrollingOverflow];
    28072807    }
    28082808    _page->setIsScrollingOrZooming(false);
     
    29312931        NSRange selectedRangeInContext = NSMakeRange(textBefore.length(), selectedText.length());
    29322932
    2933         if (auto textSelectionAssistant = view->_textSelectionAssistant)
     2933        if (auto textSelectionAssistant = view->_textInteractionAssistant)
    29342934            [textSelectionAssistant lookup:selectionContext withRange:selectedRangeInContext fromRect:presentationRect];
    29352935    });
     
    29432943            return;
    29442944
    2945         if (!view->_textSelectionAssistant || !string || view->_page->editorState().isMissingPostLayoutData)
     2945        if (!view->_textInteractionAssistant || !string || view->_page->editorState().isMissingPostLayoutData)
    29462946            return;
    29472947
     
    29502950            return;
    29512951
    2952         [view->_textSelectionAssistant showShareSheetFor:string fromRect:selectionRects.first().rect()];
     2952        [view->_textInteractionAssistant showShareSheetFor:string fromRect:selectionRects.first().rect()];
    29532953    });
    29542954}
     
    29562956- (void)_addShortcutForWebView:(id)sender
    29572957{
    2958     if (_textSelectionAssistant)
    2959         [_textSelectionAssistant showTextServiceFor:[self selectedText] fromRect:_page->editorState().postLayoutData().selectionRects[0].rect()];
     2958    if (_textInteractionAssistant)
     2959        [_textInteractionAssistant showTextServiceFor:[self selectedText] fromRect:_page->editorState().postLayoutData().selectionRects[0].rect()];
    29602960}
    29612961
     
    30033003        return;
    30043004
    3005     [_textSelectionAssistant scheduleReplacementsForText:wordAtSelection];
     3005    [_textInteractionAssistant scheduleReplacementsForText:wordAtSelection];
    30063006}
    30073007
    30083008- (void)_transliterateChineseForWebView:(id)sender
    30093009{
    3010     [_textSelectionAssistant scheduleChineseTransliterationForText:_page->editorState().postLayoutData().wordAtSelection];
     3010    [_textInteractionAssistant scheduleChineseTransliterationForText:_page->editorState().postLayoutData().wordAtSelection];
    30113011}
    30123012
     
    31603160    BOOL shouldUpdateTextSelection = self.isFirstResponder && [self canShowNonEmptySelectionView];
    31613161    if (shouldUpdateTextSelection)
    3162         [_textSelectionAssistant deactivateSelection];
     3162        [_textInteractionAssistant deactivateSelection];
    31633163    [self _updateInteractionTintColor];
    31643164    if (shouldUpdateTextSelection)
    3165         [_textSelectionAssistant activateSelection];
     3165        [_textInteractionAssistant activateSelection];
    31663166}
    31673167
     
    33843384{
    33853385    _showingTextStyleOptions = NO;
    3386     [_textSelectionAssistant hideTextStyleOptions];
     3386    [_textInteractionAssistant hideTextStyleOptions];
    33873387}
    33883388
     
    34193419- (void)selectForWebView:(id)sender
    34203420{
    3421     [_textSelectionAssistant selectWord];
     3421    [_textInteractionAssistant selectWord];
    34223422    // We cannot use selectWord command, because we want to be able to select the word even when it is the last in the paragraph.
    34233423    _page->extendSelection(WebCore::WordGranularity);
     
    34263426- (void)selectAllForWebView:(id)sender
    34273427{
    3428     [_textSelectionAssistant selectAll:sender];
     3428    [_textInteractionAssistant selectAll:sender];
    34293429    _page->selectAll();
    34303430}
     
    34733473{
    34743474    _showingTextStyleOptions = YES;
    3475     [_textSelectionAssistant showTextStyleOptions];
     3475    [_textInteractionAssistant showTextStyleOptions];
    34763476}
    34773477
     
    34793479{
    34803480    CGRect presentationRect = _page->editorState().postLayoutData().selectionRects[0].rect();
    3481     if (_textSelectionAssistant)
    3482         [_textSelectionAssistant showDictionaryFor:text fromRect:presentationRect];
     3481    if (_textInteractionAssistant)
     3482        [_textInteractionAssistant showDictionaryFor:text fromRect:presentationRect];
    34833483}
    34843484
     
    48194819- (UITextInteractionAssistant *)interactionAssistant
    48204820{
    4821     return _textSelectionAssistant.get();
     4821    return _textInteractionAssistant.get();
    48224822}
    48234823
     
    53525352   
    53535353    if (self.isFirstResponder && !_suppressSelectionAssistantReasons)
    5354         [_textSelectionAssistant activateSelection];
     5354        [_textInteractionAssistant activateSelection];
    53555355
    53565356#if !PLATFORM(WATCHOS)
     
    53645364    [self setUpTextSelectionAssistant];
    53655365   
    5366     [_textSelectionAssistant deactivateSelection];
     5366    [_textInteractionAssistant deactivateSelection];
    53675367    [_formAccessoryView hideAutoFillButton];
    53685368
     
    62346234
    62356235        // FIXME: We need to figure out what to do if the selection is changed by Javascript.
    6236         if (_textSelectionAssistant) {
     6236        if (_textInteractionAssistant) {
    62376237            _markedText = (_page->editorState().hasComposition) ? _page->editorState().markedText : String();
    6238             [_textSelectionAssistant selectionChanged];
     6238            [_textInteractionAssistant selectionChanged];
    62396239        }
    62406240
    62416241        _selectionNeedsUpdate = NO;
    62426242        if (_shouldRestoreSelection) {
    6243             [_textSelectionAssistant didEndScrollingOverflow];
     6243            [_textInteractionAssistant didEndScrollingOverflow];
    62446244            _shouldRestoreSelection = NO;
    62456245        }
     
    62506250
    62516251        if (!_suppressSelectionAssistantReasons)
    6252             [_textSelectionAssistant activateSelection];
    6253 
    6254         [_textSelectionAssistant didEndScrollingOverflow];
     6252            [_textInteractionAssistant activateSelection];
     6253
     6254        [_textInteractionAssistant didEndScrollingOverflow];
    62556255
    62566256        _needsDeferredEndScrollingSelectionUpdate = NO;
     
    62806280
    62816281    if (!wasSuppressingSelectionAssistant)
    6282         [_textSelectionAssistant deactivateSelection];
     6282        [_textInteractionAssistant deactivateSelection];
    62836283}
    62846284
     
    62896289
    62906290    if (wasSuppressingSelectionAssistant && !_suppressSelectionAssistantReasons)
    6291         [_textSelectionAssistant activateSelection];
     6291        [_textInteractionAssistant activateSelection];
    62926292}
    62936293
     
    70427042
    70437043    // FIXME: This SPI should be renamed in UIKit to reflect a more general purpose of revealing hidden interaction assistant controls.
    7044     [_textSelectionAssistant didEndScrollingOverflow];
     7044    [_textInteractionAssistant didEndScrollingOverflow];
    70457045    _shouldRestoreCalloutBarAfterDrop = NO;
    70467046}
     
    73477347    if (!_shouldRestoreCalloutBarAfterDrop && _dragDropInteractionState.anyActiveDragSourceIs(WebCore::DragSourceActionSelection)) {
    73487348        // FIXME: This SPI should be renamed in UIKit to reflect a more general purpose of hiding interaction assistant controls.
    7349         [_textSelectionAssistant willStartScrollingOverflow];
     7349        [_textInteractionAssistant willStartScrollingOverflow];
    73507350        _shouldRestoreCalloutBarAfterDrop = YES;
    73517351    }
Note: See TracChangeset for help on using the changeset viewer.