Title: [270901] trunk/Source/WebKit
- Revision
- 270901
- Author
- [email protected]
- Date
- 2020-12-16 12:39:47 -0800 (Wed, 16 Dec 2020)
Log Message
Suppress the image extraction interaction while editing text
https://bugs.webkit.org/show_bug.cgi?id=219952
<rdar://problem/72390053>
Reviewed by Devin Rousso.
See radar and WebKitAdditions for more details.
* UIProcess/ios/WKContentViewInteraction.h:
(WebKit::SuppressInteractionToken::SuppressInteractionToken):
(WebKit::SuppressInteractionToken::~SuppressInteractionToken):
Add a helper class to help facilitate the temporary removal of UIInteraction objects from a WKContentView.
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView setIsEditable:]):
Use the above helper class to temporarily remove the image extraction interaction while the user is editing
text (and is therefore depending on editable text interaction gestures). Note that we avoid unnecessarily
clearing out and resetting this member variable when changing focus between editable text fields.
(-[WKContentView _didStartProvisionalLoadForMainFrame]):
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (270900 => 270901)
--- trunk/Source/WebKit/ChangeLog 2020-12-16 20:33:21 UTC (rev 270900)
+++ trunk/Source/WebKit/ChangeLog 2020-12-16 20:39:47 UTC (rev 270901)
@@ -1,3 +1,28 @@
+2020-12-16 Wenson Hsieh <[email protected]>
+
+ Suppress the image extraction interaction while editing text
+ https://bugs.webkit.org/show_bug.cgi?id=219952
+ <rdar://problem/72390053>
+
+ Reviewed by Devin Rousso.
+
+ See radar and WebKitAdditions for more details.
+
+ * UIProcess/ios/WKContentViewInteraction.h:
+ (WebKit::SuppressInteractionToken::SuppressInteractionToken):
+ (WebKit::SuppressInteractionToken::~SuppressInteractionToken):
+
+ Add a helper class to help facilitate the temporary removal of UIInteraction objects from a WKContentView.
+
+ * UIProcess/ios/WKContentViewInteraction.mm:
+ (-[WKContentView setIsEditable:]):
+
+ Use the above helper class to temporarily remove the image extraction interaction while the user is editing
+ text (and is therefore depending on editable text interaction gestures). Note that we avoid unnecessarily
+ clearing out and resetting this member variable when changing focus between editable text fields.
+
+ (-[WKContentView _didStartProvisionalLoadForMainFrame]):
+
2020-12-16 Brent Fulgham <[email protected]>
REGRESSION (r270657) [AS Only] GGE: Netflix, YouTube, Amazon Prime, and Hulu fail to playback
Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h (270900 => 270901)
--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h 2020-12-16 20:33:21 UTC (rev 270900)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h 2020-12-16 20:39:47 UTC (rev 270901)
@@ -201,6 +201,32 @@
CGRect textLastRect;
};
+class SuppressInteractionToken {
+ WTF_MAKE_NONCOPYABLE(SuppressInteractionToken); WTF_MAKE_FAST_ALLOCATED;
+public:
+ SuppressInteractionToken(WKContentView *view, NSObject<UIInteraction> *interaction)
+ : m_view(view)
+ , m_interaction(interaction)
+ {
+ ASSERT(view);
+ ASSERT(interaction);
+ if (interaction)
+ [view removeInteraction:interaction];
+ }
+
+ ~SuppressInteractionToken()
+ {
+ if (!m_view || !m_interaction)
+ return;
+
+ [m_view addInteraction:m_interaction.get().get()];
+ }
+
+private:
+ WeakObjCPtr<WKContentView> m_view;
+ WeakObjCPtr<NSObject<UIInteraction>> m_interaction;
+};
+
}
@class WKFocusedElementInfo;
@@ -435,6 +461,7 @@
WebKit::ImageExtractionState _imageExtractionState;
CGRect _imageExtractionInteractionBounds;
Vector<BlockPtr<void()>> _actionsToPerformAfterPendingImageExtraction;
+ std::unique_ptr<WebKit::SuppressInteractionToken> _suppressImageExtractionToken;
#endif
#if USE(APPLE_INTERNAL_SDK)
Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (270900 => 270901)
--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm 2020-12-16 20:33:21 UTC (rev 270900)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm 2020-12-16 20:39:47 UTC (rev 270901)
@@ -1292,6 +1292,12 @@
return NO;
_isEditable = isEditable;
+
+#if ENABLE(IMAGE_EXTRACTION)
+ if (self._imageExtractionEnabled && (!_isBlurringFocusedElement || !_isChangingFocus))
+ _suppressImageExtractionToken = isEditable ? makeUnique<WebKit::SuppressInteractionToken>(self, _imageExtractionInteraction.get()) : nullptr;
+#endif
+
return YES;
}
@@ -4381,6 +4387,7 @@
[self _setDoubleTapGesturesEnabled:NO];
[_twoFingerDoubleTapGestureRecognizer _wk_cancel];
#if ENABLE(IMAGE_EXTRACTION)
+ _suppressImageExtractionToken = nullptr;
[self _cancelImageExtraction];
#endif
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes