Changeset 230850 in webkit


Ignore:
Timestamp:
Apr 20, 2018, 1:40:51 PM (7 years ago)
Author:
Megan Gardner
Message:

Fixes for failing tests associated with switching Text Selection Assistants
https://bugs.webkit.org/show_bug.cgi?id=184806
<rdar://problem/39367905>

Reviewed by Beth Dakin and Wenson Hsieh.

The major fix is the disabling the double tap noneditable text selection gesture.
The other fixes are small tweaks that shouldn't even be run into with the fix to
the double tap gesture, but they are incorrect, so I am taking the opportunity to
fix them now, in case we run into them again.

  • UIProcess/ios/WKContentViewInteraction.mm:

(-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
We should not be allowing a double tap text gestures in non-editable web content.
We didn't have one with the old assistant. Fortunately, this is easily disabled.
(-[WKContentView canPerformActionForWebView:withSender:]):
We should not allow the lookup action if we do not actually have a selection.
It is meaningless without one.
(-[WKContentView selectedTextRange]):
We should not return a selection to UIKit if all we have is caret selection
in non-editable content. We have this for selections on Mac, but UIKit does
not know how to properly handle this, and will have incorrect behavior if we
return a valid selection.

Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/resources/basic-gestures.js

    r230746 r230850  
    1919                uiController.singleTapAtPoint(${x}, ${y}, () => { });
    2020                uiController.singleTapAtPoint(${x}, ${y}, () => { });
     21            })();`, resolve);
     22    });
     23}
     24
     25function doubleTapAtPoint(x, y)
     26{
     27    return new Promise(resolve => {
     28        testRunner.runUIScript(`
     29            (function() {
     30                uiController.doubleTapAtPoint(${x}, ${y}, function() {
     31                    uiController.uiScriptComplete();
     32                });
    2133            })();`, resolve);
    2234    });
  • trunk/Source/WebKit/ChangeLog

    r230849 r230850  
     12018-04-20  Megan Gardner  <megan_gardner@apple.com>
     2
     3        Fixes for failing tests associated with switching Text Selection Assistants
     4        https://bugs.webkit.org/show_bug.cgi?id=184806
     5        <rdar://problem/39367905>
     6
     7        Reviewed by Beth Dakin and Wenson Hsieh.
     8       
     9        The major fix is the disabling the double tap noneditable text selection gesture.
     10        The other fixes are small tweaks that shouldn't even be run into with the fix to
     11        the double tap gesture, but they are incorrect, so I am taking the opportunity to
     12        fix them now, in case we run into them again.
     13
     14        * UIProcess/ios/WKContentViewInteraction.mm:
     15        (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
     16        We should not be allowing a double tap text gestures in non-editable web content.
     17        We didn't have one with the old assistant. Fortunately, this is easily disabled.
     18        (-[WKContentView canPerformActionForWebView:withSender:]):
     19        We should not allow the lookup action if we do not actually have a selection.
     20        It is meaningless without one.
     21        (-[WKContentView selectedTextRange]):
     22        We should not return a selection to UIKit if all we have is caret selection
     23        in non-editable content. We have this for selections on Mac, but UIKit does
     24        not know how to properly handle this, and will have incorrect behavior if we
     25        return a valid selection.
     26
    1272018-04-20  Timothy Hatcher  <timothy@apple.com>
    228
  • trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm

    r230766 r230850  
    16571657    if (self.isAssistingNode)
    16581658        return _positionInformation.nodeAtPositionIsAssistedNode;
     1659   
     1660    // Don't allow double tap text gestures in noneditable content.
     1661    if (gesture == UIWKGestureDoubleTap)
     1662        return NO;
    16591663
    16601664    // If we're selecting something, don't activate highlight.
     
    22472251#endif
    22482252
    2249         return YES;
     2253        return hasWebSelection || _page->editorState().selectionIsRange;
    22502254    }
    22512255
     
    31463150    if (_page->editorState().selectionIsNone || _page->editorState().isMissingPostLayoutData)
    31473151        return nil;
     3152    // UIKit does not expect caret selections in noneditable content.
     3153    if (!_page->editorState().isContentEditable && !_page->editorState().selectionIsRange)
     3154        return nil;
     3155   
    31483156    auto& postLayoutEditorStateData = _page->editorState().postLayoutData();
    31493157    FloatRect startRect = postLayoutEditorStateData.caretRectAtStart;
Note: See TracChangeset for help on using the changeset viewer.