Changeset 231726 in webkit


Ignore:
Timestamp:
May 11, 2018 4:03:00 PM (6 years ago)
Author:
Megan Gardner
Message:

Cleanup canPerformActionForWebView in relation to the webSelectionAssistant being removed
https://bugs.webkit.org/show_bug.cgi?id=185536

Reviewed by Tim Horton.

The _webSelectionAssistant is now always nil, therefor many of these checks are unnecessary.
Remove the check for a webSelection and clean up the logic surrounding those checks.

  • UIProcess/ios/WKContentViewInteraction.mm:

(-[WKContentView canPerformActionForWebView:withSender:]):

Location:
trunk/Source/WebKit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r231723 r231726  
     12018-05-11  Megan Gardner  <megan_gardner@apple.com>
     2
     3        Cleanup canPerformActionForWebView in relation to the webSelectionAssistant being removed
     4        https://bugs.webkit.org/show_bug.cgi?id=185536
     5
     6        Reviewed by Tim Horton.
     7       
     8        The _webSelectionAssistant is now always nil, therefor many of these checks are unnecessary.
     9        Remove the check for a webSelection and clean up the logic surrounding those checks.
     10
     11        * UIProcess/ios/WKContentViewInteraction.mm:
     12        (-[WKContentView canPerformActionForWebView:withSender:]):
     13
    1142018-05-11  Brady Eidson  <beidson@apple.com>
    215
  • trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm

    r231664 r231726  
    22102210- (BOOL)canPerformActionForWebView:(SEL)action withSender:(id)sender
    22112211{
    2212     BOOL hasWebSelection = _webSelectionAssistant && !CGRectIsEmpty(_webSelectionAssistant.get().selectionFrame);
    2213 
    22142212    if (action == @selector(_arrowKey:))
    22152213        return [self isFirstResponder];
     
    22362234        if (_page->editorState().isInPasswordField)
    22372235            return NO;
    2238         return hasWebSelection || _page->editorState().selectionIsRange;
     2236        return _page->editorState().selectionIsRange;
    22392237    }
    22402238
    22412239    if (action == @selector(_define:)) {
    2242         if (_page->editorState().isInPasswordField || !(hasWebSelection || _page->editorState().selectionIsRange))
     2240        if (_page->editorState().isInPasswordField || !_page->editorState().selectionIsRange)
    22432241            return NO;
    22442242
     
    22672265#endif
    22682266
    2269         return hasWebSelection || _page->editorState().selectionIsRange;
     2267        return _page->editorState().selectionIsRange;
    22702268    }
    22712269
    22722270    if (action == @selector(_share:)) {
    2273         if (_page->editorState().isInPasswordField || !(hasWebSelection || _page->editorState().selectionIsRange))
     2271        if (_page->editorState().isInPasswordField || !_page->editorState().selectionIsRange)
    22742272            return NO;
    22752273
     
    22782276
    22792277    if (action == @selector(_addShortcut:)) {
    2280         if (_page->editorState().isInPasswordField || !(hasWebSelection || _page->editorState().selectionIsRange))
     2278        if (_page->editorState().isInPasswordField || !_page->editorState().selectionIsRange)
    22812279            return NO;
    22822280
     
    23122310
    23132311    if (action == @selector(selectAll:)) {
    2314         if (_page->editorState().selectionIsNone || ![self hasContent])
    2315             return NO;
    2316         if (!_page->editorState().selectionIsRange)
     2312        if (!_page->editorState().selectionIsNone && !_page->editorState().selectionIsRange)
    23172313            return YES;
    2318         // Enable selectAll for non-editable text, where the user can't access
    2319         // this command via long-press to get a caret.
    2320         if (_page->editorState().isContentEditable)
    2321             return NO;
    2322         // Don't attempt selectAll with general web content.
    2323         if (hasWebSelection)
    2324             return NO;
    2325         // FIXME: Only enable if the selection doesn't already span the entire document.
    2326         return YES;
     2314        return NO;
    23272315    }
    23282316
Note: See TracChangeset for help on using the changeset viewer.