Changeset 245882 in webkit


Ignore:
Timestamp:
May 29, 2019 7:41:10 PM (5 years ago)
Author:
Wenson Hsieh
Message:

Remove some logic to suppress the text selection assistant during drop
https://bugs.webkit.org/show_bug.cgi?id=198354

Reviewed by Tim Horton.

Source/WebKit:

This logic was originally added to hide the ranged selection after performing a drop in editable content.
However, after r245803, we (1) no longer show the keyboard and/or text selection views when dropping, and (2)
the final selection is now a caret, so it's no longer necessary to suppress the selection assistant.

  • UIProcess/ios/WKContentViewInteraction.h:
  • UIProcess/ios/WKContentViewInteraction.mm:

(-[WKContentView dropInteraction:performDrop:]):
(-[WKContentView dropInteraction:concludeDrop:]):

Tools:

Adjust some API tests that currently check whether or not the selection assistant was suppressed during drop.

  • TestWebKitAPI/Tests/ios/DragAndDropTestsIOS.mm:

(TestWebKitAPI::TEST):

  • TestWebKitAPI/cocoa/DragAndDropSimulator.h:
  • TestWebKitAPI/ios/DragAndDropSimulatorIOS.mm:

(-[DragAndDropSimulator _resetSimulatedState]):
(-[DragAndDropSimulator _webView:dataInteractionOperationWasHandled:forSession:itemProviders:]):

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r245881 r245882  
     12019-05-29  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        Remove some logic to suppress the text selection assistant during drop
     4        https://bugs.webkit.org/show_bug.cgi?id=198354
     5
     6        Reviewed by Tim Horton.
     7
     8        This logic was originally added to hide the ranged selection after performing a drop in editable content.
     9        However, after r245803, we (1) no longer show the keyboard and/or text selection views when dropping, and (2)
     10        the final selection is now a caret, so it's no longer necessary to suppress the selection assistant.
     11
     12        * UIProcess/ios/WKContentViewInteraction.h:
     13        * UIProcess/ios/WKContentViewInteraction.mm:
     14        (-[WKContentView dropInteraction:performDrop:]):
     15        (-[WKContentView dropInteraction:concludeDrop:]):
     16
    1172019-05-29  Sihui Liu  <sihui_liu@apple.com>
    218
  • trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h

    r245778 r245882  
    166166    EditableRootIsTransparentOrFullyClipped = 1 << 0,
    167167    FocusedElementIsTooSmall = 1 << 1,
    168     DropAnimationIsRunning = 1 << 2,
    169     InteractionIsHappening = 1 << 3
     168    InteractionIsHappening = 1 << 2
    170169};
    171170
  • trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm

    r245803 r245882  
    68926892        retainedSelf->_page->createSandboxExtensionsIfNeeded(filenames, sandboxExtensionHandle, sandboxExtensionForUpload);
    68936893        retainedSelf->_page->performDragOperation(capturedDragData, "data interaction pasteboard", WTFMove(sandboxExtensionHandle), WTFMove(sandboxExtensionForUpload));
    6894 
    68956894        retainedSelf->_visibleContentViewSnapshot = [retainedSelf snapshotViewAfterScreenUpdates:NO];
    6896         [retainedSelf _startSuppressingSelectionAssistantForReason:WebKit::DropAnimationIsRunning];
    68976895        [UIView performWithoutAnimation:[retainedSelf] {
    68986896            [retainedSelf->_visibleContentViewSnapshot setFrame:[retainedSelf bounds]];
     
    69116909- (void)dropInteraction:(UIDropInteraction *)interaction concludeDrop:(id <UIDropSession>)session
    69126910{
    6913     [self _stopSuppressingSelectionAssistantForReason:WebKit::DropAnimationIsRunning];
    69146911    [std::exchange(_visibleContentViewSnapshot, nil) removeFromSuperview];
    69156912    [std::exchange(_unselectedContentSnapshot, nil) removeFromSuperview];
  • trunk/Tools/ChangeLog

    r245881 r245882  
     12019-05-29  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        Remove some logic to suppress the text selection assistant during drop
     4        https://bugs.webkit.org/show_bug.cgi?id=198354
     5
     6        Reviewed by Tim Horton.
     7
     8        Adjust some API tests that currently check whether or not the selection assistant was suppressed during drop.
     9
     10        * TestWebKitAPI/Tests/ios/DragAndDropTestsIOS.mm:
     11        (TestWebKitAPI::TEST):
     12        * TestWebKitAPI/cocoa/DragAndDropSimulator.h:
     13        * TestWebKitAPI/ios/DragAndDropSimulatorIOS.mm:
     14        (-[DragAndDropSimulator _resetSimulatedState]):
     15        (-[DragAndDropSimulator _webView:dataInteractionOperationWasHandled:forSession:itemProviders:]):
     16
    1172019-05-29  Sihui Liu  <sihui_liu@apple.com>
    218
  • trunk/Tools/TestWebKitAPI/Tests/ios/DragAndDropTestsIOS.mm

    r245803 r245882  
    371371    [simulator runFrom:CGPointMake(100, 50) to:CGPointMake(100, 300)];
    372372
    373     EXPECT_TRUE([simulator suppressedSelectionCommandsDuringDrop]);
    374373    EXPECT_EQ([webView stringByEvaluatingJavaScript:@"source.textContent"].length, 0UL);
    375374    EXPECT_WK_STREQ("Hello world", [webView stringByEvaluatingJavaScript:@"editor.textContent"].UTF8String);
     
    395394    [simulator runFrom:CGPointMake(100, 50) to:CGPointMake(100, 300)];
    396395
    397     EXPECT_TRUE([simulator suppressedSelectionCommandsDuringDrop]);
    398396    EXPECT_EQ([webView stringByEvaluatingJavaScript:@"source.textContent"].length, 0UL);
    399397    EXPECT_WK_STREQ("Hello world", [webView editorValue].UTF8String);
     
    456454    NSUInteger secondParagraphOffset = [finalTextContent rangeOfString:@"This is the second paragraph"].location;
    457455
    458     EXPECT_TRUE([simulator suppressedSelectionCommandsDuringDrop]);
    459456    EXPECT_FALSE(firstParagraphOffset == NSNotFound);
    460457    EXPECT_FALSE(secondParagraphOffset == NSNotFound);
     
    483480    [simulator runFrom:CGPointMake(100, 50) to:CGPointMake(100, 300)];
    484481
    485     EXPECT_TRUE([simulator suppressedSelectionCommandsDuringDrop]);
    486482    EXPECT_EQ([webView stringByEvaluatingJavaScript:@"source.value"].length, 0UL);
    487483    EXPECT_WK_STREQ("Hello world", [webView editorValue].UTF8String);
     
    499495    [webView stringByEvaluatingJavaScript:@"source.selectionEnd = source.value.length"];
    500496    [simulator runFrom:CGPointMake(100, 50) to:CGPointMake(100, 300)];
    501 
    502     EXPECT_TRUE([simulator suppressedSelectionCommandsDuringDrop]);
    503497
    504498    NSItemProvider *itemProvider = [simulator sourceItemProviders].firstObject;
     
    521515    [webView stringByEvaluatingJavaScript:@"source.selectionEnd = source.value.length"];
    522516    [simulator runFrom:CGPointMake(100, 50) to:CGPointMake(100, 300)];
    523 
    524     EXPECT_TRUE([simulator suppressedSelectionCommandsDuringDrop]);
    525517
    526518    NSItemProvider *itemProvider = [simulator sourceItemProviders].firstObject;
  • trunk/Tools/TestWebKitAPI/cocoa/DragAndDropSimulator.h

    r245803 r245882  
    114114@property (nonatomic, readonly) NSArray *dropPreviews;
    115115@property (nonatomic, readonly) NSArray *delayedDropPreviews;
    116 @property (nonatomic, readonly) BOOL suppressedSelectionCommandsDuringDrop;
    117116
    118117#endif // PLATFORM(IOS_FAMILY)
  • trunk/Tools/TestWebKitAPI/ios/DragAndDropSimulatorIOS.mm

    r245803 r245882  
    324324    DragAndDropPhase _phase;
    325325
    326     BOOL _suppressedSelectionCommandsDuringDrop;
    327326    RetainPtr<UIDropProposal> _lastKnownDropProposal;
    328327
     
    374373- (void)_resetSimulatedState
    375374{
    376     _suppressedSelectionCommandsDuringDrop = NO;
    377375    _phase = DragAndDropPhaseBeginning;
    378376    _currentProgress = 0;
     
    764762- (void)_webView:(WKWebView *)webView dataInteractionOperationWasHandled:(BOOL)handled forSession:(id)session itemProviders:(NSArray<NSItemProvider *> *)itemProviders
    765763{
    766     _suppressedSelectionCommandsDuringDrop = [_webView textInputContentView]._shouldSuppressSelectionCommands;
    767 
    768764    if (self.dropCompletionBlock)
    769765        self.dropCompletionBlock(handled, itemProviders);
Note: See TracChangeset for help on using the changeset viewer.