<!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>[185089] 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/185089">185089</a></dd>
<dt>Author</dt> <dd>dbates@webkit.org</dd>
<dt>Date</dt> <dd>2015-06-01 17:01:40 -0700 (Mon, 01 Jun 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Notify client that we began editing when text field is focused
https://bugs.webkit.org/show_bug.cgi?id=145439
&lt;rdar://problem/21142108&gt;

Reviewed by Anders Carlsson.

Source/WebCore:

Inform the editor client that we began editing when a text field is focused either
by being explicitly focused (programmatically or by user interaction) or implicitly
focused when the window became active.

Currently we only notify the editor client that we began editing a text field when
when a person actually changes the value of the field. And we always notify the
client that we ended editing when a text field is defocused regardless of whether
we executed a began editing callback. Moreover we notify a client that we
ended editing when the field is defocused (either explicitly or implicitly when the
window becomes inactive). Instead we should always notify the client that we began
editing when the field is focused so that this callback is symmetric with the end
editing callback.

* html/SearchInputType.cpp:
(WebCore::SearchInputType::didSetValueByUserEdit): Remove parameter for ValueChangeState,
which was used to determine whether we should notify the client that we began editing, because
we we will notify the client that editing began when the text field is focused as opposed to
when the value of text field first changes.
* html/SearchInputType.h: Ditto.
* html/TextFieldInputType.cpp:
(WebCore::TextFieldInputType::forwardEvent): Notify the client that we began editing when
the text field is focused.
(WebCore::TextFieldInputType::subtreeHasChanged): Update call site of didSetValueByUserEdit()
following the removal of its parameter.
(WebCore::TextFieldInputType::didSetValueByUserEdit): Ditto.
* html/TextFieldInputType.h:

Tools:

Add API test to ensure that we dispatch textFieldDid{Begin, End}Editing callbacks when
a text field is focused and defocused.

* TestWebKitAPI/CMakeLists.txt:
* TestWebKitAPI/PlatformEfl.cmake:
* TestWebKitAPI/PlatformGTK.cmake:
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit2/TextFieldDidBeginAndEndEditing.cpp: Added.
(TestWebKitAPI::WebKit2TextFieldBeginAndEditEditingTest::didReceiveMessageFromInjectedBundle):
(TestWebKitAPI::WebKit2TextFieldBeginAndEditEditingTest::didFinishLoadForFrame):
(TestWebKitAPI::WebKit2TextFieldBeginAndEditEditingTest::setInjectedBundleClient):
(TestWebKitAPI::WebKit2TextFieldBeginAndEditEditingTest::setPageLoaderClient):
(TestWebKitAPI::WebKit2TextFieldBeginAndEditEditingTest::nullJavaScriptCallback):
(TestWebKitAPI::WebKit2TextFieldBeginAndEditEditingTest::executeJavaScriptAndCheckDidReceiveMessage):
(TestWebKitAPI::TEST_F):
* TestWebKitAPI/Tests/WebKit2/TextFieldDidBeginAndEndEditing_Bundle.cpp: Added.
(TestWebKitAPI::textFieldDidBeginEditing):
(TestWebKitAPI::textFieldDidEndEditing):
(TestWebKitAPI::TextFieldDidBeginAndEndEditingEventsTest::TextFieldDidBeginAndEndEditingEventsTest):
(TestWebKitAPI::TextFieldDidBeginAndEndEditingEventsTest::didCreatePage):
* TestWebKitAPI/Tests/WebKit2/input-focus-blur.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorehtmlSearchInputTypecpp">trunk/Source/WebCore/html/SearchInputType.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlSearchInputTypeh">trunk/Source/WebCore/html/SearchInputType.h</a></li>
<li><a href="#trunkSourceWebCorehtmlTextFieldInputTypecpp">trunk/Source/WebCore/html/TextFieldInputType.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlTextFieldInputTypeh">trunk/Source/WebCore/html/TextFieldInputType.h</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsTestWebKitAPICMakeListstxt">trunk/Tools/TestWebKitAPI/CMakeLists.txt</a></li>
<li><a href="#trunkToolsTestWebKitAPIPlatformEflcmake">trunk/Tools/TestWebKitAPI/PlatformEfl.cmake</a></li>
<li><a href="#trunkToolsTestWebKitAPIPlatformGTKcmake">trunk/Tools/TestWebKitAPI/PlatformGTK.cmake</a></li>
<li><a href="#trunkToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj">trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2TextFieldDidBeginAndEndEditingcpp">trunk/Tools/TestWebKitAPI/Tests/WebKit2/TextFieldDidBeginAndEndEditing.cpp</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2TextFieldDidBeginAndEndEditing_Bundlecpp">trunk/Tools/TestWebKitAPI/Tests/WebKit2/TextFieldDidBeginAndEndEditing_Bundle.cpp</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2inputfocusblurhtml">trunk/Tools/TestWebKitAPI/Tests/WebKit2/input-focus-blur.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (185088 => 185089)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-06-01 23:57:39 UTC (rev 185088)
+++ trunk/Source/WebCore/ChangeLog        2015-06-02 00:01:40 UTC (rev 185089)
</span><span class="lines">@@ -1,3 +1,38 @@
</span><ins>+2015-06-01  Daniel Bates  &lt;dabates@apple.com&gt;
+
+        Notify client that we began editing when text field is focused
+        https://bugs.webkit.org/show_bug.cgi?id=145439
+        &lt;rdar://problem/21142108&gt;
+
+        Reviewed by Anders Carlsson.
+
+        Inform the editor client that we began editing when a text field is focused either
+        by being explicitly focused (programmatically or by user interaction) or implicitly
+        focused when the window became active.
+
+        Currently we only notify the editor client that we began editing a text field when
+        when a person actually changes the value of the field. And we always notify the
+        client that we ended editing when a text field is defocused regardless of whether
+        we executed a began editing callback. Moreover we notify a client that we
+        ended editing when the field is defocused (either explicitly or implicitly when the
+        window becomes inactive). Instead we should always notify the client that we began
+        editing when the field is focused so that this callback is symmetric with the end
+        editing callback.
+
+        * html/SearchInputType.cpp:
+        (WebCore::SearchInputType::didSetValueByUserEdit): Remove parameter for ValueChangeState,
+        which was used to determine whether we should notify the client that we began editing, because
+        we we will notify the client that editing began when the text field is focused as opposed to
+        when the value of text field first changes.
+        * html/SearchInputType.h: Ditto.
+        * html/TextFieldInputType.cpp:
+        (WebCore::TextFieldInputType::forwardEvent): Notify the client that we began editing when
+        the text field is focused.
+        (WebCore::TextFieldInputType::subtreeHasChanged): Update call site of didSetValueByUserEdit()
+        following the removal of its parameter.
+        (WebCore::TextFieldInputType::didSetValueByUserEdit): Ditto.
+        * html/TextFieldInputType.h:
+
</ins><span class="cx"> 2015-06-01  Anders Carlsson  &lt;andersca@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         WAKScrollView.h cannot be imported standalone
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlSearchInputTypecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/SearchInputType.cpp (185088 => 185089)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/SearchInputType.cpp        2015-06-01 23:57:39 UTC (rev 185088)
+++ trunk/Source/WebCore/html/SearchInputType.cpp        2015-06-02 00:01:40 UTC (rev 185089)
</span><span class="lines">@@ -183,7 +183,7 @@
</span><span class="cx">     return element().fastHasAttribute(incrementalAttr);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void SearchInputType::didSetValueByUserEdit(ValueChangeState state)
</del><ins>+void SearchInputType::didSetValueByUserEdit()
</ins><span class="cx"> {
</span><span class="cx">     if (m_cancelButton &amp;&amp; element().renderer())
</span><span class="cx">         downcast&lt;RenderSearchField&gt;(*element().renderer()).updateCancelButtonVisibility();
</span><span class="lines">@@ -192,7 +192,7 @@
</span><span class="cx">     if (searchEventsShouldBeDispatched())
</span><span class="cx">         startSearchEventTimer();
</span><span class="cx"> 
</span><del>-    TextFieldInputType::didSetValueByUserEdit(state);
</del><ins>+    TextFieldInputType::didSetValueByUserEdit();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool SearchInputType::sizeShouldIncludeDecoration(int, int&amp; preferredSize) const
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlSearchInputTypeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/SearchInputType.h (185088 => 185089)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/SearchInputType.h        2015-06-01 23:57:39 UTC (rev 185088)
+++ trunk/Source/WebCore/html/SearchInputType.h        2015-06-02 00:01:40 UTC (rev 185089)
</span><span class="lines">@@ -57,7 +57,7 @@
</span><span class="cx">     virtual HTMLElement* resultsButtonElement() const override;
</span><span class="cx">     virtual HTMLElement* cancelButtonElement() const override;
</span><span class="cx">     virtual void handleKeydownEvent(KeyboardEvent*) override;
</span><del>-    virtual void didSetValueByUserEdit(ValueChangeState) override;
</del><ins>+    virtual void didSetValueByUserEdit() override;
</ins><span class="cx">     virtual bool sizeShouldIncludeDecoration(int defaultSize, int&amp; preferredSize) const override;
</span><span class="cx">     virtual float decorationWidth() const override;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlTextFieldInputTypecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/TextFieldInputType.cpp (185088 => 185089)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/TextFieldInputType.cpp        2015-06-01 23:57:39 UTC (rev 185088)
+++ trunk/Source/WebCore/html/TextFieldInputType.cpp        2015-06-02 00:01:40 UTC (rev 185089)
</span><span class="lines">@@ -206,8 +206,11 @@
</span><span class="cx">                 }
</span><span class="cx"> 
</span><span class="cx">                 capsLockStateMayHaveChanged();
</span><del>-            } else if (event-&gt;type() == eventNames().focusEvent)
</del><ins>+            } else if (event-&gt;type() == eventNames().focusEvent) {
+                if (Frame* frame = element().document().frame())
+                    frame-&gt;editor().textFieldDidBeginEditing(&amp;element());
</ins><span class="cx">                 capsLockStateMayHaveChanged();
</span><ins>+            }
</ins><span class="cx"> 
</span><span class="cx">             element().forwardEvent(event);
</span><span class="cx">         }
</span><span class="lines">@@ -482,7 +485,6 @@
</span><span class="cx"> 
</span><span class="cx"> void TextFieldInputType::subtreeHasChanged()
</span><span class="cx"> {
</span><del>-    bool wasChanged = element().wasChangedSinceLastFormControlChangeEvent();
</del><span class="cx">     element().setChangedSinceLastFormControlChangeEvent(true);
</span><span class="cx"> 
</span><span class="cx">     // We don't need to call sanitizeUserInputValue() function here because
</span><span class="lines">@@ -494,18 +496,15 @@
</span><span class="cx">     // Recalc for :invalid change.
</span><span class="cx">     element().setNeedsStyleRecalc();
</span><span class="cx"> 
</span><del>-    didSetValueByUserEdit(wasChanged ? ValueChangeStateChanged : ValueChangeStateNone);
</del><ins>+    didSetValueByUserEdit();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void TextFieldInputType::didSetValueByUserEdit(ValueChangeState state)
</del><ins>+void TextFieldInputType::didSetValueByUserEdit()
</ins><span class="cx"> {
</span><span class="cx">     if (!element().focused())
</span><span class="cx">         return;
</span><del>-    if (Frame* frame = element().document().frame()) {
-        if (state == ValueChangeStateNone)
-            frame-&gt;editor().textFieldDidBeginEditing(&amp;element());
</del><ins>+    if (Frame* frame = element().document().frame())
</ins><span class="cx">         frame-&gt;editor().textDidChangeInTextField(&amp;element());
</span><del>-    }
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void TextFieldInputType::spinButtonStepDown()
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlTextFieldInputTypeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/TextFieldInputType.h (185088 => 185089)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/TextFieldInputType.h        2015-06-01 23:57:39 UTC (rev 185088)
+++ trunk/Source/WebCore/html/TextFieldInputType.h        2015-06-02 00:01:40 UTC (rev 185089)
</span><span class="lines">@@ -72,11 +72,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     virtual String convertFromVisibleValue(const String&amp;) const;
</span><del>-    enum ValueChangeState {
-        ValueChangeStateNone,
-        ValueChangeStateChanged
-    };
-    virtual void didSetValueByUserEdit(ValueChangeState);
</del><ins>+    virtual void didSetValueByUserEdit();
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     virtual bool isKeyboardFocusable(KeyboardEvent*) const override final;
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (185088 => 185089)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2015-06-01 23:57:39 UTC (rev 185088)
+++ trunk/Tools/ChangeLog        2015-06-02 00:01:40 UTC (rev 185089)
</span><span class="lines">@@ -1,3 +1,33 @@
</span><ins>+2015-06-01  Daniel Bates  &lt;dabates@apple.com&gt;
+
+        Notify client that we began editing when text field is focused
+        https://bugs.webkit.org/show_bug.cgi?id=145439
+        &lt;rdar://problem/21142108&gt;
+
+        Reviewed by Anders Carlsson.
+
+        Add API test to ensure that we dispatch textFieldDid{Begin, End}Editing callbacks when
+        a text field is focused and defocused.
+
+        * TestWebKitAPI/CMakeLists.txt:
+        * TestWebKitAPI/PlatformEfl.cmake:
+        * TestWebKitAPI/PlatformGTK.cmake:
+        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+        * TestWebKitAPI/Tests/WebKit2/TextFieldDidBeginAndEndEditing.cpp: Added.
+        (TestWebKitAPI::WebKit2TextFieldBeginAndEditEditingTest::didReceiveMessageFromInjectedBundle):
+        (TestWebKitAPI::WebKit2TextFieldBeginAndEditEditingTest::didFinishLoadForFrame):
+        (TestWebKitAPI::WebKit2TextFieldBeginAndEditEditingTest::setInjectedBundleClient):
+        (TestWebKitAPI::WebKit2TextFieldBeginAndEditEditingTest::setPageLoaderClient):
+        (TestWebKitAPI::WebKit2TextFieldBeginAndEditEditingTest::nullJavaScriptCallback):
+        (TestWebKitAPI::WebKit2TextFieldBeginAndEditEditingTest::executeJavaScriptAndCheckDidReceiveMessage):
+        (TestWebKitAPI::TEST_F):
+        * TestWebKitAPI/Tests/WebKit2/TextFieldDidBeginAndEndEditing_Bundle.cpp: Added.
+        (TestWebKitAPI::textFieldDidBeginEditing):
+        (TestWebKitAPI::textFieldDidEndEditing):
+        (TestWebKitAPI::TextFieldDidBeginAndEndEditingEventsTest::TextFieldDidBeginAndEndEditingEventsTest):
+        (TestWebKitAPI::TextFieldDidBeginAndEndEditingEventsTest::didCreatePage):
+        * TestWebKitAPI/Tests/WebKit2/input-focus-blur.html: Added.
+
</ins><span class="cx"> 2015-06-01  Alex Christensen  &lt;achristensen@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         [Content Extensions] resource-type and load-type should be independent.
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPICMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/CMakeLists.txt (185088 => 185089)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/CMakeLists.txt        2015-06-01 23:57:39 UTC (rev 185088)
+++ trunk/Tools/TestWebKitAPI/CMakeLists.txt        2015-06-02 00:01:40 UTC (rev 185089)
</span><span class="lines">@@ -121,6 +121,7 @@
</span><span class="cx">     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/ParentFrame_Bundle.cpp
</span><span class="cx">     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/ResponsivenessTimerDoesntFireEarly_Bundle.cpp
</span><span class="cx">     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/ShouldGoToBackForwardListItem_Bundle.cpp
</span><ins>+    ${TESTWEBKITAPI_DIR}/Tests/WebKit2/TextFieldDidBeginAndEndEditing_Bundle.cpp
</ins><span class="cx">     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/UserMessage_Bundle.cpp
</span><span class="cx">     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/WillLoad_Bundle.cpp
</span><span class="cx">     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/WillSendSubmitEvent_Bundle.cpp
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPIPlatformEflcmake"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/PlatformEfl.cmake (185088 => 185089)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/PlatformEfl.cmake        2015-06-01 23:57:39 UTC (rev 185088)
+++ trunk/Tools/TestWebKitAPI/PlatformEfl.cmake        2015-06-02 00:01:40 UTC (rev 185089)
</span><span class="lines">@@ -92,6 +92,7 @@
</span><span class="cx">     ResponsivenessTimerDoesntFireEarly
</span><span class="cx">     ShouldGoToBackForwardListItem
</span><span class="cx">     TerminateTwice
</span><ins>+    TextFieldDidBeginAndEndEditing
</ins><span class="cx">     WKPreferences
</span><span class="cx">     WKString
</span><span class="cx">     WKStringJSString
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPIPlatformGTKcmake"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/PlatformGTK.cmake (185088 => 185089)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/PlatformGTK.cmake        2015-06-01 23:57:39 UTC (rev 185088)
+++ trunk/Tools/TestWebKitAPI/PlatformGTK.cmake        2015-06-02 00:01:40 UTC (rev 185089)
</span><span class="lines">@@ -97,6 +97,7 @@
</span><span class="cx">     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/ResizeWindowAfterCrash.cpp
</span><span class="cx">     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/RestoreSessionStateContainingFormData.cpp
</span><span class="cx">     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/ShouldGoToBackForwardListItem.cpp
</span><ins>+    ${TESTWEBKITAPI_DIR}/Tests/WebKit2/TextFieldDidBeginAndEndEditing.cpp
</ins><span class="cx">     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/UserMedia.cpp
</span><span class="cx">     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/UserMessage.cpp
</span><span class="cx">     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/WillSendSubmitEvent.cpp
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (185088 => 185089)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2015-06-01 23:57:39 UTC (rev 185088)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2015-06-02 00:01:40 UTC (rev 185089)
</span><span class="lines">@@ -286,6 +286,9 @@
</span><span class="cx">                 CDBFCC451A9FF45300A7B691 /* FullscreenZoomInitialFrame.mm in Sources */ = {isa = PBXBuildFile; fileRef = CDBFCC431A9FF44800A7B691 /* FullscreenZoomInitialFrame.mm */; };
</span><span class="cx">                 CDBFCC461A9FF49E00A7B691 /* FullscreenZoomInitialFrame.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = CDBFCC421A9FF44800A7B691 /* FullscreenZoomInitialFrame.html */; };
</span><span class="cx">                 CE14F1A4181873B0001C2705 /* WillPerformClientRedirectToURLCrash.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = CE14F1A2181873B0001C2705 /* WillPerformClientRedirectToURLCrash.html */; };
</span><ins>+                CE3524F81B1431F60028A7C5 /* TextFieldDidBeginAndEndEditing_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CE3524F21B142B8D0028A7C5 /* TextFieldDidBeginAndEndEditing_Bundle.cpp */; };
+                CE3524F91B1441C40028A7C5 /* TextFieldDidBeginAndEndEditing.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CE3524F11B142B8D0028A7C5 /* TextFieldDidBeginAndEndEditing.cpp */; };
+                CE3524FA1B1443890028A7C5 /* input-focus-blur.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = CE3524F51B142BBB0028A7C5 /* input-focus-blur.html */; };
</ins><span class="cx">                 CEA6CF2819CCF69D0064F5A7 /* open-and-close-window.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = CEA6CF2719CCF69D0064F5A7 /* open-and-close-window.html */; };
</span><span class="cx">                 E1220DCA155B28AA0013E2FC /* MemoryCacheDisableWithinResourceLoadDelegate.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = E1220DC9155B287D0013E2FC /* MemoryCacheDisableWithinResourceLoadDelegate.html */; };
</span><span class="cx">                 E194E1BD177E53C7009C4D4E /* StopLoadingFromDidReceiveResponse.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = E194E1BC177E534A009C4D4E /* StopLoadingFromDidReceiveResponse.html */; };
</span><span class="lines">@@ -364,6 +367,7 @@
</span><span class="cx">                                 9B4F8FA7159D52DD002D9F94 /* HTMLCollectionNamedItem.html in Copy Resources */,
</span><span class="cx">                                 9B26FCCA159D16DE00CC3765 /* HTMLFormCollectionNamedItem.html in Copy Resources */,
</span><span class="cx">                                 BCBD3737125ABBEB00D2C29F /* icon.png in Copy Resources */,
</span><ins>+                                CE3524FA1B1443890028A7C5 /* input-focus-blur.html in Copy Resources */,
</ins><span class="cx">                                 C2CF975B16CEC71B0054E99D /* JSContextBackForwardCache1.html in Copy Resources */,
</span><span class="cx">                                 C2CF975A16CEC7140054E99D /* JSContextBackForwardCache2.html in Copy Resources */,
</span><span class="cx">                                 378E64791632707400B6C676 /* link-with-title.html in Copy Resources */,
</span><span class="lines">@@ -696,6 +700,9 @@
</span><span class="cx">                 CDC2C7141797089D00E627FB /* TimeRanges.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = TimeRanges.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 CE14F1A2181873B0001C2705 /* WillPerformClientRedirectToURLCrash.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = WillPerformClientRedirectToURLCrash.html; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 CE32C7C718184C4900CD8C28 /* WillPerformClientRedirectToURLCrash.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WillPerformClientRedirectToURLCrash.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                CE3524F11B142B8D0028A7C5 /* TextFieldDidBeginAndEndEditing.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextFieldDidBeginAndEndEditing.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                CE3524F21B142B8D0028A7C5 /* TextFieldDidBeginAndEndEditing_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextFieldDidBeginAndEndEditing_Bundle.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                CE3524F51B142BBB0028A7C5 /* input-focus-blur.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = &quot;input-focus-blur.html&quot;; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 CEA6CF2219CCF5BD0064F5A7 /* OpenAndCloseWindow.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = OpenAndCloseWindow.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 CEA6CF2719CCF69D0064F5A7 /* open-and-close-window.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = &quot;open-and-close-window.html&quot;; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E1220D9F155B25480013E2FC /* MemoryCacheDisableWithinResourceLoadDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MemoryCacheDisableWithinResourceLoadDelegate.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -1012,6 +1019,8 @@
</span><span class="cx">                                 76734997193016DC00E44DF9 /* StopLoadingDuringDidFailProvisionalLoad.cpp */,
</span><span class="cx">                                 7673499A1930182E00E44DF9 /* StopLoadingDuringDidFailProvisionalLoad_bundle.cpp */,
</span><span class="cx">                                 1AE72F47173EB214006362F0 /* TerminateTwice.cpp */,
</span><ins>+                                CE3524F11B142B8D0028A7C5 /* TextFieldDidBeginAndEndEditing.cpp */,
+                                CE3524F21B142B8D0028A7C5 /* TextFieldDidBeginAndEndEditing_Bundle.cpp */,
</ins><span class="cx">                                 4A410F4B19AF7BD6002EBAB5 /* UserMedia.cpp */,
</span><span class="cx">                                 BC22D31314DC689800FFB1DD /* UserMessage.cpp */,
</span><span class="cx">                                 BC22D31714DC68B800FFB1DD /* UserMessage_Bundle.cpp */,
</span><span class="lines">@@ -1105,6 +1114,7 @@
</span><span class="cx">                                 26F52EB118288F0F0023D412 /* geolocationWatchPositionWithHighAccuracy.html */,
</span><span class="cx">                                 4A410F4D19AF7BEF002EBAB5 /* getUserMedia.html */,
</span><span class="cx">                                 BCBD372E125ABBE600D2C29F /* icon.png */,
</span><ins>+                                CE3524F51B142BBB0028A7C5 /* input-focus-blur.html */,
</ins><span class="cx">                                 378E647816326FDF00B6C676 /* link-with-title.html */,
</span><span class="cx">                                 9361002814DC957B0061379D /* lots-of-iframes.html */,
</span><span class="cx">                                 93AF4ECF1506F123007FD57E /* lots-of-images.html */,
</span><span class="lines">@@ -1398,6 +1408,7 @@
</span><span class="cx">                                 7CCE7F301A411B8E00447C4C /* AtomicString.cpp in Sources */,
</span><span class="cx">                                 7CCE7EB41A411A7E00447C4C /* AttributedString.mm in Sources */,
</span><span class="cx">                                 7CCE7EB51A411A7E00447C4C /* BackForwardList.mm in Sources */,
</span><ins>+                                E40019331ACE9B88001B0A2A /* BloomFilter.cpp in Sources */,
</ins><span class="cx">                                 7CCE7EDC1A411A9200447C4C /* CalculationValue.cpp in Sources */,
</span><span class="cx">                                 7CCE7EB61A411A7E00447C4C /* CancelLoadFromResourceLoadDelegate.mm in Sources */,
</span><span class="cx">                                 7CCE7EE71A411AE600447C4C /* CanHandleRequest.cpp in Sources */,
</span><span class="lines">@@ -1467,6 +1478,7 @@
</span><span class="cx">                                 7CCE7F061A411AE600447C4C /* LayoutMilestonesWithAllContentInFrame.cpp in Sources */,
</span><span class="cx">                                 7CCE7EDF1A411A9200447C4C /* LayoutUnit.cpp in Sources */,
</span><span class="cx">                                 7CCE7F381A411B8E00447C4C /* ListHashSet.cpp in Sources */,
</span><ins>+                                37D36ED71AF42ECD00BAF5D9 /* LoadAlternateHTMLString.mm in Sources */,
</ins><span class="cx">                                 7CCE7EFE1A411AE600447C4C /* LoadAlternateHTMLStringWithNonDirectoryURL.cpp in Sources */,
</span><span class="cx">                                 7CCE7EFF1A411AE600447C4C /* LoadCanceledNoServerRedirectCallback.cpp in Sources */,
</span><span class="cx">                                 7CCE7F001A411AE600447C4C /* LoadPageOnCrash.cpp in Sources */,
</span><span class="lines">@@ -1541,12 +1553,11 @@
</span><span class="cx">                                 7CCE7F161A411AE600447C4C /* TerminateTwice.cpp in Sources */,
</span><span class="cx">                                 7CCE7EA91A411A1D00447C4C /* TestBrowsingContextLoadDelegate.mm in Sources */,
</span><span class="cx">                                 7CCE7EAA1A411A2400447C4C /* TestProtocol.mm in Sources */,
</span><del>-                                E40019331ACE9B88001B0A2A /* BloomFilter.cpp in Sources */,
</del><span class="cx">                                 7CCE7EAE1A411A3400447C4C /* TestsController.cpp in Sources */,
</span><ins>+                                CE3524F91B1441C40028A7C5 /* TextFieldDidBeginAndEndEditing.cpp in Sources */,
</ins><span class="cx">                                 7CCE7EDD1A411A9200447C4C /* TimeRanges.cpp in Sources */,
</span><span class="cx">                                 7CCE7ED31A411A7E00447C4C /* TypingStyleCrash.mm in Sources */,
</span><span class="cx">                                 7CCE7EDE1A411A9200447C4C /* URL.cpp in Sources */,
</span><del>-                                37D36ED71AF42ECD00BAF5D9 /* LoadAlternateHTMLString.mm in Sources */,
</del><span class="cx">                                 7CCE7EB01A411A4400447C4C /* URLExtras.mm in Sources */,
</span><span class="cx">                                 7CCE7F271A411AF600447C4C /* UserContentController.mm in Sources */,
</span><span class="cx">                                 7CCE7F2D1A411B1000447C4C /* UserContentTest.mm in Sources */,
</span><span class="lines">@@ -1630,6 +1641,7 @@
</span><span class="cx">                                 C0BD669F131D3CFF00E18F2A /* ResponsivenessTimerDoesntFireEarly_Bundle.cpp in Sources */,
</span><span class="cx">                                 51FCF7A11534B2A000104491 /* ShouldGoToBackForwardListItem_Bundle.cpp in Sources */,
</span><span class="cx">                                 7673499D1930C5BB00E44DF9 /* StopLoadingDuringDidFailProvisionalLoad_bundle.cpp in Sources */,
</span><ins>+                                CE3524F81B1431F60028A7C5 /* TextFieldDidBeginAndEndEditing_Bundle.cpp in Sources */,
</ins><span class="cx">                                 BC22D31914DC68B900FFB1DD /* UserMessage_Bundle.cpp in Sources */,
</span><span class="cx">                                 520BCF4C141EB09E00937EA8 /* WebArchive_Bundle.cpp in Sources */,
</span><span class="cx">                                 7CFBCAE51743238F00B2BFCF /* WillLoad_Bundle.cpp in Sources */,
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2TextFieldDidBeginAndEndEditingcpp"></a>
<div class="addfile"><h4>Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2/TextFieldDidBeginAndEndEditing.cpp (0 => 185089)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2/TextFieldDidBeginAndEndEditing.cpp                                (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2/TextFieldDidBeginAndEndEditing.cpp        2015-06-02 00:01:40 UTC (rev 185089)
</span><span class="lines">@@ -0,0 +1,125 @@
</span><ins>+/*
+ * Copyright (C) 2015 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;
+
+#if WK_HAVE_C_SPI
+
+#include &quot;PlatformUtilities.h&quot;
+#include &quot;PlatformWebView.h&quot;
+#include &quot;Test.h&quot;
+#include &lt;wtf/StdLibExtras.h&gt;
+
+namespace TestWebKitAPI {
+
+struct WebKit2TextFieldBeginAndEditEditingTest : public ::testing::Test {
+    std::unique_ptr&lt;PlatformWebView&gt; webView;
+
+    WKRetainPtr&lt;WKStringRef&gt; messageName;
+
+    bool didFinishLoad { false };
+    bool didReceiveMessage { false };
+
+    static void didReceiveMessageFromInjectedBundle(WKContextRef, WKStringRef messageName, WKTypeRef, const void* clientInfo)
+    {
+        WebKit2TextFieldBeginAndEditEditingTest&amp; client = *static_cast&lt;WebKit2TextFieldBeginAndEditEditingTest*&gt;(const_cast&lt;void*&gt;(clientInfo));
+        client.messageName = messageName;
+        client.didReceiveMessage = true;
+    }
+
+    static void didFinishLoadForFrame(WKPageRef, WKFrameRef, WKTypeRef, const void* clientInfo)
+    {
+        WebKit2TextFieldBeginAndEditEditingTest&amp; client = *static_cast&lt;WebKit2TextFieldBeginAndEditEditingTest*&gt;(const_cast&lt;void*&gt;(clientInfo));
+        client.didFinishLoad = true;
+    }
+
+    static void setInjectedBundleClient(WKContextRef context, const void* clientInfo)
+    {
+        WKContextInjectedBundleClientV1 injectedBundleClient;
+        memset(&amp;injectedBundleClient, 0, sizeof(injectedBundleClient));
+
+        injectedBundleClient.base.version = 1;
+        injectedBundleClient.base.clientInfo = clientInfo;
+        injectedBundleClient.didReceiveMessageFromInjectedBundle = didReceiveMessageFromInjectedBundle;
+
+        WKContextSetInjectedBundleClient(context, &amp;injectedBundleClient.base);
+    }
+
+    static void setPageLoaderClient(WKPageRef page, const void* clientInfo)
+    {
+        WKPageLoaderClientV6 loaderClient;
+        memset(&amp;loaderClient, 0, sizeof(loaderClient));
+
+        loaderClient.base.version = 6;
+        loaderClient.base.clientInfo = clientInfo;
+        loaderClient.didFinishLoadForFrame = didFinishLoadForFrame;
+
+        WKPageSetPageLoaderClient(page, &amp;loaderClient.base);
+    }
+
+    static void nullJavaScriptCallback(WKSerializedScriptValueRef, WKErrorRef, void*)
+    {
+    }
+
+    void executeJavaScriptAndCheckDidReceiveMessage(const char* javaScriptCode, const char* expectedMessageName)
+    {
+        didReceiveMessage = false;
+        WKPageRunJavaScriptInMainFrame(webView-&gt;page(), Util::toWK(javaScriptCode).get(), 0, nullJavaScriptCallback);
+        Util::run(&amp;didReceiveMessage);
+        EXPECT_WK_STREQ(expectedMessageName, messageName);
+    }
+
+    // From ::testing::Test
+    void SetUp() override
+    {
+        WKRetainPtr&lt;WKContextRef&gt; context = adoptWK(Util::createContextForInjectedBundleTest(&quot;TextFieldDidBeginAndEndEditingEventsTest&quot;));
+        setInjectedBundleClient(context.get(), this);
+
+        webView = std::make_unique&lt;PlatformWebView&gt;(context.get());
+        setPageLoaderClient(webView-&gt;page(), this);
+
+        didFinishLoad = false;
+        didReceiveMessage = false;
+
+        WKPageLoadURL(webView-&gt;page(), adoptWK(Util::createURLForResource(&quot;input-focus-blur&quot;, &quot;html&quot;)).get());
+        Util::run(&amp;didFinishLoad);
+    }
+};
+
+TEST_F(WebKit2TextFieldBeginAndEditEditingTest, TextFieldDidBeginAndEndEditingEvents)
+{
+    executeJavaScriptAndCheckDidReceiveMessage(&quot;focusTextField('input')&quot;, &quot;DidReceiveTextFieldDidBeginEditing&quot;);
+    executeJavaScriptAndCheckDidReceiveMessage(&quot;blurTextField('input')&quot;, &quot;DidReceiveTextFieldDidEndEditing&quot;);
+}
+
+TEST_F(WebKit2TextFieldBeginAndEditEditingTest, TextFieldDidBeginAndEndEditingEventsInReadOnlyField)
+{
+    executeJavaScriptAndCheckDidReceiveMessage(&quot;focusTextField('readonly')&quot;, &quot;DidReceiveTextFieldDidBeginEditing&quot;);
+    executeJavaScriptAndCheckDidReceiveMessage(&quot;blurTextField('readonly')&quot;, &quot;DidReceiveTextFieldDidEndEditing&quot;);
+}
+
+} // namespace TestWebKitAPI
+
+#endif
</ins></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2TextFieldDidBeginAndEndEditing_Bundlecpp"></a>
<div class="addfile"><h4>Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2/TextFieldDidBeginAndEndEditing_Bundle.cpp (0 => 185089)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2/TextFieldDidBeginAndEndEditing_Bundle.cpp                                (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2/TextFieldDidBeginAndEndEditing_Bundle.cpp        2015-06-02 00:01:40 UTC (rev 185089)
</span><span class="lines">@@ -0,0 +1,76 @@
</span><ins>+/*
+ * Copyright (C) 2015 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;
+
+#if WK_HAVE_C_SPI
+
+#include &quot;InjectedBundleTest.h&quot;
+
+#include &quot;PlatformUtilities.h&quot;
+#include &lt;WebKit/WKBundlePage.h&gt;
+
+namespace TestWebKitAPI {
+
+class TextFieldDidBeginAndEndEditingEventsTest : public InjectedBundleTest {
+public:
+    TextFieldDidBeginAndEndEditingEventsTest(const std::string&amp; identifier);
+
+    virtual void didCreatePage(WKBundleRef, WKBundlePageRef);
+};
+
+static InjectedBundleTest::Register&lt;TextFieldDidBeginAndEndEditingEventsTest&gt; registrar(&quot;TextFieldDidBeginAndEndEditingEventsTest&quot;);
+
+static void textFieldDidBeginEditing(WKBundlePageRef, WKBundleNodeHandleRef inputElement, WKBundleFrameRef, const void*)
+{
+    WKBundlePostMessage(InjectedBundleController::singleton().bundle(), Util::toWK(&quot;DidReceiveTextFieldDidBeginEditing&quot;).get(), nullptr);
+}
+
+static void textFieldDidEndEditing(WKBundlePageRef, WKBundleNodeHandleRef inputElement, WKBundleFrameRef, const void*)
+{
+    WKBundlePostMessage(InjectedBundleController::singleton().bundle(), Util::toWK(&quot;DidReceiveTextFieldDidEndEditing&quot;).get(), nullptr);
+}
+
+TextFieldDidBeginAndEndEditingEventsTest::TextFieldDidBeginAndEndEditingEventsTest(const std::string&amp; identifier)
+    : InjectedBundleTest(identifier)
+{
+}
+
+void TextFieldDidBeginAndEndEditingEventsTest::didCreatePage(WKBundleRef bundle, WKBundlePageRef page)
+{
+    WKBundlePageFormClientV2 formClient;
+    memset(&amp;formClient, 0, sizeof(formClient));
+
+    formClient.base.version = 2;
+    formClient.base.clientInfo = this;
+    formClient.textFieldDidBeginEditing = textFieldDidBeginEditing;
+    formClient.textFieldDidEndEditing = textFieldDidEndEditing;
+
+    WKBundlePageSetFormClient(page, &amp;formClient.base);
+}
+
+} // namespace TestWebKitAPI
+
+#endif
</ins></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2inputfocusblurhtml"></a>
<div class="addfile"><h4>Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2/input-focus-blur.html (0 => 185089)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2/input-focus-blur.html                                (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2/input-focus-blur.html        2015-06-02 00:01:40 UTC (rev 185089)
</span><span class="lines">@@ -0,0 +1,18 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;body&gt;
+&lt;input id=&quot;input&quot; type=&quot;text&quot;&gt;
+&lt;input id=&quot;readonly&quot; type=&quot;text&quot; readonly&gt;
+&lt;script&gt;
+function focusTextField(id)
+{
+    document.getElementById(id).focus();
+}
+
+function blurTextField(id)
+{
+    document.getElementById(id).blur();
+}
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre>
</div>
</div>

</body>
</html>