Changeset 263693 in webkit


Ignore:
Timestamp:
Jun 29, 2020 2:26:11 PM (4 years ago)
Author:
Wenson Hsieh
Message:

[iOS] editing/selection/ios/select-text-after-changing-focus.html sometimes fails
https://bugs.webkit.org/show_bug.cgi?id=213745
Work towards <rdar://problem/64808138>

Reviewed by Tim Horton.

Source/WebKit:

This test first taps an input field to focus it, taps a button below the input field to focus the button and
dismiss the keyboard, and finally long presses to select a word below the button. On recent iOS 14 builds, this
test occasionally fails due to recent changes in UIKit that may cause the callout bar appearance callback to
fire after focusing the input field. If this happens, we end up showing the callout bar with a single option to
"Select All" (despite the field being empty), and the subsequent tap that's intended to hit the button instead
hit-tests to this callout bar item. The tests subsequently times out waiting for the keyboard to dismiss, which
never happens because the input field remains focused.

Showing the "Select All" callout bar option in empty text fields is inconsistent with the rest of the platform
(iOS), and appears to have been unintentionally introduced in iOS 12 by <https://trac.webkit.org/r231726>. While
it's still unknown which exact system changes caused this test to begin timing out, we can at least fix it by
addressing this existing regression in behavior.

  • UIProcess/ios/WKContentViewInteraction.mm:

(-[WKContentView canPerformActionForWebView:withSender:]):

Check -hasContent here, instead of just checking if the selection is a caret. Note that we don't need to check
whether the selection is none separately, since -hasContent will always return NO if there is no selection.

Tools:

See WebKit/ChangeLog for more details. If this test happens to be run after another test that has written
something to the pasteboard, it will still fail due to the callout menu showing up with the option to paste.
Mitigate this by clearing the contents of the system pasteboard between tests, such that content copied from
previous tests doesn't change the behavior of subsequent tests.

  • WebKitTestRunner/ios/TestControllerIOS.mm:

(WTR::TestController::platformResetStateToConsistentValues):

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r263688 r263693  
     12020-06-29  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        [iOS] editing/selection/ios/select-text-after-changing-focus.html sometimes fails
     4        https://bugs.webkit.org/show_bug.cgi?id=213745
     5        Work towards <rdar://problem/64808138>
     6
     7        Reviewed by Tim Horton.
     8
     9        This test first taps an input field to focus it, taps a button below the input field to focus the button and
     10        dismiss the keyboard, and finally long presses to select a word below the button. On recent iOS 14 builds, this
     11        test occasionally fails due to recent changes in UIKit that may cause the callout bar appearance callback to
     12        fire after focusing the input field. If this happens, we end up showing the callout bar with a single option to
     13        "Select All" (despite the field being empty), and the subsequent tap that's intended to hit the button instead
     14        hit-tests to this callout bar item. The tests subsequently times out waiting for the keyboard to dismiss, which
     15        never happens because the input field remains focused.
     16
     17        Showing the "Select All" callout bar option in empty text fields is inconsistent with the rest of the platform
     18        (iOS), and appears to have been unintentionally introduced in iOS 12 by <https://trac.webkit.org/r231726>. While
     19        it's still unknown which exact system changes caused this test to begin timing out, we can at least fix it by
     20        addressing this existing regression in behavior.
     21
     22        * UIProcess/ios/WKContentViewInteraction.mm:
     23        (-[WKContentView canPerformActionForWebView:withSender:]):
     24
     25        Check `-hasContent` here, instead of just checking if the selection is a caret. Note that we don't need to check
     26        whether the selection is none separately, since `-hasContent` will always return `NO` if there is no selection.
     27
    1282020-06-29  Sam Weinig  <weinig@apple.com>
    229
  • trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm

    r263630 r263693  
    34483448    if (action == @selector(select:)) {
    34493449        // Disable select in password fields so that you can't see word boundaries.
    3450         return !editorState.isInPasswordField && [self hasContent] && !editorState.selectionIsNone && !editorState.selectionIsRange;
     3450        return !editorState.isInPasswordField && !editorState.selectionIsRange && self.hasContent;
    34513451    }
    34523452
    34533453    if (action == @selector(selectAll:)) {
    3454         // By platform convention we don't show Select All in the callout menu for a range selection.
    3455         if ([sender isKindOfClass:UIMenuController.class])
    3456             return !editorState.selectionIsNone && !editorState.selectionIsRange;
    3457 #if USE(UIKIT_KEYBOARD_ADDITIONS)
     3454        if ([sender isKindOfClass:UIMenuController.class]) {
     3455            // By platform convention we don't show Select All in the callout menu for a range selection.
     3456            return !editorState.selectionIsRange && self.hasContent;
     3457        }
    34583458        return YES;
    3459 #else
    3460         return !editorState.selectionIsNone && self.hasContent;
    3461 #endif
    34623459    }
    34633460
  • trunk/Tools/ChangeLog

    r263684 r263693  
     12020-06-29  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        [iOS] editing/selection/ios/select-text-after-changing-focus.html sometimes fails
     4        https://bugs.webkit.org/show_bug.cgi?id=213745
     5        Work towards <rdar://problem/64808138>
     6
     7        Reviewed by Tim Horton.
     8
     9        See WebKit/ChangeLog for more details. If this test happens to be run after another test that has written
     10        something to the pasteboard, it will still fail due to the callout menu showing up with the option to paste.
     11        Mitigate this by clearing the contents of the system pasteboard between tests, such that content copied from
     12        previous tests doesn't change the behavior of subsequent tests.
     13
     14        * WebKitTestRunner/ios/TestControllerIOS.mm:
     15        (WTR::TestController::platformResetStateToConsistentValues):
     16
    1172020-06-29  Fujii Hironori  <Hironori.Fujii@sony.com>
    218
  • trunk/Tools/WebKitTestRunner/ios/TestControllerIOS.mm

    r263224 r263693  
    156156    cocoaResetStateToConsistentValues(options);
    157157
     158    [UIPasteboard generalPasteboard].items = @[ ];
    158159    [[UIApplication sharedApplication] _cancelAllTouches];
    159160    [[UIDevice currentDevice] setOrientation:UIDeviceOrientationPortrait animated:NO];
Note: See TracChangeset for help on using the changeset viewer.