Title: [246853] branches/safari-608.1.31.0-branch

Diff

Modified: branches/safari-608.1.31.0-branch/Source/WebKit/ChangeLog (246852 => 246853)


--- branches/safari-608.1.31.0-branch/Source/WebKit/ChangeLog	2019-06-26 23:10:21 UTC (rev 246852)
+++ branches/safari-608.1.31.0-branch/Source/WebKit/ChangeLog	2019-06-26 23:19:34 UTC (rev 246853)
@@ -1,3 +1,7 @@
+2019-06-26  Alan Coon  <[email protected]>
+
+        Revert r246834. rdar://problem/51554509
+
 2019-06-26  Kocsen Chung  <[email protected]>
 
         Cherry-pick r246835. rdar://problem/51787961

Modified: branches/safari-608.1.31.0-branch/Source/WebKit/UIProcess/ios/DragDropInteractionState.mm (246852 => 246853)


--- branches/safari-608.1.31.0-branch/Source/WebKit/UIProcess/ios/DragDropInteractionState.mm	2019-06-26 23:10:21 UTC (rev 246852)
+++ branches/safari-608.1.31.0-branch/Source/WebKit/UIProcess/ios/DragDropInteractionState.mm	2019-06-26 23:19:34 UTC (rev 246853)
@@ -46,7 +46,7 @@
 
 static RetainPtr<UITargetedDragPreview> createTargetedDragPreview(UIImage *image, UIView *rootView, UIView *previewContainer, const FloatRect& frameInRootViewCoordinates, const Vector<FloatRect>& clippingRectsInFrameCoordinates, UIColor *backgroundColor, UIBezierPath *visiblePath)
 {
-    if (frameInRootViewCoordinates.isEmpty() || !image || !previewContainer.window)
+    if (frameInRootViewCoordinates.isEmpty() || !image)
         return nullptr;
 
     NSMutableArray *clippingRectValuesInFrameCoordinates = [NSMutableArray arrayWithCapacity:clippingRectsInFrameCoordinates.size()];

Modified: branches/safari-608.1.31.0-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (246852 => 246853)


--- branches/safari-608.1.31.0-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2019-06-26 23:10:21 UTC (rev 246852)
+++ branches/safari-608.1.31.0-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2019-06-26 23:19:34 UTC (rev 246853)
@@ -6189,11 +6189,6 @@
         completion(nil, nil);
 }
 
-- (UIView *)containerViewForTargetedPreviews
-{
-    return self.unscaledView ?: self;
-}
-
 #if ENABLE(DRAG_SUPPORT)
 
 static BOOL shouldEnableDragInteractionForPolicy(_WKDragInteractionPolicy policy)
@@ -6426,7 +6421,7 @@
     [_unselectedContentSnapshot setFrame:data->contentImageWithoutSelectionRectInRootViewCoordinates];
 
     [self insertSubview:_unselectedContentSnapshot.get() belowSubview:_visibleContentViewSnapshot.get()];
-    _dragDropInteractionState.deliverDelayedDropPreview(self, self.containerViewForTargetedPreviews, data.value());
+    _dragDropInteractionState.deliverDelayedDropPreview(self, self.unscaledView, data.value());
 }
 
 - (void)_didPerformDragOperation:(BOOL)handled
@@ -6772,7 +6767,7 @@
         if (overriddenPreview)
             return overriddenPreview;
     }
-    return _dragDropInteractionState.previewForDragItem(item, self, self.containerViewForTargetedPreviews);
+    return _dragDropInteractionState.previewForDragItem(item, self, self.unscaledView);
 }
 
 - (void)dragInteraction:(UIDragInteraction *)interaction willAnimateLiftWithAnimator:(id <UIDragAnimating>)animator session:(id <UIDragSession>)session
@@ -7870,7 +7865,7 @@
 // FIXME: This should be merged with createTargetedDragPreview in DragDropInteractionState.
 static RetainPtr<UITargetedPreview> createTargetedPreview(UIImage *image, UIView *rootView, UIView *previewContainer, const WebCore::FloatRect& frameInRootViewCoordinates, const Vector<WebCore::FloatRect>& clippingRectsInFrameCoordinates, UIColor *backgroundColor)
 {
-    if (frameInRootViewCoordinates.isEmpty() || !image || !previewContainer.window)
+    if (frameInRootViewCoordinates.isEmpty() || !image)
         return nil;
 
     WebCore::FloatRect frameInContainerCoordinates = [rootView convertRect:frameInRootViewCoordinates toView:previewContainer];
@@ -7926,15 +7921,15 @@
     if (_positionInformation.isLink && _positionInformation.linkIndicator.contentImage) {
         auto indicator = _positionInformation.linkIndicator;
         auto textIndicatorImage = uiImageForImage(indicator.contentImage.get());
-        targetedPreview = createTargetedPreview(textIndicatorImage.get(), self, self.containerViewForTargetedPreviews, indicator.textBoundingRectInRootViewCoordinates, indicator.textRectsInBoundingRectCoordinates, [UIColor colorWithCGColor:cachedCGColor(indicator.estimatedBackgroundColor)]);
+        targetedPreview = createTargetedPreview(textIndicatorImage.get(), self, self.unscaledView, indicator.textBoundingRectInRootViewCoordinates, indicator.textRectsInBoundingRectCoordinates, [UIColor colorWithCGColor:cachedCGColor(indicator.estimatedBackgroundColor)]);
     } else if ((_positionInformation.isAttachment || _positionInformation.isImage) && _positionInformation.image) {
         auto cgImage = _positionInformation.image->makeCGImageCopy();
         auto image = adoptNS([[UIImage alloc] initWithCGImage:cgImage.get()]);
-        targetedPreview = createTargetedPreview(image.get(), self, self.containerViewForTargetedPreviews, _positionInformation.bounds, { }, nil);
+        targetedPreview = createTargetedPreview(image.get(), self, self.unscaledView, _positionInformation.bounds, { }, nil);
     }
 
     if (!targetedPreview)
-        targetedPreview = createFallbackTargetedPreview(self, self.containerViewForTargetedPreviews, _positionInformation.bounds);
+        targetedPreview = createFallbackTargetedPreview(self, self.unscaledView, _positionInformation.bounds);
 
     _contextMenuInteractionTargetedPreview = WTFMove(targetedPreview);
     return _contextMenuInteractionTargetedPreview.get();

Modified: branches/safari-608.1.31.0-branch/Tools/ChangeLog (246852 => 246853)


--- branches/safari-608.1.31.0-branch/Tools/ChangeLog	2019-06-26 23:10:21 UTC (rev 246852)
+++ branches/safari-608.1.31.0-branch/Tools/ChangeLog	2019-06-26 23:19:34 UTC (rev 246853)
@@ -1,3 +1,7 @@
+2019-06-26  Alan Coon  <[email protected]>
+
+        Revert r246834. rdar://problem/51554509
+
 2019-06-25  Babak Shafiei  <[email protected]>
 
         Cherry-pick r246800. rdar://problem/51554509

Modified: branches/safari-608.1.31.0-branch/Tools/TestWebKitAPI/Tests/ios/DragAndDropTestsIOS.mm (246852 => 246853)


--- branches/safari-608.1.31.0-branch/Tools/TestWebKitAPI/Tests/ios/DragAndDropTestsIOS.mm	2019-06-26 23:10:21 UTC (rev 246852)
+++ branches/safari-608.1.31.0-branch/Tools/TestWebKitAPI/Tests/ios/DragAndDropTestsIOS.mm	2019-06-26 23:19:34 UTC (rev 246853)
@@ -1445,30 +1445,6 @@
     checkStringArraysAreEqual(@[@"dragstart", @"dragend"], [outputText componentsSeparatedByString:@" "]);
 }
 
-TEST(DragAndDropTests, WebProcessTerminationDuringDrag)
-{
-    auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]);
-    [webView synchronouslyLoadTestPageNamed:@"link-and-target-div"];
-    auto simulator = adoptNS([[DragAndDropSimulator alloc] initWithWebView:webView.get()]);
-    [simulator setSessionWillBeginBlock:^{
-        [webView _killWebContentProcessAndResetState];
-    }];
-    [simulator runFrom:CGPointMake(100, 50) to:CGPointMake(300, 50)];
-}
-
-TEST(DragAndDropTests, WebViewRemovedFromViewHierarchyDuringDrag)
-{
-    auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]);
-    [webView synchronouslyLoadTestPageNamed:@"link-and-target-div"];
-    auto simulator = adoptNS([[DragAndDropSimulator alloc] initWithWebView:webView.get()]);
-    [simulator setConvertItemProvidersBlock:[webView] (NSItemProvider *item, NSArray *, NSDictionary *) -> NSArray * {
-        [webView removeFromSuperview];
-        return @[ item ];
-    }];
-    [simulator runFrom:CGPointMake(100, 50) to:CGPointMake(300, 50)];
-    EXPECT_EQ([simulator cancellationPreviews].firstObject, nil);
-}
-
 static void testDragAndDropOntoTargetElements(TestWKWebView *webView)
 {
     auto simulator = adoptNS([[DragAndDropSimulator alloc] initWithWebView:webView]);

Modified: branches/safari-608.1.31.0-branch/Tools/TestWebKitAPI/cocoa/DragAndDropSimulator.h (246852 => 246853)


--- branches/safari-608.1.31.0-branch/Tools/TestWebKitAPI/cocoa/DragAndDropSimulator.h	2019-06-26 23:10:21 UTC (rev 246852)
+++ branches/safari-608.1.31.0-branch/Tools/TestWebKitAPI/cocoa/DragAndDropSimulator.h	2019-06-26 23:19:34 UTC (rev 246853)
@@ -104,7 +104,6 @@
 @property (nonatomic, copy) NSArray *(^convertItemProvidersBlock)(NSItemProvider *, NSArray *, NSDictionary *);
 @property (nonatomic, copy) NSArray *(^overridePerformDropBlock)(id <UIDropSession>);
 @property (nonatomic, copy) void(^dropCompletionBlock)(BOOL, NSArray *);
-@property (nonatomic, copy) dispatch_block_t sessionWillBeginBlock;
 @property (nonatomic, copy) UIDropOperation(^overrideDragUpdateBlock)(UIDropOperation, id <UIDropSession>);
 
 @property (nonatomic, readonly) NSArray *sourceItemProviders;
@@ -112,7 +111,6 @@
 @property (nonatomic, readonly) CGRect finalSelectionStartRect;
 @property (nonatomic, readonly) CGRect lastKnownDragCaretRect;
 @property (nonatomic, readonly) NSArray<UITargetedDragPreview *> *liftPreviews;
-@property (nonatomic, readonly) NSArray<UITargetedDragPreview *> *cancellationPreviews;
 @property (nonatomic, readonly) NSArray *dropPreviews;
 @property (nonatomic, readonly) NSArray *delayedDropPreviews;
 

Modified: branches/safari-608.1.31.0-branch/Tools/TestWebKitAPI/ios/DragAndDropSimulatorIOS.mm (246852 => 246853)


--- branches/safari-608.1.31.0-branch/Tools/TestWebKitAPI/ios/DragAndDropSimulatorIOS.mm	2019-06-26 23:10:21 UTC (rev 246852)
+++ branches/safari-608.1.31.0-branch/Tools/TestWebKitAPI/ios/DragAndDropSimulatorIOS.mm	2019-06-26 23:19:34 UTC (rev 246853)
@@ -310,8 +310,7 @@
 
     RetainPtr<NSMutableDictionary<NSNumber *, NSValue *>>_remainingAdditionalItemRequestLocationsByProgress;
     RetainPtr<NSMutableArray<NSValue *>>_queuedAdditionalItemRequestLocations;
-    RetainPtr<NSMutableArray> _liftPreviews;
-    RetainPtr<NSMutableArray<UITargetedDragPreview *>> _cancellationPreviews;
+    RetainPtr<NSMutableArray<UITargetedDragPreview *>> _liftPreviews;
     RetainPtr<NSMutableArray> _dropPreviews;
     RetainPtr<NSMutableArray> _delayedDropPreviews;
 
@@ -331,7 +330,6 @@
     BlockPtr<NSArray *(id <UIDropSession>)> _overridePerformDropBlock;
     BlockPtr<UIDropOperation(UIDropOperation, id)> _overrideDragUpdateBlock;
     BlockPtr<void(BOOL, NSArray *)> _dropCompletionBlock;
-    BlockPtr<void()> _sessionWillBeginBlock;
 }
 
 - (instancetype)initWithWebViewFrame:(CGRect)frame
@@ -390,7 +388,6 @@
     _queuedAdditionalItemRequestLocations = adoptNS([[NSMutableArray alloc] init]);
     _liftPreviews = adoptNS([[NSMutableArray alloc] init]);
     _dropPreviews = adoptNS([[NSMutableArray alloc] init]);
-    _cancellationPreviews = adoptNS([[NSMutableArray alloc] init]);
     _delayedDropPreviews = adoptNS([[NSMutableArray alloc] init]);
     _hasStartedInputSession = false;
 }
@@ -500,15 +497,6 @@
     } else {
         _isDoneWithCurrentRun = true;
         _phase = DragAndDropPhaseCancelled;
-        [[_dropSession items] enumerateObjectsUsingBlock:^(UIDragItem *item, NSUInteger index, BOOL *) {
-            UITargetedDragPreview *defaultPreview = nil;
-            if ([_liftPreviews count] && [[_liftPreviews objectAtIndex:index] isEqual:NSNull.null])
-                defaultPreview = [_liftPreviews objectAtIndex:index];
-
-            UITargetedDragPreview *preview = [[_webView dragInteractionDelegate] dragInteraction:[_webView dragInteraction] previewForCancellingItem:item withDefault:defaultPreview];
-            if (preview)
-                [_cancellationPreviews addObject:preview];
-        }];
         [[_webView dropInteractionDelegate] dropInteraction:[_webView dropInteraction] concludeDrop:_dropSession.get()];
     }
 
@@ -588,8 +576,9 @@
         for (UIDragItem *item in items) {
             [itemProviders addObject:item.itemProvider];
             UITargetedDragPreview *liftPreview = [[_webView dragInteractionDelegate] dragInteraction:[_webView dragInteraction] previewForLiftingItem:item session:_dragSession.get()];
-            EXPECT_TRUE(liftPreview || ![_webView window]);
-            [_liftPreviews addObject:liftPreview ?: NSNull.null];
+            EXPECT_TRUE(!!liftPreview);
+            if (liftPreview)
+                [_liftPreviews addObject:liftPreview];
         }
 
         _dropSession = adoptNS([[MockDropSession alloc] initWithProviders:itemProviders location:self._currentLocation window:[_webView window] allowMove:self.shouldAllowMoveOperation]);
@@ -673,16 +662,11 @@
     return _phase;
 }
 
-- (NSArray *)liftPreviews
+- (NSArray<UITargetedDragPreview *> *)liftPreviews
 {
     return _liftPreviews.get();
 }
 
-- (NSArray<UITargetedDragPreview *> *)cancellationPreviews
-{
-    return _cancellationPreviews.get();
-}
-
 - (NSArray<UITargetedDragPreview *> *)dropPreviews
 {
     return _dropPreviews.get();
@@ -773,24 +757,8 @@
     return _dropCompletionBlock.get();
 }
 
-- (void)setSessionWillBeginBlock:(dispatch_block_t)block
-{
-    _sessionWillBeginBlock = block;
-}
-
-- (dispatch_block_t)sessionWillBeginBlock
-{
-    return _sessionWillBeginBlock.get();
-}
-
 #pragma mark - WKUIDelegatePrivate
 
-- (void)_webView:(WKWebView *)webView dataInteraction:(UIDragInteraction *)interaction sessionWillBegin:(id <UIDragSession>)session
-{
-    if (_sessionWillBeginBlock)
-        _sessionWillBeginBlock();
-}
-
 - (void)_webView:(WKWebView *)webView dataInteractionOperationWasHandled:(BOOL)handled forSession:(id)session itemProviders:(NSArray<NSItemProvider *> *)itemProviders
 {
     if (self.dropCompletionBlock)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to