Remove some logic to suppress the text selection assistant during drop
authorwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 30 May 2019 02:41:10 +0000 (02:41 +0000)
committerwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 30 May 2019 02:41:10 +0000 (02:41 +0000)
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:]):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245882 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/ChangeLog
Source/WebKit/UIProcess/ios/WKContentViewInteraction.h
Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/ios/DragAndDropTestsIOS.mm
Tools/TestWebKitAPI/cocoa/DragAndDropSimulator.h
Tools/TestWebKitAPI/ios/DragAndDropSimulatorIOS.mm

index 2e54e08..b3e3522 100644 (file)
@@ -1,3 +1,19 @@
+2019-05-29  Wenson Hsieh  <wenson_hsieh@apple.com>
+
+        Remove some logic to suppress the text selection assistant during drop
+        https://bugs.webkit.org/show_bug.cgi?id=198354
+
+        Reviewed by Tim Horton.
+
+        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:]):
+
 2019-05-29  Sihui Liu  <sihui_liu@apple.com>
 
         WKWebsiteDataStore API fails to fetch web storage data for non-persistent data store
index 08b64d2..31be4b5 100644 (file)
@@ -165,8 +165,7 @@ namespace WebKit {
 enum SuppressSelectionAssistantReason : uint8_t {
     EditableRootIsTransparentOrFullyClipped = 1 << 0,
     FocusedElementIsTooSmall = 1 << 1,
-    DropAnimationIsRunning = 1 << 2,
-    InteractionIsHappening = 1 << 3
+    InteractionIsHappening = 1 << 2
 };
 
 struct WKSelectionDrawingInfo {
index 89669dc..0d2d621 100644 (file)
@@ -6891,9 +6891,7 @@ static WebKit::DocumentEditingContextRequest toWebRequest(UIWKDocumentRequest *r
         WebKit::SandboxExtension::HandleArray sandboxExtensionForUpload;
         retainedSelf->_page->createSandboxExtensionsIfNeeded(filenames, sandboxExtensionHandle, sandboxExtensionForUpload);
         retainedSelf->_page->performDragOperation(capturedDragData, "data interaction pasteboard", WTFMove(sandboxExtensionHandle), WTFMove(sandboxExtensionForUpload));
-
         retainedSelf->_visibleContentViewSnapshot = [retainedSelf snapshotViewAfterScreenUpdates:NO];
-        [retainedSelf _startSuppressingSelectionAssistantForReason:WebKit::DropAnimationIsRunning];
         [UIView performWithoutAnimation:[retainedSelf] {
             [retainedSelf->_visibleContentViewSnapshot setFrame:[retainedSelf bounds]];
             [retainedSelf addSubview:retainedSelf->_visibleContentViewSnapshot.get()];
@@ -6910,7 +6908,6 @@ static WebKit::DocumentEditingContextRequest toWebRequest(UIWKDocumentRequest *r
 
 - (void)dropInteraction:(UIDropInteraction *)interaction concludeDrop:(id <UIDropSession>)session
 {
-    [self _stopSuppressingSelectionAssistantForReason:WebKit::DropAnimationIsRunning];
     [std::exchange(_visibleContentViewSnapshot, nil) removeFromSuperview];
     [std::exchange(_unselectedContentSnapshot, nil) removeFromSuperview];
     _dragDropInteractionState.clearAllDelayedItemPreviewProviders();
index 58d57af..d7b377f 100644 (file)
@@ -1,3 +1,19 @@
+2019-05-29  Wenson Hsieh  <wenson_hsieh@apple.com>
+
+        Remove some logic to suppress the text selection assistant during drop
+        https://bugs.webkit.org/show_bug.cgi?id=198354
+
+        Reviewed by Tim Horton.
+
+        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:]):
+
 2019-05-29  Sihui Liu  <sihui_liu@apple.com>
 
         WKWebsiteDataStore API fails to fetch web storage data for non-persistent data store
index 0876a4b..16cbe23 100644 (file)
@@ -370,7 +370,6 @@ TEST(DragAndDropTests, ContentEditableToContentEditable)
     loadTestPageAndEnsureInputSession(simulator.get(), @"autofocus-contenteditable");
     [simulator runFrom:CGPointMake(100, 50) to:CGPointMake(100, 300)];
 
-    EXPECT_TRUE([simulator suppressedSelectionCommandsDuringDrop]);
     EXPECT_EQ([webView stringByEvaluatingJavaScript:@"source.textContent"].length, 0UL);
     EXPECT_WK_STREQ("Hello world", [webView stringByEvaluatingJavaScript:@"editor.textContent"].UTF8String);
 
@@ -394,7 +393,6 @@ TEST(DragAndDropTests, ContentEditableToTextarea)
     loadTestPageAndEnsureInputSession(simulator.get(), @"contenteditable-and-textarea");
     [simulator runFrom:CGPointMake(100, 50) to:CGPointMake(100, 300)];
 
-    EXPECT_TRUE([simulator suppressedSelectionCommandsDuringDrop]);
     EXPECT_EQ([webView stringByEvaluatingJavaScript:@"source.textContent"].length, 0UL);
     EXPECT_WK_STREQ("Hello world", [webView editorValue].UTF8String);
 
@@ -455,7 +453,6 @@ TEST(DragAndDropTests, ContentEditableMoveParagraphs)
     NSUInteger firstParagraphOffset = [finalTextContent rangeOfString:@"This is the first paragraph"].location;
     NSUInteger secondParagraphOffset = [finalTextContent rangeOfString:@"This is the second paragraph"].location;
 
-    EXPECT_TRUE([simulator suppressedSelectionCommandsDuringDrop]);
     EXPECT_FALSE(firstParagraphOffset == NSNotFound);
     EXPECT_FALSE(secondParagraphOffset == NSNotFound);
     EXPECT_GT(firstParagraphOffset, secondParagraphOffset);
@@ -482,7 +479,6 @@ TEST(DragAndDropTests, TextAreaToInput)
     loadTestPageAndEnsureInputSession(simulator.get(), @"textarea-to-input");
     [simulator runFrom:CGPointMake(100, 50) to:CGPointMake(100, 300)];
 
-    EXPECT_TRUE([simulator suppressedSelectionCommandsDuringDrop]);
     EXPECT_EQ([webView stringByEvaluatingJavaScript:@"source.value"].length, 0UL);
     EXPECT_WK_STREQ("Hello world", [webView editorValue].UTF8String);
     checkCGRectIsEqualToCGRectWithLogging(CGRectMake(1089, 241, 2, 232), [simulator finalSelectionStartRect]);
@@ -499,8 +495,6 @@ TEST(DragAndDropTests, SinglePlainTextWordTypeIdentifiers)
     [webView stringByEvaluatingJavaScript:@"source.selectionEnd = source.value.length"];
     [simulator runFrom:CGPointMake(100, 50) to:CGPointMake(100, 300)];
 
-    EXPECT_TRUE([simulator suppressedSelectionCommandsDuringDrop]);
-
     NSItemProvider *itemProvider = [simulator sourceItemProviders].firstObject;
     NSArray *registeredTypes = [itemProvider registeredTypeIdentifiers];
     EXPECT_EQ(1UL, registeredTypes.count);
@@ -521,8 +515,6 @@ TEST(DragAndDropTests, SinglePlainTextURLTypeIdentifiers)
     [webView stringByEvaluatingJavaScript:@"source.selectionEnd = source.value.length"];
     [simulator runFrom:CGPointMake(100, 50) to:CGPointMake(100, 300)];
 
-    EXPECT_TRUE([simulator suppressedSelectionCommandsDuringDrop]);
-
     NSItemProvider *itemProvider = [simulator sourceItemProviders].firstObject;
     NSArray *registeredTypes = [itemProvider registeredTypeIdentifiers];
     EXPECT_EQ(2UL, registeredTypes.count);
index 999c118..3ad6698 100644 (file)
@@ -113,7 +113,6 @@ typedef NSDictionary<NSNumber *, NSValue *> *ProgressToCGPointValueMap;
 @property (nonatomic, readonly) NSArray<UITargetedDragPreview *> *liftPreviews;
 @property (nonatomic, readonly) NSArray *dropPreviews;
 @property (nonatomic, readonly) NSArray *delayedDropPreviews;
-@property (nonatomic, readonly) BOOL suppressedSelectionCommandsDuringDrop;
 
 #endif // PLATFORM(IOS_FAMILY)
 
index f6fb657..147c36a 100644 (file)
@@ -323,7 +323,6 @@ IGNORE_WARNINGS_END
     bool _isDoneWaitingForDelayedDropPreviews;
     DragAndDropPhase _phase;
 
-    BOOL _suppressedSelectionCommandsDuringDrop;
     RetainPtr<UIDropProposal> _lastKnownDropProposal;
 
     BlockPtr<BOOL(_WKActivatedElementInfo *)> _showCustomActionSheetBlock;
@@ -373,7 +372,6 @@ IGNORE_WARNINGS_END
 
 - (void)_resetSimulatedState
 {
-    _suppressedSelectionCommandsDuringDrop = NO;
     _phase = DragAndDropPhaseBeginning;
     _currentProgress = 0;
     _isDoneWithCurrentRun = false;
@@ -763,8 +761,6 @@ IGNORE_WARNINGS_END
 
 - (void)_webView:(WKWebView *)webView dataInteractionOperationWasHandled:(BOOL)handled forSession:(id)session itemProviders:(NSArray<NSItemProvider *> *)itemProviders
 {
-    _suppressedSelectionCommandsDuringDrop = [_webView textInputContentView]._shouldSuppressSelectionCommands;
-
     if (self.dropCompletionBlock)
         self.dropCompletionBlock(handled, itemProviders);