Title: [246887] branches/safari-608.1.31.0-branch/Source/WebKit
Revision
246887
Author
[email protected]
Date
2019-06-27 10:42:38 -0700 (Thu, 27 Jun 2019)

Log Message

Cherry-pick r246859. rdar://problem/51554509

    [iPadOS] Fix another crash in -[UIPreviewTarget initWithContainer:center:transform:] when generating a fallback targeted preview
    https://bugs.webkit.org/show_bug.cgi?id=199243
    <rdar://problem/51554509>

    Reviewed by Tim Horton.

    Additionally make createFallbackTargetedPreview robust in the case where the content view is unparented, and
    rename _ensureTargetedPreview to _createTargetedPreviewIfPossible, to reflect the fact that it may now return
    nil.

    * UIProcess/ios/WKContentViewInteraction.mm:
    (createTargetedPreview):
    (createFallbackTargetedPreview):
    (-[WKContentView _createTargetedPreviewIfPossible]):
    (-[WKContentView contextMenuInteraction:previewForHighlightingMenuWithConfiguration:]):
    (-[WKContentView contextMenuInteraction:previewForDismissingMenuWithConfiguration:]):
    (-[WKContentView _ensureTargetedPreview]): Deleted.

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

Modified Paths

Diff

Modified: branches/safari-608.1.31.0-branch/Source/WebKit/ChangeLog (246886 => 246887)


--- branches/safari-608.1.31.0-branch/Source/WebKit/ChangeLog	2019-06-27 17:42:34 UTC (rev 246886)
+++ branches/safari-608.1.31.0-branch/Source/WebKit/ChangeLog	2019-06-27 17:42:38 UTC (rev 246887)
@@ -1,5 +1,50 @@
 2019-06-27  Alan Coon  <[email protected]>
 
+        Cherry-pick r246859. rdar://problem/51554509
+
+    [iPadOS] Fix another crash in -[UIPreviewTarget initWithContainer:center:transform:] when generating a fallback targeted preview
+    https://bugs.webkit.org/show_bug.cgi?id=199243
+    <rdar://problem/51554509>
+    
+    Reviewed by Tim Horton.
+    
+    Additionally make createFallbackTargetedPreview robust in the case where the content view is unparented, and
+    rename _ensureTargetedPreview to _createTargetedPreviewIfPossible, to reflect the fact that it may now return
+    nil.
+    
+    * UIProcess/ios/WKContentViewInteraction.mm:
+    (createTargetedPreview):
+    (createFallbackTargetedPreview):
+    (-[WKContentView _createTargetedPreviewIfPossible]):
+    (-[WKContentView contextMenuInteraction:previewForHighlightingMenuWithConfiguration:]):
+    (-[WKContentView contextMenuInteraction:previewForDismissingMenuWithConfiguration:]):
+    (-[WKContentView _ensureTargetedPreview]): Deleted.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@246859 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-06-26  Wenson Hsieh  <[email protected]>
+
+            [iPadOS] Fix another crash in -[UIPreviewTarget initWithContainer:center:transform:] when generating a fallback targeted preview
+            https://bugs.webkit.org/show_bug.cgi?id=199243
+            <rdar://problem/51554509>
+
+            Reviewed by Tim Horton.
+
+            Additionally make createFallbackTargetedPreview robust in the case where the content view is unparented, and
+            rename _ensureTargetedPreview to _createTargetedPreviewIfPossible, to reflect the fact that it may now return
+            nil.
+
+            * UIProcess/ios/WKContentViewInteraction.mm:
+            (createTargetedPreview):
+            (createFallbackTargetedPreview):
+            (-[WKContentView _createTargetedPreviewIfPossible]):
+            (-[WKContentView contextMenuInteraction:previewForHighlightingMenuWithConfiguration:]):
+            (-[WKContentView contextMenuInteraction:previewForDismissingMenuWithConfiguration:]):
+            (-[WKContentView _ensureTargetedPreview]): Deleted.
+
+2019-06-27  Alan Coon  <[email protected]>
+
         Revert r246853. rdar://problem/51554509
 
 2019-06-26  Alan Coon  <[email protected]>

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


--- branches/safari-608.1.31.0-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2019-06-27 17:42:34 UTC (rev 246886)
+++ branches/safari-608.1.31.0-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2019-06-27 17:42:38 UTC (rev 246887)
@@ -7904,6 +7904,9 @@
 
 static RetainPtr<UITargetedPreview> createFallbackTargetedPreview(UIView *rootView, UIView *containerView, const WebCore::FloatRect& frameInRootViewCoordinates)
 {
+    if (!containerView.window)
+        return nil;
+
     auto parameters = adoptNS([[UIPreviewParameters alloc] init]);
     UIView *snapshotView = [rootView resizableSnapshotViewFromRect:frameInRootViewCoordinates afterScreenUpdates:NO withCapInsets:UIEdgeInsetsZero];
 
@@ -7916,7 +7919,7 @@
     return adoptNS([[UITargetedPreview alloc] initWithView:snapshotView parameters:parameters.get() target:target.get()]);
 }
 
-- (UITargetedPreview *)_ensureTargetedPreview
+- (UITargetedPreview *)_createTargetedPreviewIfPossible
 {
     if (_contextMenuInteractionTargetedPreview)
         return _contextMenuInteractionTargetedPreview.get();
@@ -7943,7 +7946,7 @@
 - (UITargetedPreview *)contextMenuInteraction:(UIContextMenuInteraction *)interaction previewForHighlightingMenuWithConfiguration:(UIContextMenuConfiguration *)configuration
 {
     [self _startSuppressingSelectionAssistantForReason:WebKit::InteractionIsHappening];
-    return [self _ensureTargetedPreview];
+    return [self _createTargetedPreviewIfPossible];
 }
 
 - (void)contextMenuInteractionWillPresent:(UIContextMenuInteraction *)interaction
@@ -7964,7 +7967,7 @@
 
 - (UITargetedPreview *)contextMenuInteraction:(UIContextMenuInteraction *)interaction previewForDismissingMenuWithConfiguration:(UIContextMenuConfiguration *)configuration
 {
-    return [self _ensureTargetedPreview];
+    return [self _createTargetedPreviewIfPossible];
 }
 
 - (void)contextMenuInteraction:(UIContextMenuInteraction *)interaction willCommitWithAnimator:(id<UIContextMenuInteractionCommitAnimating>)animator
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to