Changeset 246907 in webkit
- Timestamp:
- Jun 27, 2019 3:03:29 PM (5 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r246901 r246907 1 2019-06-27 Andy Estes <aestes@apple.com> 2 3 [iOS] Stop using cached UITargetedPreviews from previous interactions when starting a new context menu interaction 4 https://bugs.webkit.org/show_bug.cgi?id=199285 5 <rdar://problem/52074916> 6 7 Reviewed by Tim Horton. 8 9 WKContentView was caching the UITargetedPreview created in 10 -contextMenuInteraction:previewForHighlightingMenuWithConfiguration: for later reuse by 11 -contextMenuInteraction:previewForDismissingMenuWithConfiguration:. The cached value was 12 then cleared in -contextMenuInteractionDidEnd:. 13 14 This was wrong, because -contextMenuInteractionDidEnd: can be called before 15 -contextMenuInteraction:previewForDismissingMenuWithConfiguration:, so we would clear the 16 cache then create and cache a new UITargetedPreview during dismissal. Then when a new 17 context menu interaction started, we'd reuse the targeted preview created for the previous 18 dismissal (which has the wrong geometry). 19 20 Stop assuming an ordering between 21 -contextMenuInteraction:previewForDismissingMenuWithConfiguration: and 22 -contextMenuInteractionDidEnd:. Instead, always create and cache a new UITargetedPreview in 23 -contextMenuInteraction:previewForHighlightingMenuWithConfiguration:, then reuse it and 24 clear the cache in -contextMenuInteraction:previewForDismissingMenuWithConfiguration:. 25 26 * UIProcess/ios/WKContentViewInteraction.mm: 27 (-[WKContentView _createTargetedPreviewIfPossible]): 28 (-[WKContentView contextMenuInteraction:previewForDismissingMenuWithConfiguration:]): 29 (-[WKContentView contextMenuInteractionDidEnd:]): 30 1 31 2019-06-27 Sihui Liu <sihui_liu@apple.com> 2 32 -
trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
r246892 r246907 7945 7945 - (UITargetedPreview *)_createTargetedPreviewIfPossible 7946 7946 { 7947 if (_contextMenuInteractionTargetedPreview)7948 return _contextMenuInteractionTargetedPreview.get();7949 7950 7947 RetainPtr<UITargetedPreview> targetedPreview; 7951 7948 … … 7991 7988 - (UITargetedPreview *)contextMenuInteraction:(UIContextMenuInteraction *)interaction previewForDismissingMenuWithConfiguration:(UIContextMenuConfiguration *)configuration 7992 7989 { 7993 return [self _createTargetedPreviewIfPossible];7990 return std::exchange(_contextMenuInteractionTargetedPreview, nil).autorelease(); 7994 7991 } 7995 7992 … … 8071 8068 _contextMenuHasRequestedLegacyData = NO; 8072 8069 _contextMenuElementInfo = nullptr; 8073 _contextMenuInteractionTargetedPreview = nil;8074 8070 } 8075 8071
Note: See TracChangeset
for help on using the changeset viewer.