<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[281054] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/281054">281054</a></dd>
<dt>Author</dt> <dd>wenson_hsieh@apple.com</dd>
<dt>Date</dt> <dd>2021-08-13 17:47:03 -0700 (Fri, 13 Aug 2021)</dd>
</dl>

<h3>Log Message</h3>
<pre>[iOS 15] fast/events/touch/ios/long-press-on-link.html is a constant crash
https://bugs.webkit.org/show_bug.cgi?id=229095
rdar://80386326

Reviewed by Tim Horton.

Source/WebKit:

This test crashes when run immediately after another test that attempts to present the context menu and ends
with the context menu still showing (in this case, fast/events/touch/ios/long-press-on-image.html). Running
these tests back to back causes us to immediately dismiss the context menu interaction while transitioning to
the second test, which triggers the context menu interaction's dismissal animation.

This animation ends in the middle of the next test (long-press-on-link.html), after the long press has begun and
the context menu interaction has already requested a targeted hint preview, but (importantly) before the context
menu peek animation actually begins (i.e. `-contextMenuInteraction:willDisplayMenuForConfiguration:animator:`).
As a result, we tear down the hint container too early (with the hint view still in the view hierarchy), and
subsequently crash with an exception when UIKit tries to perform coordinate space conversions with the now-
unparented view.

To fix this, we make two small adjustments:
1.      Avoid unparenting the context menu hint container if it still has subviews.
2.      Add plumbing to ensure that the context menu hint container is unparented once all of its subviews have
        been removed (and the container isn't being used for anything else).

* Platform/spi/ios/UIKitSPI.h:

Add an SPI declaration for the `-_didRemoveSubview:` subclassing hook.

* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKTargetedPreviewContainer initWithContentView:]):
(-[WKTargetedPreviewContainer _didRemoveSubview:]):

Add a new subclass for WKTargetedPreviewContainer that notifies WKContentView when its last subview has been
removed, such that WKContentView can tear down the container view if needed.

(-[WKContentView cleanUpInteraction]):
(-[WKContentView removeContextMenuViewIfPossibleForActionSheetAssistant:]):
(-[WKContentView _targetedPreviewContainerDidRemoveLastSubview:]):
(-[WKContentView _createPreviewContainerWithLayerName:]):
(-[WKContentView _removeContextMenuHintContainerIfPossible]):
(-[WKContentView contextMenuInteraction:willEndForConfiguration:animator:]):
(-[WKContentView _removeContextMenuViewIfPossible]): Deleted.

Additionally rename `-_removeContextMenuViewIfPossible` to `-_removeContextMenuHintContainerIfPossible`, to make
it clear that this method is about removing the container view for context menu hints (and not the hints
themselves).

* UIProcess/ios/WebDataListSuggestionsDropdownIOS.mm:
(-[WKDataListSuggestionsDropdown _removeContextMenuInteraction]):
* UIProcess/ios/forms/WKDateTimeInputControl.mm:
(-[WKDateTimePicker removeContextMenuInteraction]):
* UIProcess/ios/forms/WKFileUploadPanel.mm:
(-[WKFileUploadPanel removeContextMenuInteraction]):
* UIProcess/ios/forms/WKFormSelectPicker.mm:
(-[WKSelectPicker removeContextMenuInteraction]):

LayoutTests:

Remove the failing test expectation (and remove a passing expectation for iOS 14 which is no longer necessary
after this fix).

* platform/ios-14/TestExpectations:
* platform/ios/TestExpectations:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsplatformiosTestExpectations">trunk/LayoutTests/platform/ios/TestExpectations</a></li>
<li><a href="#trunkLayoutTestsplatformios14TestExpectations">trunk/LayoutTests/platform/ios-14/TestExpectations</a></li>
<li><a href="#trunkSourceWebKitChangeLog">trunk/Source/WebKit/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitPlatformspiiosUIKitSPIh">trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h</a></li>
<li><a href="#trunkSourceWebKitUIProcessiosWKContentViewInteractionh">trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h</a></li>
<li><a href="#trunkSourceWebKitUIProcessiosWKContentViewInteractionmm">trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm</a></li>
<li><a href="#trunkSourceWebKitUIProcessiosWebDataListSuggestionsDropdownIOSmm">trunk/Source/WebKit/UIProcess/ios/WebDataListSuggestionsDropdownIOS.mm</a></li>
<li><a href="#trunkSourceWebKitUIProcessiosformsWKDateTimeInputControlmm">trunk/Source/WebKit/UIProcess/ios/forms/WKDateTimeInputControl.mm</a></li>
<li><a href="#trunkSourceWebKitUIProcessiosformsWKFileUploadPanelmm">trunk/Source/WebKit/UIProcess/ios/forms/WKFileUploadPanel.mm</a></li>
<li><a href="#trunkSourceWebKitUIProcessiosformsWKFormSelectPickermm">trunk/Source/WebKit/UIProcess/ios/forms/WKFormSelectPicker.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (281053 => 281054)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog      2021-08-14 00:35:33 UTC (rev 281053)
+++ trunk/LayoutTests/ChangeLog 2021-08-14 00:47:03 UTC (rev 281054)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2021-08-13  Wenson Hsieh  <wenson_hsieh@apple.com>
+
+        [iOS 15] fast/events/touch/ios/long-press-on-link.html is a constant crash
+        https://bugs.webkit.org/show_bug.cgi?id=229095
+        rdar://80386326
+
+        Reviewed by Tim Horton.
+
+        Remove the failing test expectation (and remove a passing expectation for iOS 14 which is no longer necessary
+        after this fix).
+
+        * platform/ios-14/TestExpectations:
+        * platform/ios/TestExpectations:
+
</ins><span class="cx"> 2021-08-13  Ayumi Kojima  <ayumi_kojima@apple.com>
</span><span class="cx"> 
</span><span class="cx">         [ Win EWS ] http/tests/misc/webtiming-slow-load.py is failing.
</span></span></pre></div>
<a id="trunkLayoutTestsplatformiosTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/ios/TestExpectations (281053 => 281054)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/ios/TestExpectations  2021-08-14 00:35:33 UTC (rev 281053)
+++ trunk/LayoutTests/platform/ios/TestExpectations     2021-08-14 00:47:03 UTC (rev 281054)
</span><span class="lines">@@ -3410,9 +3410,6 @@
</span><span class="cx"> # rdar://80395949 ([ iOS15 ] http/tests/websocket/tests/hybi/too-long-payload.html is a constant timeout)
</span><span class="cx"> http/tests/websocket/tests/hybi/too-long-payload.html [ Timeout ]
</span><span class="cx"> 
</span><del>-#rdar://80386326 ([ iOS15 Release ] fast/events/touch/ios/long-press-on-link.html is a constant crash)
-fast/events/touch/ios/long-press-on-link.html [ Crash ]
-
</del><span class="cx"> # rdar://80392337 ([ iOS15 ] fast/text/international/system-language/navigator-language/navigator-language-ru.html is a constant failure)
</span><span class="cx"> fast/text/international/system-language/navigator-language/navigator-language-ru.html [ Failure ]
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsplatformios14TestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/ios-14/TestExpectations (281053 => 281054)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/ios-14/TestExpectations       2021-08-14 00:35:33 UTC (rev 281053)
+++ trunk/LayoutTests/platform/ios-14/TestExpectations  2021-08-14 00:47:03 UTC (rev 281054)
</span><span class="lines">@@ -72,9 +72,6 @@
</span><span class="cx"> # rdar://80395949 ([ iOS15 ] http/tests/websocket/tests/hybi/too-long-payload.html is a constant timeout)
</span><span class="cx"> http/tests/websocket/tests/hybi/too-long-payload.html [ Pass ]
</span><span class="cx"> 
</span><del>-#rdar://80386326 ([ iOS15 Release ] fast/events/touch/ios/long-press-on-link.html is a constant crash)
-fast/events/touch/ios/long-press-on-link.html [ Pass ]
-
</del><span class="cx"> # rdar://80392337 ([ iOS15 ] fast/text/international/system-language/navigator-language/navigator-language-ru.html is a constant failure)
</span><span class="cx"> fast/text/international/system-language/navigator-language/navigator-language-ru.html [ Pass ]
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ChangeLog (281053 => 281054)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ChangeLog    2021-08-14 00:35:33 UTC (rev 281053)
+++ trunk/Source/WebKit/ChangeLog       2021-08-14 00:47:03 UTC (rev 281054)
</span><span class="lines">@@ -1,3 +1,61 @@
</span><ins>+2021-08-13  Wenson Hsieh  <wenson_hsieh@apple.com>
+
+        [iOS 15] fast/events/touch/ios/long-press-on-link.html is a constant crash
+        https://bugs.webkit.org/show_bug.cgi?id=229095
+        rdar://80386326
+
+        Reviewed by Tim Horton.
+
+        This test crashes when run immediately after another test that attempts to present the context menu and ends
+        with the context menu still showing (in this case, fast/events/touch/ios/long-press-on-image.html). Running
+        these tests back to back causes us to immediately dismiss the context menu interaction while transitioning to
+        the second test, which triggers the context menu interaction's dismissal animation.
+
+        This animation ends in the middle of the next test (long-press-on-link.html), after the long press has begun and
+        the context menu interaction has already requested a targeted hint preview, but (importantly) before the context
+        menu peek animation actually begins (i.e. `-contextMenuInteraction:willDisplayMenuForConfiguration:animator:`).
+        As a result, we tear down the hint container too early (with the hint view still in the view hierarchy), and
+        subsequently crash with an exception when UIKit tries to perform coordinate space conversions with the now-
+        unparented view.
+
+        To fix this, we make two small adjustments:
+        1.      Avoid unparenting the context menu hint container if it still has subviews.
+        2.      Add plumbing to ensure that the context menu hint container is unparented once all of its subviews have
+                been removed (and the container isn't being used for anything else).
+
+        * Platform/spi/ios/UIKitSPI.h:
+
+        Add an SPI declaration for the `-_didRemoveSubview:` subclassing hook.
+
+        * UIProcess/ios/WKContentViewInteraction.h:
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKTargetedPreviewContainer initWithContentView:]):
+        (-[WKTargetedPreviewContainer _didRemoveSubview:]):
+
+        Add a new subclass for WKTargetedPreviewContainer that notifies WKContentView when its last subview has been
+        removed, such that WKContentView can tear down the container view if needed.
+
+        (-[WKContentView cleanUpInteraction]):
+        (-[WKContentView removeContextMenuViewIfPossibleForActionSheetAssistant:]):
+        (-[WKContentView _targetedPreviewContainerDidRemoveLastSubview:]):
+        (-[WKContentView _createPreviewContainerWithLayerName:]):
+        (-[WKContentView _removeContextMenuHintContainerIfPossible]):
+        (-[WKContentView contextMenuInteraction:willEndForConfiguration:animator:]):
+        (-[WKContentView _removeContextMenuViewIfPossible]): Deleted.
+
+        Additionally rename `-_removeContextMenuViewIfPossible` to `-_removeContextMenuHintContainerIfPossible`, to make
+        it clear that this method is about removing the container view for context menu hints (and not the hints
+        themselves).
+
+        * UIProcess/ios/WebDataListSuggestionsDropdownIOS.mm:
+        (-[WKDataListSuggestionsDropdown _removeContextMenuInteraction]):
+        * UIProcess/ios/forms/WKDateTimeInputControl.mm:
+        (-[WKDateTimePicker removeContextMenuInteraction]):
+        * UIProcess/ios/forms/WKFileUploadPanel.mm:
+        (-[WKFileUploadPanel removeContextMenuInteraction]):
+        * UIProcess/ios/forms/WKFormSelectPicker.mm:
+        (-[WKSelectPicker removeContextMenuInteraction]):
+
</ins><span class="cx"> 2021-08-13  Jer Noble  <jer.noble@apple.com>
</span><span class="cx"> 
</span><span class="cx">         [Cocoa] RemoteMediaPlayerProxy does not receive acceleratedRenderingStateChanged() when video element switches sources
</span></span></pre></div>
<a id="trunkSourceWebKitPlatformspiiosUIKitSPIh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h (281053 => 281054)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h  2021-08-14 00:35:33 UTC (rev 281053)
+++ trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h     2021-08-14 00:47:03 UTC (rev 281054)
</span><span class="lines">@@ -637,6 +637,7 @@
</span><span class="cx"> @property (nonatomic, setter=_setContinuousCornerRadius:) CGFloat _continuousCornerRadius;
</span><span class="cx"> - (void)insertSubview:(UIView *)view above:(UIView *)sibling;
</span><span class="cx"> - (void)viewWillMoveToSuperview:(UIView *)newSuperview;
</span><ins>+- (void)_didRemoveSubview:(UIView *)subview;
</ins><span class="cx"> - (CGSize)convertSize:(CGSize)size toView:(UIView *)view;
</span><span class="cx"> - (void)_removeAllAnimations:(BOOL)includeSubviews;
</span><span class="cx"> - (UIColor *)_inheritedInteractionTintColor;
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessiosWKContentViewInteractionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h (281053 => 281054)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h     2021-08-14 00:35:33 UTC (rev 281053)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h        2021-08-14 00:47:03 UTC (rev 281054)
</span><span class="lines">@@ -122,6 +122,7 @@
</span><span class="cx"> @class WKImageAnalysisGestureRecognizer;
</span><span class="cx"> @class WKMouseGestureRecognizer;
</span><span class="cx"> @class WKInspectorNodeSearchGestureRecognizer;
</span><ins>+@class WKTargetedPreviewContainer;
</ins><span class="cx"> @class WKTextRange;
</span><span class="cx"> @class _WKTextInputContext;
</span><span class="cx"> 
</span><span class="lines">@@ -318,11 +319,11 @@
</span><span class="cx">     RetainPtr<UIWebFormAccessory> _formAccessoryView;
</span><span class="cx">     RetainPtr<_UIHighlightView> _highlightView;
</span><span class="cx">     RetainPtr<UIView> _interactionViewsContainerView;
</span><del>-    RetainPtr<UIView> _contextMenuHintContainerView;
</del><ins>+    RetainPtr<WKTargetedPreviewContainer> _contextMenuHintContainerView;
</ins><span class="cx">     WeakObjCPtr<UIScrollView> _scrollViewForTargetedPreview;
</span><span class="cx">     CGPoint _scrollViewForTargetedPreviewInitialOffset;
</span><del>-    RetainPtr<UIView> _dragPreviewContainerView;
-    RetainPtr<UIView> _dropPreviewContainerView;
</del><ins>+    RetainPtr<WKTargetedPreviewContainer> _dragPreviewContainerView;
+    RetainPtr<WKTargetedPreviewContainer> _dropPreviewContainerView;
</ins><span class="cx">     RetainPtr<NSString> _markedText;
</span><span class="cx">     RetainPtr<WKActionSheetAssistant> _actionSheetAssistant;
</span><span class="cx"> #if ENABLE(AIRPLAY_PICKER)
</span><span class="lines">@@ -731,7 +732,8 @@
</span><span class="cx"> 
</span><span class="cx"> - (UITargetedPreview *)_createTargetedContextMenuHintPreviewForFocusedElement;
</span><span class="cx"> - (UITargetedPreview *)_createTargetedContextMenuHintPreviewIfPossible;
</span><del>-- (void)_removeContextMenuViewIfPossible;
</del><ins>+- (void)_removeContextMenuHintContainerIfPossible;
+- (void)_targetedPreviewContainerDidRemoveLastSubview:(WKTargetedPreviewContainer *)containerView;
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(ATTACHMENT_ELEMENT)
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessiosWKContentViewInteractionmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (281053 => 281054)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm    2021-08-14 00:35:33 UTC (rev 281053)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm       2021-08-14 00:47:03 UTC (rev 281054)
</span><span class="lines">@@ -768,6 +768,39 @@
</span><span class="cx"> 
</span><span class="cx"> @end
</span><span class="cx"> 
</span><ins>+@interface WKTargetedPreviewContainer : UIView
+- (instancetype)initWithContentView:(WKContentView *)contentView NS_DESIGNATED_INITIALIZER;
+- (instancetype)initWithFrame:(CGRect)frame NS_UNAVAILABLE;
+- (instancetype)initWithCoder:(NSCoder *)coder NS_UNAVAILABLE;
+@end
+
+@implementation WKTargetedPreviewContainer {
+    __weak WKContentView *_contentView;
+}
+
+- (instancetype)initWithContentView:(WKContentView *)contentView
+{
+    if (!(self = [super initWithFrame:CGRectZero]))
+        return nil;
+
+    _contentView = contentView;
+    return self;
+}
+
+- (void)_didRemoveSubview:(UIView *)subview
+{
+    [super _didRemoveSubview:subview];
+
+    if (self.subviews.count)
+        return;
+
+#if USE(UICONTEXTMENU)
+    [_contentView _targetedPreviewContainerDidRemoveLastSubview:self];
+#endif
+}
+
+@end
+
</ins><span class="cx"> @interface WKContentView (WKInteractionPrivate)
</span><span class="cx"> - (void)accessibilitySpeakSelectionSetContent:(NSString *)string;
</span><span class="cx"> - (NSArray *)webSelectionRectsForSelectionGeometries:(const Vector<WebCore::SelectionGeometry>&)selectionRects;
</span><span class="lines">@@ -1140,7 +1173,7 @@
</span><span class="cx">     _layerTreeTransactionIdAtLastInteractionStart = { };
</span><span class="cx"> 
</span><span class="cx"> #if USE(UICONTEXTMENU)
</span><del>-    [self _removeContextMenuViewIfPossible];
</del><ins>+    [self _removeContextMenuHintContainerIfPossible];
</ins><span class="cx"> #endif // USE(UICONTEXTMENU)
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(DRAG_SUPPORT)
</span><span class="lines">@@ -7756,7 +7789,7 @@
</span><span class="cx"> 
</span><span class="cx"> - (void)removeContextMenuViewIfPossibleForActionSheetAssistant:(WKActionSheetAssistant *)assistant
</span><span class="cx"> {
</span><del>-    [self _removeContextMenuViewIfPossible];
</del><ins>+    [self _removeContextMenuHintContainerIfPossible];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)actionSheetAssistantDidShowContextMenu:(WKActionSheetAssistant *)assistant
</span><span class="lines">@@ -7769,6 +7802,12 @@
</span><span class="cx">     [_webView _didDismissContextMenu];
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+- (void)_targetedPreviewContainerDidRemoveLastSubview:(WKTargetedPreviewContainer *)containerView
+{
+    if (_contextMenuHintContainerView == containerView)
+        [self _removeContextMenuHintContainerIfPossible];
+}
+
</ins><span class="cx"> #endif // USE(UICONTEXTMENU)
</span><span class="cx"> 
</span><span class="cx"> - (BOOL)_shouldUseContextMenus
</span><span class="lines">@@ -7857,9 +7896,9 @@
</span><span class="cx"> 
</span><span class="cx"> #endif // HAVE(PASTEBOARD_DATA_OWNER)
</span><span class="cx"> 
</span><del>-- (RetainPtr<UIView>)_createPreviewContainerWithLayerName:(NSString *)layerName
</del><ins>+- (RetainPtr<WKTargetedPreviewContainer>)_createPreviewContainerWithLayerName:(NSString *)layerName
</ins><span class="cx"> {
</span><del>-    auto container = adoptNS([[UIView alloc] init]);
</del><ins>+    auto container = adoptNS([[WKTargetedPreviewContainer alloc] initWithContentView:self]);
</ins><span class="cx">     [container layer].anchorPoint = CGPointZero;
</span><span class="cx">     [container layer].name = layerName;
</span><span class="cx">     return container;
</span><span class="lines">@@ -8696,7 +8735,7 @@
</span><span class="cx">     return _contextMenuInteractionTargetedPreview.get();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (void)_removeContextMenuViewIfPossible
</del><ins>+- (void)_removeContextMenuHintContainerIfPossible
</ins><span class="cx"> {
</span><span class="cx"> #if HAVE(LINK_PREVIEW)
</span><span class="cx">     // If a new _contextMenuElementInfo is installed, we've started another interaction,
</span><span class="lines">@@ -8712,7 +8751,7 @@
</span><span class="cx">     // and for the file upload panel...
</span><span class="cx">     if (_fileUploadPanel)
</span><span class="cx">         return;
</span><del>-    
</del><ins>+
</ins><span class="cx">     // and for the date/time picker.
</span><span class="cx">     if ([self dateTimeInputControl])
</span><span class="cx">         return;
</span><span class="lines">@@ -8719,7 +8758,10 @@
</span><span class="cx"> 
</span><span class="cx">     if ([self selectControl])
</span><span class="cx">         return;
</span><del>-    
</del><ins>+
+    if ([_contextMenuHintContainerView subviews].count)
+        return;
+
</ins><span class="cx">     [self _removeContainerForContextMenuHintPreviews];
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -11382,7 +11424,7 @@
</span><span class="cx">         auto strongSelf = weakSelf.get();
</span><span class="cx">         if (!strongSelf)
</span><span class="cx">             return;
</span><del>-        [strongSelf _removeContextMenuViewIfPossible];
</del><ins>+        [strongSelf _removeContextMenuHintContainerIfPossible];
</ins><span class="cx">         [strongSelf->_webView _didDismissContextMenu];
</span><span class="cx">     }];
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessiosWebDataListSuggestionsDropdownIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/ios/WebDataListSuggestionsDropdownIOS.mm (281053 => 281054)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/ios/WebDataListSuggestionsDropdownIOS.mm   2021-08-14 00:35:33 UTC (rev 281053)
+++ trunk/Source/WebKit/UIProcess/ios/WebDataListSuggestionsDropdownIOS.mm      2021-08-14 00:47:03 UTC (rev 281054)
</span><span class="lines">@@ -516,7 +516,7 @@
</span><span class="cx"> 
</span><span class="cx">     [self.view removeInteraction:_suggestionsContextMenuInteraction.get()];
</span><span class="cx">     _suggestionsContextMenuInteraction = nil;
</span><del>-    [self.view _removeContextMenuViewIfPossible];
</del><ins>+    [self.view _removeContextMenuHintContainerIfPossible];
</ins><span class="cx">     [self.view.webView _didDismissContextMenu];
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessiosformsWKDateTimeInputControlmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/ios/forms/WKDateTimeInputControl.mm (281053 => 281054)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/ios/forms/WKDateTimeInputControl.mm        2021-08-14 00:35:33 UTC (rev 281053)
+++ trunk/Source/WebKit/UIProcess/ios/forms/WKDateTimeInputControl.mm   2021-08-14 00:47:03 UTC (rev 281054)
</span><span class="lines">@@ -469,7 +469,7 @@
</span><span class="cx">     if (_dateTimeContextMenuInteraction) {
</span><span class="cx">         [_view removeInteraction:_dateTimeContextMenuInteraction.get()];
</span><span class="cx">         _dateTimeContextMenuInteraction = nil;
</span><del>-        [_view _removeContextMenuViewIfPossible];
</del><ins>+        [_view _removeContextMenuHintContainerIfPossible];
</ins><span class="cx">         [_view.webView _didDismissContextMenu];
</span><span class="cx">     }
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessiosformsWKFileUploadPanelmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/ios/forms/WKFileUploadPanel.mm (281053 => 281054)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/ios/forms/WKFileUploadPanel.mm     2021-08-14 00:35:33 UTC (rev 281053)
+++ trunk/Source/WebKit/UIProcess/ios/forms/WKFileUploadPanel.mm        2021-08-14 00:47:03 UTC (rev 281054)
</span><span class="lines">@@ -496,7 +496,7 @@
</span><span class="cx">     if (_documentContextMenuInteraction) {
</span><span class="cx">         [_view removeInteraction:_documentContextMenuInteraction.get()];
</span><span class="cx">         _documentContextMenuInteraction = nil;
</span><del>-        [_view _removeContextMenuViewIfPossible];
</del><ins>+        [_view _removeContextMenuHintContainerIfPossible];
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessiosformsWKFormSelectPickermm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/ios/forms/WKFormSelectPicker.mm (281053 => 281054)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/ios/forms/WKFormSelectPicker.mm    2021-08-14 00:35:33 UTC (rev 281053)
+++ trunk/Source/WebKit/UIProcess/ios/forms/WKFormSelectPicker.mm       2021-08-14 00:47:03 UTC (rev 281054)
</span><span class="lines">@@ -701,7 +701,7 @@
</span><span class="cx"> 
</span><span class="cx">     [_view removeInteraction:_selectContextMenuInteraction.get()];
</span><span class="cx">     _selectContextMenuInteraction = nil;
</span><del>-    [_view _removeContextMenuViewIfPossible];
</del><ins>+    [_view _removeContextMenuHintContainerIfPossible];
</ins><span class="cx">     [_view.webView _didDismissContextMenu];
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>