<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Add a WKWebView form delegate API"
   href="https://bugs.webkit.org/show_bug.cgi?id=149646#c3">Comment # 3</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Add a WKWebView form delegate API"
   href="https://bugs.webkit.org/show_bug.cgi?id=149646">bug 149646</a>
              from <span class="vcard"><a class="email" href="mailto:wenson_hsieh&#64;apple.com" title="Wenson Hsieh &lt;wenson_hsieh&#64;apple.com&gt;"> <span class="fn">Wenson Hsieh</span></a>
</span></b>
        <pre>Comment on <span class=""><a href="attachment.cgi?id=262112&amp;action=diff" name="attach_262112" title="Patch">attachment 262112</a> <a href="attachment.cgi?id=262112&amp;action=edit" title="Patch">[details]</a></span>
Patch

View in context: <a href="https://bugs.webkit.org/attachment.cgi?id=262112&amp;action=review">https://bugs.webkit.org/attachment.cgi?id=262112&amp;action=review</a>

<span class="quote">&gt; Source/WebKit2/UIProcess/API/Cocoa/WKFormDelegate.h:35
&gt; +&#64;protocol WKFormDelegate &lt;NSObject&gt;</span >

Since this is intended to be a public API, we'll need a lot of documentation here explaining when these methods are called/what they do. When we're more sure about which methods to include as public API, I'll write detailed descriptions similar to those in WKUIDelegate.h

<span class="quote">&gt; Source/WebKit2/UIProcess/API/Cocoa/WKFormDelegate.h:43
&gt; +- (BOOL)webView:(WKWebView *)webView shouldShowKeyboard:(BOOL)userIsInteracting WK_AVAILABLE(10_11, 9_0);</span >

Since we only have 1 piece of information right now (userIsInteracting) I thought it would make more sense to just pass it in directly here as a parameter -- when we figure out exactly what pieces of information we should give to our clients, we should refactor this method to take in an object or maybe a dictionary containing information about the focused element.

<span class="quote">&gt; Source/WebKit2/UIProcess/API/Cocoa/WKWebView.h:71
&gt; +&#64;property (WK_NULLABLE_PROPERTY nonatomic, weak) id &lt;WKFormDelegate&gt; formDelegate WK_AVAILABLE(10_11, 9_0);</span >

I changed this from _formDelegate to just formDelegate since we're now making it public. However, this means we'll need to do some small changes to Safari where we use the form delegate to make Safari not break.

<span class="quote">&gt; Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm:160
&gt; +    std::unique_ptr&lt;WebKit::FormDelegate&gt; _formDelegateWrapper;</span >

I made the WKWebView access the delegate through a C++ wrapper class, like we do in the case of WKUIDelegate and WKNavigationDelegate.

<span class="quote">&gt; Source/WebKit2/UIProcess/API/Cocoa/_WKFormDelegate.h:33
&gt; +WK_ASSUME_NONNULL_BEGIN</span >

I believe this was in error. I'll remove this.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>