Title: [286879] trunk/Source/WebKit
Revision
286879
Author
akeer...@apple.com
Date
2021-12-10 14:52:17 -0800 (Fri, 10 Dec 2021)

Log Message

[iOS] Support find-in-page keyboard shortcuts
https://bugs.webkit.org/show_bug.cgi?id=234163
rdar://86333128

Reviewed by Devin Rousso.

* Platform/spi/ios/UIKitSPI.h:
* UIProcess/API/ios/WKWebViewIOS.h:
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView canPerformActionForWebView:withSender:]):
(-[WKContentView findForWebView:]):
(-[WKContentView findNextForWebView:]):
(-[WKContentView findPreviousForWebView:]):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (286878 => 286879)


--- trunk/Source/WebKit/ChangeLog	2021-12-10 22:19:03 UTC (rev 286878)
+++ trunk/Source/WebKit/ChangeLog	2021-12-10 22:52:17 UTC (rev 286879)
@@ -1,3 +1,20 @@
+2021-12-10  Aditya Keerthi  <akeer...@apple.com>
+
+        [iOS] Support find-in-page keyboard shortcuts
+        https://bugs.webkit.org/show_bug.cgi?id=234163
+        rdar://86333128
+
+        Reviewed by Devin Rousso.
+
+        * Platform/spi/ios/UIKitSPI.h:
+        * UIProcess/API/ios/WKWebViewIOS.h:
+        * UIProcess/ios/WKContentViewInteraction.h:
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView canPerformActionForWebView:withSender:]):
+        (-[WKContentView findForWebView:]):
+        (-[WKContentView findNextForWebView:]):
+        (-[WKContentView findPreviousForWebView:]):
+
 2021-12-10  Brady Eidson  <beid...@apple.com>
 
         Teach webpushd to launch an app in response to an injected message.

Modified: trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h (286878 => 286879)


--- trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h	2021-12-10 22:19:03 UTC (rev 286878)
+++ trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h	2021-12-10 22:52:17 UTC (rev 286879)
@@ -1521,6 +1521,19 @@
 @end
 #endif
 
+#if HAVE(UIFINDINTERACTION)
+
+@interface _UIFindInteraction (Staging_84486967)
+
+- (void)presentFindNavigatorShowingReplace:(BOOL)replaceVisible;
+
+- (void)findNext;
+- (void)findPrevious;
+
+@end
+
+#endif
+
 WTF_EXTERN_C_BEGIN
 
 BOOL UIKeyboardEnabledInputModesAllowOneToManyShortcuts(void);

Modified: trunk/Source/WebKit/UIProcess/API/ios/WKWebViewIOS.h (286878 => 286879)


--- trunk/Source/WebKit/UIProcess/API/ios/WKWebViewIOS.h	2021-12-10 22:19:03 UTC (rev 286878)
+++ trunk/Source/WebKit/UIProcess/API/ios/WKWebViewIOS.h	2021-12-10 22:52:17 UTC (rev 286879)
@@ -122,6 +122,12 @@
 - (void)replace:(id)sender;
 - (void)_translate:(id)sender;
 
+#if HAVE(UIFINDINTERACTION)
+- (void)find:(id)sender;
+- (void)findNext:(id)sender;
+- (void)findPrevious:(id)sender;
+#endif
+
 - (void)_nextAccessoryTab:(id)sender;
 - (void)_previousAccessoryTab:(id)sender;
 

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h (286878 => 286879)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h	2021-12-10 22:19:03 UTC (rev 286878)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h	2021-12-10 22:52:17 UTC (rev 286879)
@@ -159,8 +159,18 @@
 #define FOR_EACH_INSERT_TEXT_FROM_CAMERA_WKCONTENTVIEW_ACTION(M)
 #endif
 
+#if HAVE(UIFINDINTERACTION)
+#define FOR_EACH_FIND_WKCONTENTVIEW_ACTION(M) \
+    M(find) \
+    M(findNext) \
+    M(findPrevious)
+#else
+#define FOR_EACH_FIND_WKCONTENTVIEW_ACTION(M)
+#endif
+
 #define FOR_EACH_WKCONTENTVIEW_ACTION(M) \
     FOR_EACH_INSERT_TEXT_FROM_CAMERA_WKCONTENTVIEW_ACTION(M) \
+    FOR_EACH_FIND_WKCONTENTVIEW_ACTION(M) \
     M(_addShortcut) \
     M(_define) \
     M(_lookup) \

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (286878 => 286879)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2021-12-10 22:19:03 UTC (rev 286878)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2021-12-10 22:52:17 UTC (rev 286879)
@@ -3969,6 +3969,11 @@
     }
 #endif // ENABLE(IMAGE_ANALYSIS)
 
+#if HAVE(UIFINDINTERACTION)
+    if (action == @selector(find:) || action == @selector(findNext:) || action == @selector(findPrevious:))
+        return self.webView._findInteractionEnabled;
+#endif
+
     return [super canPerformAction:action withSender:sender];
 }
 
@@ -9976,6 +9981,21 @@
 
 #if HAVE(UIFINDINTERACTION)
 
+- (void)findForWebView:(id)sender
+{
+    [self.webView._findInteraction presentFindNavigatorShowingReplace:NO];
+}
+
+- (void)findNextForWebView:(id)sender
+{
+    [self.webView._findInteraction findNext];
+}
+
+- (void)findPreviousForWebView:(id)sender
+{
+    [self.webView._findInteraction findPrevious];
+}
+
 - (void)performTextSearchWithQueryString:(NSString *)string usingOptions:(_UITextSearchOptions *)options resultAggregator:(id<_UITextSearchAggregator>)aggregator
 {
     OptionSet<WebKit::FindOptions> findOptions;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to