Changeset 246908 in webkit


Ignore:
Timestamp:
Jun 27, 2019 4:06:52 PM (5 years ago)
Author:
dbates@webkit.org
Message:

[iOS] Select all with existing range selection replaces range instead of selecting all text
https://bugs.webkit.org/show_bug.cgi?id=197950
<rdar://problem/50245131>

Reviewed by Wenson Hsieh.

Source/WebKit:

Following <rdar://problem/47333786>, UIKit now asks WebKit whether it can handle Command + A as
"select all" instead of just demanding that we handle it. So, WebKit needs to be able to correctly
tell UIKit in advance whether it can handle it. Currenlty WebKit tells UIKit it cannot handle a
"select all" whenever there is an existing range selection. So, UIKit does not tell WebKit to
perform the "select all". Moreover, since UIKit has no other means to handle this key command
itself it tells WebKit the key command was not handled. So, WebKit tells the keyboard to insert
the "a". Instead, WebKit should tell UIKit it can handle a "select all" even when this is an
existing range selection. However we need to keep the current logic just for when UIKit is
asking us with respect to populating the callout menu to not regress platform behavior.

  • UIProcess/ios/WKContentViewInteraction.mm:

(-[WKContentView canPerformActionForWebView:withSender:]): Do what we do now if we are called
when populating the callout menu and action is Select All. Otherwise, return YES for the Select All
action if we have a non-empty selection.

LayoutTests:

Add a test to ensure that pressing Command + A performs a "select all" even when there
is an existing range selection.

  • fast/events/ios/select-all-with-existing-selection-expected.txt: Added.
  • fast/events/ios/select-all-with-existing-selection.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r246904 r246908  
     12019-06-27  Daniel Bates  <dabates@apple.com>
     2
     3        [iOS] Select all with existing range selection replaces range instead of selecting all text
     4        https://bugs.webkit.org/show_bug.cgi?id=197950
     5        <rdar://problem/50245131>
     6
     7        Reviewed by Wenson Hsieh.
     8
     9        Add a test to ensure that pressing Command + A performs a "select all" even when there
     10        is an existing range selection.
     11
     12        * fast/events/ios/select-all-with-existing-selection-expected.txt: Added.
     13        * fast/events/ios/select-all-with-existing-selection.html: Added.
     14
    1152019-06-27  Russell Epstein  <russell_e@apple.com>
    216
  • trunk/Source/WebKit/ChangeLog

    r246907 r246908  
     12019-06-27  Daniel Bates  <dabates@apple.com>
     2
     3        [iOS] Select all with existing range selection replaces range instead of selecting all text
     4        https://bugs.webkit.org/show_bug.cgi?id=197950
     5        <rdar://problem/50245131>
     6
     7        Reviewed by Wenson Hsieh.
     8
     9        Following <rdar://problem/47333786>, UIKit now asks WebKit whether it can handle Command + A as
     10        "select all" instead of just demanding that we handle it. So, WebKit needs to be able to correctly
     11        tell UIKit in advance whether it can handle it. Currenlty WebKit tells UIKit it cannot handle a
     12        "select all" whenever there is an existing range selection. So, UIKit does not tell WebKit to
     13        perform the "select all". Moreover, since UIKit has no other means to handle this key command
     14        itself it tells WebKit the key command was not handled. So, WebKit tells the keyboard to insert
     15        the "a". Instead, WebKit should tell UIKit it can handle a "select all" even when this is an
     16        existing range selection. However we need to keep the current logic just for when UIKit is
     17        asking us with respect to populating the callout menu to not regress platform behavior.
     18
     19        * UIProcess/ios/WKContentViewInteraction.mm:
     20        (-[WKContentView canPerformActionForWebView:withSender:]): Do what we do now if we are called
     21        when populating the callout menu and action is Select All. Otherwise, return YES for the Select All
     22        action if we have a non-empty selection.
     23
    1242019-06-27  Andy Estes  <aestes@apple.com>
    225
  • trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm

    r246907 r246908  
    30523052
    30533053    if (action == @selector(selectAll:)) {
    3054         if (!editorState.selectionIsNone && !editorState.selectionIsRange)
    3055             return YES;
    3056         return NO;
     3054        // By platform convention we don't show Select All in the callout menu for a range selection.
     3055        if ([sender isKindOfClass:UIMenuController.class])
     3056            return !editorState.selectionIsNone && !editorState.selectionIsRange;
     3057        return !editorState.selectionIsNone && self.hasContent;
    30573058    }
    30583059
Note: See TracChangeset for help on using the changeset viewer.