<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[150398] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/150398">150398</a></dd>
<dt>Author</dt> <dd>jberlin@webkit.org</dd>
<dt>Date</dt> <dd>2013-05-20 19:07:48 -0700 (Mon, 20 May 2013)</dd>
</dl>

<h3>Log Message</h3>
<pre>Expose a way to know when forms are added to a page or when form controls are added to a form
in the injected bundle
https://bugs.webkit.org/show_bug.cgi?id=116334

Reviewed by Alexey Proskuryakov.

Source/WebKit2:

Add shouldNotifyOnFormChanges and didAssociateFormControls to the WKBundlePageFormClient.

* WebProcess/InjectedBundle/API/c/WKBundlePage.h:
Add the new callbacks as part of version 2 of the WKBundlePageFormClient.

* WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp:
(WebKit::InjectedBundlePageFormClient::didAssociateFormControls):
Pass the message along to the client if the client has a handler.
(WebKit::InjectedBundlePageFormClient::shouldNotifyOnFormChanges):
Ditto.
* WebProcess/InjectedBundle/InjectedBundlePageFormClient.h:

* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::didAssociateFormControls):
Tell the injected bundle form client for the page.
(WebKit::WebChromeClient::shouldNotifyOnFormChanges):
Ditto.
* WebProcess/WebCoreSupport/WebChromeClient.h:

Tools:

Add tests for the new callbacks.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
Add DidAssociateFormControls/_Bundle.cpp and associate-form-controls.html

* TestWebKitAPI/Tests/WebKit2/DidAssociateFormControls.cpp: Added.
(TestWebKitAPI::nullJavaScriptCallback):
A &quot;null&quot; callback to handle the fact that WKPageRunJavaScriptInMainFrame cannot handle null
being passed in for the callback.
(TestWebKitAPI::didReceiveMessageFromInjectedBundle):
After receiving the message that didAssociateFormControls callback was invoked from adding
the form in the onload handler, tell the page to add a password field to the form, which
should also invoke didAssociateFormControls callback.
(TestWebKitAPI::setInjectedBundleClient):
Register to receive messages.
(TestWebKitAPI::TEST):
Load associate-form-controls.html and wait until the didAssociateFormControls callback has
been invoked for both adding the form and for adding a password field to the form.

* TestWebKitAPI/Tests/WebKit2/DidAssociateFormControls_Bundle.cpp: Added.
(TestWebKitAPI::shouldNotifyOnFormChanges):
Return true so the didAssociateFormControls callback is invoked.
(TestWebKitAPI::didAssociateFormControls):
Tell the UI process.
(TestWebKitAPI::DidAssociateFormControlsTest::DidAssociateFormControlsTest):
(TestWebKitAPI::DidAssociateFormControlsTest::didCreatePage):
Register for the shouldNotifyOnFormChanges and didAssociateFormControls callbacks.

* TestWebKitAPI/Tests/WebKit2/associate-form-controls.html: Added.
Add a form in response to the onload event. Add a button that will add the password field
for manual testing.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleAPIcWKBundlePageh">trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleInjectedBundlePageFormClientcpp">trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleInjectedBundlePageFormClienth">trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebCoreSupportWebChromeClientcpp">trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebCoreSupportWebChromeClienth">trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj">trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2DidAssociateFormControlscpp">trunk/Tools/TestWebKitAPI/Tests/WebKit2/DidAssociateFormControls.cpp</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2DidAssociateFormControls_Bundlecpp">trunk/Tools/TestWebKitAPI/Tests/WebKit2/DidAssociateFormControls_Bundle.cpp</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2associateformcontrolshtml">trunk/Tools/TestWebKitAPI/Tests/WebKit2/associate-form-controls.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (150397 => 150398)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2013-05-21 02:04:12 UTC (rev 150397)
+++ trunk/Source/WebKit2/ChangeLog        2013-05-21 02:07:48 UTC (rev 150398)
</span><span class="lines">@@ -1,3 +1,30 @@
</span><ins>+2013-05-20  Jessie Berlin  &lt;jberlin@apple.com&gt;
+
+        Expose a way to know when forms are added to a page or when form controls are added to a form
+        in the injected bundle
+        https://bugs.webkit.org/show_bug.cgi?id=116334
+
+        Reviewed by Alexey Proskuryakov.
+
+        Add shouldNotifyOnFormChanges and didAssociateFormControls to the WKBundlePageFormClient.
+
+        * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
+        Add the new callbacks as part of version 2 of the WKBundlePageFormClient.
+
+        * WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp:
+        (WebKit::InjectedBundlePageFormClient::didAssociateFormControls):
+        Pass the message along to the client if the client has a handler.
+        (WebKit::InjectedBundlePageFormClient::shouldNotifyOnFormChanges):
+        Ditto.
+        * WebProcess/InjectedBundle/InjectedBundlePageFormClient.h:
+
+        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+        (WebKit::WebChromeClient::didAssociateFormControls):
+        Tell the injected bundle form client for the page.
+        (WebKit::WebChromeClient::shouldNotifyOnFormChanges):
+        Ditto.
+        * WebProcess/WebCoreSupport/WebChromeClient.h:
+
</ins><span class="cx"> 2013-05-20  Tim Horton  &lt;timothy_horton@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Clients should have a way to extend rendering suppression
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleAPIcWKBundlePageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h (150397 => 150398)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h        2013-05-21 02:04:12 UTC (rev 150397)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h        2013-05-21 02:07:48 UTC (rev 150398)
</span><span class="lines">@@ -338,6 +338,8 @@
</span><span class="cx"> typedef void (*WKBundlePageWillSubmitFormCallback)(WKBundlePageRef page, WKBundleNodeHandleRef htmlFormElementHandle, WKBundleFrameRef frame, WKBundleFrameRef sourceFrame, WKDictionaryRef values, WKTypeRef* userData, const void* clientInfo);
</span><span class="cx"> typedef void (*WKBundlePageWillSendSubmitEventCallback)(WKBundlePageRef page, WKBundleNodeHandleRef htmlFormElementHandle, WKBundleFrameRef frame, WKBundleFrameRef sourceFrame, WKDictionaryRef values, const void* clientInfo);
</span><span class="cx"> typedef void (*WKBundlePageDidFocusTextFieldCallback)(WKBundlePageRef page, WKBundleNodeHandleRef htmlInputElementHandle, WKBundleFrameRef frame, const void* clientInfo);
</span><ins>+typedef bool (*WKBundlePageShouldNotifyOnFormChangesCallback)(WKBundlePageRef page, const void* clientInfo);
+typedef void (*WKBundlePageDidAssociateFormControlsCallback)(WKBundlePageRef page, WKArrayRef elementHandles, const void* clientInfo);
</ins><span class="cx"> 
</span><span class="cx"> struct WKBundlePageFormClient {
</span><span class="cx">     int                                                                 version;
</span><span class="lines">@@ -356,6 +358,8 @@
</span><span class="cx"> 
</span><span class="cx">     // version 2.
</span><span class="cx">     WKBundlePageDidFocusTextFieldCallback                               didFocusTextField;
</span><ins>+    WKBundlePageShouldNotifyOnFormChangesCallback                       shouldNotifyOnFormChanges;
+    WKBundlePageDidAssociateFormControlsCallback                        didAssociateFormControls;
</ins><span class="cx"> };
</span><span class="cx"> typedef struct WKBundlePageFormClient WKBundlePageFormClient;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleInjectedBundlePageFormClientcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp (150397 => 150398)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp        2013-05-21 02:04:12 UTC (rev 150397)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp        2013-05-21 02:07:48 UTC (rev 150398)
</span><span class="lines">@@ -26,6 +26,7 @@
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> #include &quot;InjectedBundlePageFormClient.h&quot;
</span><span class="cx"> 
</span><ins>+#include &quot;ImmutableArray.h&quot;
</ins><span class="cx"> #include &quot;ImmutableDictionary.h&quot;
</span><span class="cx"> #include &quot;InjectedBundleNodeHandle.h&quot;
</span><span class="cx"> #include &quot;WKAPICast.h&quot;
</span><span class="lines">@@ -124,4 +125,28 @@
</span><span class="cx">     userData = adoptRef(toImpl(userDataToPass));
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void InjectedBundlePageFormClient::didAssociateFormControls(WebPage* page, const Vector&lt;RefPtr&lt;WebCore::Element&gt;&gt;&amp; elements)
+{
+    if (!m_client.didAssociateFormControls)
+        return;
+
+    size_t size = elements.size();
+
+    Vector&lt;RefPtr&lt;APIObject&gt;&gt; elementHandles;
+    elementHandles.reserveCapacity(size);
+
+    for (size_t i = 0; i &lt; size; ++i)
+        elementHandles.uncheckedAppend(InjectedBundleNodeHandle::getOrCreate(elements[i].get()).get());
+
+    m_client.didAssociateFormControls(toAPI(page), toAPI(ImmutableArray::adopt(elementHandles).get()), m_client.clientInfo);
+}
+
+bool InjectedBundlePageFormClient::shouldNotifyOnFormChanges(WebPage* page)
+{
+    if (!m_client.shouldNotifyOnFormChanges)
+        return false;
+
+    return m_client.shouldNotifyOnFormChanges(toAPI(page), m_client.clientInfo);
+}
+
</ins><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleInjectedBundlePageFormClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.h (150397 => 150398)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.h        2013-05-21 02:04:12 UTC (rev 150397)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.h        2013-05-21 02:07:48 UTC (rev 150398)
</span><span class="lines">@@ -33,9 +33,10 @@
</span><span class="cx"> #include &lt;wtf/Vector.h&gt;
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><del>-    class HTMLFormElement;
-    class HTMLInputElement;
-    class HTMLTextAreaElement;
</del><ins>+class Element;
+class HTMLFormElement;
+class HTMLInputElement;
+class HTMLTextAreaElement;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> namespace WebKit {
</span><span class="lines">@@ -55,6 +56,8 @@
</span><span class="cx">     bool shouldPerformActionInTextField(WebPage*, WebCore::HTMLInputElement*, WKInputFieldActionType, WebFrame*);    
</span><span class="cx">     void willSubmitForm(WebPage*, WebCore::HTMLFormElement*, WebFrame*, WebFrame* sourceFrame, const Vector&lt;std::pair&lt;String, String&gt;&gt;&amp;, RefPtr&lt;APIObject&gt;&amp; userData);
</span><span class="cx">     void willSendSubmitEvent(WebPage*, WebCore::HTMLFormElement*, WebFrame*, WebFrame* sourceFrame, const Vector&lt;std::pair&lt;String, String&gt;&gt;&amp;);
</span><ins>+    void didAssociateFormControls(WebPage*, const Vector&lt;RefPtr&lt;WebCore::Element&gt;&gt;&amp;);
+    bool shouldNotifyOnFormChanges(WebPage*);
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebCoreSupportWebChromeClientcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp (150397 => 150398)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp        2013-05-21 02:04:12 UTC (rev 150397)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp        2013-05-21 02:07:48 UTC (rev 150398)
</span><span class="lines">@@ -716,6 +716,16 @@
</span><span class="cx">     notImplemented();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void WebChromeClient::didAssociateFormControls(const Vector&lt;RefPtr&lt;WebCore::Element&gt;&gt;&amp; elements)
+{
+    return m_page-&gt;injectedBundleFormClient().didAssociateFormControls(m_page, elements);
+}
+
+bool WebChromeClient::shouldNotifyOnFormChanges()
+{
+    return m_page-&gt;injectedBundleFormClient().shouldNotifyOnFormChanges(m_page);
+}
+
</ins><span class="cx"> bool WebChromeClient::selectItemWritingDirectionIsNatural()
</span><span class="cx"> {
</span><span class="cx"> #if PLATFORM(EFL)
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebCoreSupportWebChromeClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h (150397 => 150398)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h        2013-05-21 02:04:12 UTC (rev 150397)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h        2013-05-21 02:07:48 UTC (rev 150398)
</span><span class="lines">@@ -170,6 +170,9 @@
</span><span class="cx">     // will be called frequently, so handling should be very fast.
</span><span class="cx">     virtual void formStateDidChange(const WebCore::Node*) OVERRIDE;
</span><span class="cx"> 
</span><ins>+    virtual void didAssociateFormControls(const Vector&lt;RefPtr&lt;WebCore::Element&gt;&gt;&amp;) OVERRIDE;
+    virtual bool shouldNotifyOnFormChanges() OVERRIDE;
+
</ins><span class="cx">     virtual bool selectItemWritingDirectionIsNatural() OVERRIDE;
</span><span class="cx">     virtual bool selectItemAlignmentFollowsMenuWritingDirection() OVERRIDE;
</span><span class="cx">     virtual bool hasOpenedPopup() const OVERRIDE;
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (150397 => 150398)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2013-05-21 02:04:12 UTC (rev 150397)
+++ trunk/Tools/ChangeLog        2013-05-21 02:07:48 UTC (rev 150398)
</span><span class="lines">@@ -1,3 +1,43 @@
</span><ins>+2013-05-20  Jessie Berlin  &lt;jberlin@apple.com&gt;
+
+        Expose a way to know when forms are added to a page or when form controls are added to a form
+        in the injected bundle
+        https://bugs.webkit.org/show_bug.cgi?id=116334
+
+        Reviewed by Alexey Proskuryakov.
+
+        Add tests for the new callbacks.
+
+        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+        Add DidAssociateFormControls/_Bundle.cpp and associate-form-controls.html
+
+        * TestWebKitAPI/Tests/WebKit2/DidAssociateFormControls.cpp: Added.
+        (TestWebKitAPI::nullJavaScriptCallback):
+        A &quot;null&quot; callback to handle the fact that WKPageRunJavaScriptInMainFrame cannot handle null
+        being passed in for the callback.
+        (TestWebKitAPI::didReceiveMessageFromInjectedBundle):
+        After receiving the message that didAssociateFormControls callback was invoked from adding
+        the form in the onload handler, tell the page to add a password field to the form, which
+        should also invoke didAssociateFormControls callback.
+        (TestWebKitAPI::setInjectedBundleClient):
+        Register to receive messages.
+        (TestWebKitAPI::TEST):
+        Load associate-form-controls.html and wait until the didAssociateFormControls callback has
+        been invoked for both adding the form and for adding a password field to the form.
+
+        * TestWebKitAPI/Tests/WebKit2/DidAssociateFormControls_Bundle.cpp: Added.
+        (TestWebKitAPI::shouldNotifyOnFormChanges):
+        Return true so the didAssociateFormControls callback is invoked.
+        (TestWebKitAPI::didAssociateFormControls):
+        Tell the UI process.
+        (TestWebKitAPI::DidAssociateFormControlsTest::DidAssociateFormControlsTest):
+        (TestWebKitAPI::DidAssociateFormControlsTest::didCreatePage):
+        Register for the shouldNotifyOnFormChanges and didAssociateFormControls callbacks.
+
+        * TestWebKitAPI/Tests/WebKit2/associate-form-controls.html: Added.
+        Add a form in response to the onload event. Add a button that will add the password field
+        for manual testing.
+
</ins><span class="cx"> 2013-05-20  Christophe Dumez  &lt;ch.dumez@sisa.samsung.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [EFL][JHBUILD] Make sure eet is built before evas
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (150397 => 150398)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2013-05-21 02:04:12 UTC (rev 150397)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2013-05-21 02:07:48 UTC (rev 150398)
</span><span class="lines">@@ -209,6 +209,9 @@
</span><span class="cx">                 F660AA1115A5F631003A1243 /* GetInjectedBundleInitializationUserDataCallback_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F660AA0F15A5F624003A1243 /* GetInjectedBundleInitializationUserDataCallback_Bundle.cpp */; };
</span><span class="cx">                 F660AA1315A619C9003A1243 /* InjectedBundleInitializationUserDataCallbackWins.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F660AA1215A619C8003A1243 /* InjectedBundleInitializationUserDataCallbackWins.cpp */; };
</span><span class="cx">                 F660AA1515A61ABF003A1243 /* InjectedBundleInitializationUserDataCallbackWins_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F660AA1415A61ABF003A1243 /* InjectedBundleInitializationUserDataCallbackWins_Bundle.cpp */; };
</span><ins>+                F6B7BE9417469209008A3445 /* DidAssociateFormControls.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F6B7BE93174691EF008A3445 /* DidAssociateFormControls.cpp */; };
+                F6B7BE9517469212008A3445 /* DidAssociateFormControls_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F6B7BE92174691EF008A3445 /* DidAssociateFormControls_Bundle.cpp */; };
+                F6B7BE9717469B96008A3445 /* associate-form-controls.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F6B7BE9617469B7E008A3445 /* associate-form-controls.html */; };
</ins><span class="cx">                 F6F3F29113342FEB00A6BF19 /* CookieManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F6F3F29013342FEB00A6BF19 /* CookieManager.cpp */; };
</span><span class="cx">                 F6F49C6915545C8E0007F39D /* DOMWindowExtensionNoCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F6F49C6715545C8D0007F39D /* DOMWindowExtensionNoCache.cpp */; };
</span><span class="cx">                 F6F49C6B15545CA70007F39D /* DOMWindowExtensionNoCache_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F6F49C6615545C8D0007F39D /* DOMWindowExtensionNoCache_Bundle.cpp */; };
</span><span class="lines">@@ -248,6 +251,7 @@
</span><span class="cx">                                 C2CF975B16CEC71B0054E99D /* JSContextBackForwardCache1.html in Copy Resources */,
</span><span class="cx">                                 C2CF975A16CEC7140054E99D /* JSContextBackForwardCache2.html in Copy Resources */,
</span><span class="cx">                                 1A9E52C913E65EF4006917F5 /* 18-characters.html in Copy Resources */,
</span><ins>+                                F6B7BE9717469B96008A3445 /* associate-form-controls.html in Copy Resources */,
</ins><span class="cx">                                 379028B914FAC24C007E6B43 /* acceptsFirstMouse.html in Copy Resources */,
</span><span class="cx">                                 B55F11BE15191A0600915916 /* Ahem.ttf in Copy Resources */,
</span><span class="cx">                                 B55F11B71517D03300915916 /* attributedStringCustomFont.html in Copy Resources */,
</span><span class="lines">@@ -511,6 +515,9 @@
</span><span class="cx">                 F660AA0F15A5F624003A1243 /* GetInjectedBundleInitializationUserDataCallback_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GetInjectedBundleInitializationUserDataCallback_Bundle.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 F660AA1215A619C8003A1243 /* InjectedBundleInitializationUserDataCallbackWins.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundleInitializationUserDataCallbackWins.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 F660AA1415A61ABF003A1243 /* InjectedBundleInitializationUserDataCallbackWins_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundleInitializationUserDataCallbackWins_Bundle.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                F6B7BE92174691EF008A3445 /* DidAssociateFormControls_Bundle.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = DidAssociateFormControls_Bundle.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                F6B7BE93174691EF008A3445 /* DidAssociateFormControls.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = DidAssociateFormControls.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                F6B7BE9617469B7E008A3445 /* associate-form-controls.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = &quot;associate-form-controls.html&quot;; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 F6F3F29013342FEB00A6BF19 /* CookieManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CookieManager.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 F6F49C6615545C8D0007F39D /* DOMWindowExtensionNoCache_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMWindowExtensionNoCache_Bundle.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 F6F49C6715545C8D0007F39D /* DOMWindowExtensionNoCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMWindowExtensionNoCache.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -666,6 +673,8 @@
</span><span class="cx">                                 BC246D98132F1FE100B56D7C /* CanHandleRequest.cpp */,
</span><span class="cx">                                 BC246D97132F1FE100B56D7C /* CanHandleRequest_Bundle.cpp */,
</span><span class="cx">                                 F6F3F29013342FEB00A6BF19 /* CookieManager.cpp */,
</span><ins>+                                F6B7BE93174691EF008A3445 /* DidAssociateFormControls.cpp */,
+                                F6B7BE92174691EF008A3445 /* DidAssociateFormControls_Bundle.cpp */,
</ins><span class="cx">                                 BCB6803F126FBFE100642A61 /* DocumentStartUserScriptAlertCrash.cpp */,
</span><span class="cx">                                 BCB68041126FBFF100642A61 /* DocumentStartUserScriptAlertCrash_Bundle.cpp */,
</span><span class="cx">                                 51393E1E1523944A005F39C5 /* DOMWindowExtensionBasic.cpp */,
</span><span class="lines">@@ -776,6 +785,7 @@
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><span class="cx">                                 C045F9461385C2F800C0F3CD /* 18-characters.html */,
</span><ins>+                                F6B7BE9617469B7E008A3445 /* associate-form-controls.html */,
</ins><span class="cx">                                 76E182DE15475A8300F1FADD /* auto-submitting-form.html */,
</span><span class="cx">                                 290F4274172A1FDE00939FF0 /* custom-protocol-sync-xhr.html */,
</span><span class="cx">                                 C5E1AFFD16B22179006CC1F2 /* execCopy.html */,
</span><span class="lines">@@ -1153,6 +1163,7 @@
</span><span class="cx">                                 37E38C34169B7D010084C28C /* WebViewDidRemoveFrameFromHierarchy.mm in Sources */,
</span><span class="cx">                                 76E182DA1547550100F1FADD /* WillSendSubmitEvent.cpp in Sources */,
</span><span class="cx">                                 A5E2027315B2181900C13E14 /* WindowlessWebViewWithMedia.mm in Sources */,
</span><ins>+                                F6B7BE9417469209008A3445 /* DidAssociateFormControls.cpp in Sources */,
</ins><span class="cx">                                 BC3C4C7F14587AA60025FB62 /* WKBrowsingContextGroupTest.mm in Sources */,
</span><span class="cx">                                 BC3C4C7214575B6A0025FB62 /* WKBrowsingContextLoadDelegateTest.mm in Sources */,
</span><span class="cx">                                 BC901E241492ADCE0074A667 /* WKConnection.cpp in Sources */,
</span><span class="lines">@@ -1195,6 +1206,7 @@
</span><span class="cx">                                 7CFBCAE51743238F00B2BFCF /* WillLoad_Bundle.cpp in Sources */,
</span><span class="cx">                                 BC575BD9126F58E2006F0F12 /* PlatformUtilities.cpp in Sources */,
</span><span class="cx">                                 BC575BE0126F590D006F0F12 /* PlatformUtilitiesMac.mm in Sources */,
</span><ins>+                                F6B7BE9517469212008A3445 /* DidAssociateFormControls_Bundle.cpp in Sources */,
</ins><span class="cx">                                 C0BD669F131D3CFF00E18F2A /* ResponsivenessTimerDoesntFireEarly_Bundle.cpp in Sources */,
</span><span class="cx">                                 51FCF7A11534B2A000104491 /* ShouldGoToBackForwardListItem_Bundle.cpp in Sources */,
</span><span class="cx">                                 BC22D31914DC68B900FFB1DD /* UserMessage_Bundle.cpp in Sources */,
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2DidAssociateFormControlscpp"></a>
<div class="addfile"><h4>Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2/DidAssociateFormControls.cpp (0 => 150398)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2/DidAssociateFormControls.cpp                                (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2/DidAssociateFormControls.cpp        2013-05-21 02:07:48 UTC (rev 150398)
</span><span class="lines">@@ -0,0 +1,83 @@
</span><ins>+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include &quot;config.h&quot;
+#include &quot;PlatformUtilities.h&quot;
+#include &quot;PlatformWebView.h&quot;
+#include &quot;Test.h&quot;
+
+namespace TestWebKitAPI {
+
+static bool didReceiveAllMessages = false;
+static bool receivedMessageForAddingForm = false;
+static const uint64_t expectedNumberOfElements = 1;
+
+static void nullJavaScriptCallback(WKSerializedScriptValueRef, WKErrorRef, void*)
+{
+}
+
+static void didReceiveMessageFromInjectedBundle(WKContextRef, WKStringRef messageName, WKTypeRef messageBody, const void*)
+{
+    EXPECT_WK_STREQ(&quot;DidReceiveDidAssociateFormControls&quot;, messageName);
+    ASSERT_NOT_NULL(messageBody);
+    EXPECT_EQ(WKDictionaryGetTypeID(), WKGetTypeID(messageBody));
+
+    WKDictionaryRef dictionary = static_cast&lt;WKDictionaryRef&gt;(messageBody);
+    uint64_t numberOfElements = WKUInt64GetValue(static_cast&lt;WKUInt64Ref&gt;(WKDictionaryGetItemForKey(dictionary, Util::toWK(&quot;NumberOfControls&quot;).get())));
+
+    EXPECT_EQ(expectedNumberOfElements, numberOfElements);
+
+    if (!receivedMessageForAddingForm) {
+        receivedMessageForAddingForm = true;
+
+        WKPageRef page = static_cast&lt;WKPageRef&gt;(WKDictionaryGetItemForKey(dictionary, Util::toWK(&quot;Page&quot;).get()));
+        WKPageRunJavaScriptInMainFrame(page, Util::toWK(&quot;addPasswordFieldToForm()&quot;).get(), 0, nullJavaScriptCallback);
+
+        return;
+    }
+
+    didReceiveAllMessages = true;
+}
+
+static void setInjectedBundleClient(WKContextRef context)
+{
+    WKContextInjectedBundleClient injectedBundleClient;
+    memset(&amp;injectedBundleClient, 0, sizeof(injectedBundleClient));
+    injectedBundleClient.didReceiveMessageFromInjectedBundle = didReceiveMessageFromInjectedBundle;
+
+    WKContextSetInjectedBundleClient(context, &amp;injectedBundleClient);
+}
+
+TEST(WebKit2, DidAssociateFormControls)
+{
+    WKRetainPtr&lt;WKContextRef&gt; context = adoptWK(Util::createContextForInjectedBundleTest(&quot;DidAssociateFormControlsTest&quot;));
+    setInjectedBundleClient(context.get());
+
+    PlatformWebView webView(context.get());
+    WKPageLoadURL(webView.page(), adoptWK(Util::createURLForResource(&quot;associate-form-controls&quot;, &quot;html&quot;)).get());
+    Util::run(&amp;didReceiveAllMessages);
+}
+
+} // namespace TestWebKitAPI
</ins></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2DidAssociateFormControls_Bundlecpp"></a>
<div class="addfile"><h4>Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2/DidAssociateFormControls_Bundle.cpp (0 => 150398)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2/DidAssociateFormControls_Bundle.cpp                                (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2/DidAssociateFormControls_Bundle.cpp        2013-05-21 02:07:48 UTC (rev 150398)
</span><span class="lines">@@ -0,0 +1,78 @@
</span><ins>+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include &quot;config.h&quot;
+#include &quot;InjectedBundleTest.h&quot;
+
+#include &quot;PlatformUtilities.h&quot;
+#include &lt;WebKit2/WKBundle.h&gt;
+#include &lt;WebKit2/WKBundlePage.h&gt;
+
+namespace TestWebKitAPI {
+
+class DidAssociateFormControlsTest : public InjectedBundleTest {
+public:
+    DidAssociateFormControlsTest(const std::string&amp; identifier);
+
+    virtual void didCreatePage(WKBundleRef, WKBundlePageRef) OVERRIDE;
+};
+
+static InjectedBundleTest::Register&lt;DidAssociateFormControlsTest&gt; registrar(&quot;DidAssociateFormControlsTest&quot;);
+
+static bool shouldNotifyOnFormChanges(WKBundlePageRef, const void*)
+{
+    return true;
+}
+
+static void didAssociateFormControls(WKBundlePageRef page, WKArrayRef elementHandles, const void*)
+{
+    WKRetainPtr&lt;WKMutableDictionaryRef&gt; messageBody = adoptWK(WKMutableDictionaryCreate());
+
+    WKDictionaryAddItem(messageBody.get(), Util::toWK(&quot;Page&quot;).get(), page);
+    WKRetainPtr&lt;WKUInt64Ref&gt; numberOfElements = adoptWK(WKUInt64Create(WKArrayGetSize(elementHandles)));
+    WKDictionaryAddItem(messageBody.get(), Util::toWK(&quot;NumberOfControls&quot;).get(), numberOfElements.get());
+
+    WKBundlePostMessage(InjectedBundleController::shared().bundle(), Util::toWK(&quot;DidReceiveDidAssociateFormControls&quot;).get(), messageBody.get());
+}
+
+DidAssociateFormControlsTest::DidAssociateFormControlsTest(const std::string&amp; identifier)
+    : InjectedBundleTest(identifier)
+{
+}
+
+void DidAssociateFormControlsTest::didCreatePage(WKBundleRef bundle, WKBundlePageRef page)
+{
+    WKBundlePageFormClient formClient;
+    memset(&amp;formClient, 0, sizeof(formClient));
+
+    formClient.version = 2;
+    formClient.clientInfo = this;
+    formClient.shouldNotifyOnFormChanges = shouldNotifyOnFormChanges;
+    formClient.didAssociateFormControls = didAssociateFormControls;
+
+    WKBundlePageSetFormClient(page, &amp;formClient);
+}
+
+} // namespace TestWebKitAPI
</ins></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2associateformcontrolshtml"></a>
<div class="addfile"><h4>Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2/associate-form-controls.html (0 => 150398)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2/associate-form-controls.html                                (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2/associate-form-controls.html        2013-05-21 02:07:48 UTC (rev 150398)
</span><span class="lines">@@ -0,0 +1,31 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+  &lt;script&gt;
+    function addForm()
+    {
+        var form = document.createElement(&quot;form&quot;);
+        form.id = &quot;login_form&quot;;
+
+        var usernameField = document.createElement(&quot;input&quot;);
+        usernameField.id = &quot;username&quot;;
+        usernameField.type = &quot;text&quot;;
+        form.appendChild(usernameField);
+
+        document.body.appendChild(form);
+    }
+
+    function addPasswordFieldToForm()
+    {
+        var passwordField = document.createElement(&quot;input&quot;);
+        passwordField.id = &quot;password&quot;;
+        passwordField.type = &quot;password&quot;;
+
+        var form = document.getElementById(&quot;login_form&quot;);
+        form.appendChild(passwordField);
+    }
+  &lt;/script&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;addForm()&quot;&gt;
+&lt;button onclick=&quot;addPasswordFieldToForm()&quot;&gt;Manual Testing: Add the password field&lt;/button&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre>
</div>
</div>

</body>
</html>