Expose a WKWebView API for allowing programmatic focus to trigger node assistance
[WebKit-https.git] / Source / WebKit2 / UIProcess / API / Cocoa / WKWebView.mm
index 6b06a36..19a025b 100644 (file)
@@ -211,6 +211,8 @@ WKWebView* fromWebPageProxy(WebKit::WebPageProxy& page)
     BOOL _pageIsPrintingToPDF;
     RetainPtr<CGPDFDocumentRef> _printedDocument;
     Vector<std::function<void ()>> _snapshotsDeferredDuringResize;
+
+    BOOL _canAssistOnProgrammaticFocus;
 #endif
 #if PLATFORM(MAC)
     RetainPtr<WKView> _wkView;
@@ -366,6 +368,8 @@ static bool shouldAllowPictureInPictureMediaPlayback()
     _page->contentSizeCategoryDidChange([self _contentSizeCategory]);
 
     [[_configuration _contentProviderRegistry] addPage:*_page];
+
+    [self setCanAssistOnProgrammaticFocus:[_configuration canAssistOnProgrammaticFocus]];
 #endif
 
 #if PLATFORM(MAC)
@@ -716,6 +720,16 @@ static WKErrorCode callbackErrorCode(WebKit::CallbackBase::Error error)
     return _scrollView.get();
 }
 
+- (BOOL)canAssistOnProgrammaticFocus
+{
+    return _canAssistOnProgrammaticFocus;
+}
+
+- (void)setCanAssistOnProgrammaticFocus:(BOOL)canAssistOnProgrammaticFocus
+{
+    _canAssistOnProgrammaticFocus = canAssistOnProgrammaticFocus;
+}
+
 - (WKBrowsingContextController *)browsingContextController
 {
     return [_contentView browsingContextController];