Title: [231726] trunk/Source/WebKit
Revision
231726
Author
[email protected]
Date
2018-05-11 16:03:00 -0700 (Fri, 11 May 2018)

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

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (231725 => 231726)


--- trunk/Source/WebKit/ChangeLog	2018-05-11 23:01:37 UTC (rev 231725)
+++ trunk/Source/WebKit/ChangeLog	2018-05-11 23:03:00 UTC (rev 231726)
@@ -1,3 +1,16 @@
+2018-05-11  Megan Gardner  <[email protected]>
+
+        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:]):
+
 2018-05-11  Brady Eidson  <[email protected]>
 
         Followup to: Make sure history navigations reuse the existing process when necessary.

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (231725 => 231726)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2018-05-11 23:01:37 UTC (rev 231725)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2018-05-11 23:03:00 UTC (rev 231726)
@@ -2209,8 +2209,6 @@
 
 - (BOOL)canPerformActionForWebView:(SEL)action withSender:(id)sender
 {
-    BOOL hasWebSelection = _webSelectionAssistant && !CGRectIsEmpty(_webSelectionAssistant.get().selectionFrame);
-
     if (action == @selector(_arrowKey:))
         return [self isFirstResponder];
         
@@ -2235,11 +2233,11 @@
     if (action == @selector(copy:)) {
         if (_page->editorState().isInPasswordField)
             return NO;
-        return hasWebSelection || _page->editorState().selectionIsRange;
+        return _page->editorState().selectionIsRange;
     }
 
     if (action == @selector(_define:)) {
-        if (_page->editorState().isInPasswordField || !(hasWebSelection || _page->editorState().selectionIsRange))
+        if (_page->editorState().isInPasswordField || !_page->editorState().selectionIsRange)
             return NO;
 
         NSUInteger textLength = _page->editorState().postLayoutData().selectedTextLength;
@@ -2266,11 +2264,11 @@
             return NO;
 #endif
 
-        return hasWebSelection || _page->editorState().selectionIsRange;
+        return _page->editorState().selectionIsRange;
     }
 
     if (action == @selector(_share:)) {
-        if (_page->editorState().isInPasswordField || !(hasWebSelection || _page->editorState().selectionIsRange))
+        if (_page->editorState().isInPasswordField || !_page->editorState().selectionIsRange)
             return NO;
 
         return _page->editorState().postLayoutData().selectedTextLength > 0;
@@ -2277,7 +2275,7 @@
     }
 
     if (action == @selector(_addShortcut:)) {
-        if (_page->editorState().isInPasswordField || !(hasWebSelection || _page->editorState().selectionIsRange))
+        if (_page->editorState().isInPasswordField || !_page->editorState().selectionIsRange)
             return NO;
 
         NSString *selectedText = [self selectedText];
@@ -2311,19 +2309,9 @@
     }
 
     if (action == @selector(selectAll:)) {
-        if (_page->editorState().selectionIsNone || ![self hasContent])
-            return NO;
-        if (!_page->editorState().selectionIsRange)
+        if (!_page->editorState().selectionIsNone && !_page->editorState().selectionIsRange)
             return YES;
-        // Enable selectAll for non-editable text, where the user can't access
-        // this command via long-press to get a caret.
-        if (_page->editorState().isContentEditable)
-            return NO;
-        // Don't attempt selectAll with general web content.
-        if (hasWebSelection)
-            return NO;
-        // FIXME: Only enable if the selection doesn't already span the entire document.
-        return YES;
+        return NO;
     }
 
     if (action == @selector(replace:))
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to