<!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>[206135] 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/206135">206135</a></dd>
<dt>Author</dt> <dd>wenson_hsieh@apple.com</dd>
<dt>Date</dt> <dd>2016-09-19 18:02:40 -0700 (Mon, 19 Sep 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Add a unit test covering &lt;https://trac.webkit.org/changeset/205983&gt;
https://bugs.webkit.org/show_bug.cgi?id=162112

Reviewed by Beth Dakin.

Source/WebKit2:

Adds some a test support method as SPI on WKWebView to determine whether to request candidates. See
Tools/ChangeLog for more details.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _shouldRequestCandidates]):
(-[WKWebView _forceRequestCandidates]): Deleted.
* UIProcess/API/Cocoa/WKWebViewPrivate.h:

Tools:

Adds a new unit test covering the changes in <a href="http://trac.webkit.org/projects/webkit/changeset/205983">r205983</a> along with the infrastructure needed to support it. Also
further refactors the TestWKWebView used by VideoControlsManager and WKWebViewCandidateTests so that in both
cases, we add the WKWebView to a visible key window, and when sending a mouse down event, we propagate the event
at the window level rather than the view level, allowing greater flexibility to simulate behaviors such as
pressure-sensitive events that are needed for the new test.

Also rewrites currently disabled unit tests in CandidateTests as WebKit2 unit tests in WKWebViewCandidateTests,
checking whether or not to should be requesting candidates in password and non-password fields.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit2Cocoa/VideoControlsManager.mm:
(TestWebKitAPI::setUpWebViewForTestingVideoControlsManager):
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WebKit2Cocoa/WKWebViewCandidateTests.mm:
(-[CandidateTestWebView typeString:inputMessage:]):
(+[CandidateTestWebView setUpWithFrame:testPage:]):
* TestWebKitAPI/Tests/WebKit2Cocoa/large-input-field-focus-onload.html: Added.
* TestWebKitAPI/Tests/WebKit2Cocoa/text-and-password-inputs.html: Added.
* TestWebKitAPI/mac/TestWKWebViewMac.h:
* TestWebKitAPI/mac/TestWKWebViewMac.mm:
(__simulated_forceClickAssociatedEventsMask):
(-[TestWKWebViewHostWindow _mouseDownAtPoint:simulatePressure:]):
(-[TestWKWebView initWithFrame:]):
(-[TestWKWebView initWithFrame:configuration:]):
(-[TestWKWebView _setUpTestWindow:]):
(-[TestWKWebView mouseDownAtPoint:simulatePressure:]):
(-[TestWKWebView typeCharacter:]):
(-[TestWKWebView mouseDownAtPoint:]): Deleted.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKWebViewmm">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKWebViewPrivateh">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.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>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2CocoaVideoControlsManagermm">trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/VideoControlsManager.mm</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2CocoaWKWebViewCandidateTestsmm">trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WKWebViewCandidateTests.mm</a></li>
<li><a href="#trunkToolsTestWebKitAPImacTestWKWebViewMach">trunk/Tools/TestWebKitAPI/mac/TestWKWebViewMac.h</a></li>
<li><a href="#trunkToolsTestWebKitAPImacTestWKWebViewMacmm">trunk/Tools/TestWebKitAPI/mac/TestWKWebViewMac.mm</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2Cocoalargeinputfieldfocusonloadhtml">trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-input-field-focus-onload.html</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2Cocoatextandpasswordinputshtml">trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/text-and-password-inputs.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (206134 => 206135)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2016-09-20 00:48:39 UTC (rev 206134)
+++ trunk/Source/WebKit2/ChangeLog        2016-09-20 01:02:40 UTC (rev 206135)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2016-09-19  Wenson Hsieh  &lt;wenson_hsieh@apple.com&gt;
+
+        Add a unit test covering &lt;https://trac.webkit.org/changeset/205983&gt;
+        https://bugs.webkit.org/show_bug.cgi?id=162112
+
+        Reviewed by Beth Dakin.
+
+        Adds some a test support method as SPI on WKWebView to determine whether to request candidates. See
+        Tools/ChangeLog for more details.
+
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView _shouldRequestCandidates]):
+        (-[WKWebView _forceRequestCandidates]): Deleted.
+        * UIProcess/API/Cocoa/WKWebViewPrivate.h:
+
</ins><span class="cx"> 2016-09-19  Anders Carlsson  &lt;andersca@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Suppress JavaScript prompts early on in certain cases
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKWebViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (206134 => 206135)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm        2016-09-20 00:48:39 UTC (rev 206134)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm        2016-09-20 01:02:40 UTC (rev 206135)
</span><span class="lines">@@ -4586,6 +4586,11 @@
</span><span class="cx"> {
</span><span class="cx">     _impl-&gt;forceRequestCandidatesForTesting();
</span><span class="cx"> }
</span><ins>+
+- (BOOL)_shouldRequestCandidates
+{
+    return _impl-&gt;shouldRequestCandidates();
+}
</ins><span class="cx"> #endif // PLATFORM(MAC)
</span><span class="cx"> 
</span><span class="cx"> // Execute the supplied block after the next transaction from the WebProcess.
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKWebViewPrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h (206134 => 206135)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h        2016-09-20 00:48:39 UTC (rev 206134)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h        2016-09-20 01:02:40 UTC (rev 206135)
</span><span class="lines">@@ -277,6 +277,7 @@
</span><span class="cx"> - (void)_didHandleAcceptedCandidate WK_API_AVAILABLE(macosx(WK_MAC_TBA));
</span><span class="cx"> - (void)_forceRequestCandidates WK_API_AVAILABLE(macosx(WK_MAC_TBA));
</span><span class="cx"> - (void)_didUpdateCandidateListVisibility:(BOOL)visible WK_API_AVAILABLE(macosx(WK_MAC_TBA));
</span><ins>+@property (nonatomic, readonly) BOOL _shouldRequestCandidates WK_API_AVAILABLE(macosx(WK_MAC_TBA));
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> - (void)_doAfterNextPresentationUpdate:(void (^)(void))updateBlock WK_API_AVAILABLE(macosx(10.12), ios(10.0));
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (206134 => 206135)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2016-09-20 00:48:39 UTC (rev 206134)
+++ trunk/Tools/ChangeLog        2016-09-20 01:02:40 UTC (rev 206135)
</span><span class="lines">@@ -1,3 +1,39 @@
</span><ins>+2016-09-19  Wenson Hsieh  &lt;wenson_hsieh@apple.com&gt;
+
+        Add a unit test covering &lt;https://trac.webkit.org/changeset/205983&gt;
+        https://bugs.webkit.org/show_bug.cgi?id=162112
+
+        Reviewed by Beth Dakin.
+
+        Adds a new unit test covering the changes in r205983 along with the infrastructure needed to support it. Also
+        further refactors the TestWKWebView used by VideoControlsManager and WKWebViewCandidateTests so that in both
+        cases, we add the WKWebView to a visible key window, and when sending a mouse down event, we propagate the event
+        at the window level rather than the view level, allowing greater flexibility to simulate behaviors such as
+        pressure-sensitive events that are needed for the new test.
+
+        Also rewrites currently disabled unit tests in CandidateTests as WebKit2 unit tests in WKWebViewCandidateTests,
+        checking whether or not to should be requesting candidates in password and non-password fields.
+
+        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+        * TestWebKitAPI/Tests/WebKit2Cocoa/VideoControlsManager.mm:
+        (TestWebKitAPI::setUpWebViewForTestingVideoControlsManager):
+        (TestWebKitAPI::TEST):
+        * TestWebKitAPI/Tests/WebKit2Cocoa/WKWebViewCandidateTests.mm:
+        (-[CandidateTestWebView typeString:inputMessage:]):
+        (+[CandidateTestWebView setUpWithFrame:testPage:]):
+        * TestWebKitAPI/Tests/WebKit2Cocoa/large-input-field-focus-onload.html: Added.
+        * TestWebKitAPI/Tests/WebKit2Cocoa/text-and-password-inputs.html: Added.
+        * TestWebKitAPI/mac/TestWKWebViewMac.h:
+        * TestWebKitAPI/mac/TestWKWebViewMac.mm:
+        (__simulated_forceClickAssociatedEventsMask):
+        (-[TestWKWebViewHostWindow _mouseDownAtPoint:simulatePressure:]):
+        (-[TestWKWebView initWithFrame:]):
+        (-[TestWKWebView initWithFrame:configuration:]):
+        (-[TestWKWebView _setUpTestWindow:]):
+        (-[TestWKWebView mouseDownAtPoint:simulatePressure:]):
+        (-[TestWKWebView typeCharacter:]):
+        (-[TestWKWebView mouseDownAtPoint:]): Deleted.
+
</ins><span class="cx"> 2016-09-19  Alex Christensen  &lt;achristensen@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         URLParser can read memory out of bounds
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (206134 => 206135)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2016-09-20 00:48:39 UTC (rev 206134)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2016-09-20 01:02:40 UTC (rev 206135)
</span><span class="lines">@@ -75,6 +75,7 @@
</span><span class="cx">                 2E691AF31D79E75E00129407 /* large-video-playing-scroll-away.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 2E691AF21D79E75400129407 /* large-video-playing-scroll-away.html */; };
</span><span class="cx">                 2E7765CD16C4D80A00BA2BB1 /* mainIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2E7765CC16C4D80A00BA2BB1 /* mainIOS.mm */; };
</span><span class="cx">                 2E7765CF16C4D81100BA2BB1 /* mainMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2E7765CE16C4D81100BA2BB1 /* mainMac.mm */; };
</span><ins>+                2E9896151D8F093800739892 /* text-and-password-inputs.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 2E9896141D8F092B00739892 /* text-and-password-inputs.html */; };
</ins><span class="cx">                 2EFF06C31D88621E0004BB30 /* large-video-offscreen.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 2EFF06C21D8862120004BB30 /* large-video-offscreen.html */; };
</span><span class="cx">                 2EFF06C51D8867760004BB30 /* change-video-source-on-click.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 2EFF06C41D8867700004BB30 /* change-video-source-on-click.html */; };
</span><span class="cx">                 2EFF06C71D886A580004BB30 /* change-video-source-on-end.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 2EFF06C61D886A560004BB30 /* change-video-source-on-end.html */; };
</span><span class="lines">@@ -473,6 +474,7 @@
</span><span class="cx">                 CEBABD491B71687C0051210A /* should-open-external-schemes.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = CEBABD481B71687C0051210A /* should-open-external-schemes.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><ins>+                F42DA5161D8CEFE400336F40 /* large-input-field-focus-onload.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F42DA5151D8CEFDB00336F40 /* large-input-field-focus-onload.html */; };
</ins><span class="cx">                 F4F405BC1D4C0D1C007A9707 /* full-size-autoplaying-video-with-audio.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F4F405BA1D4C0CF8007A9707 /* full-size-autoplaying-video-with-audio.html */; };
</span><span class="cx">                 F4F405BD1D4C0D1C007A9707 /* skinny-autoplaying-video-with-audio.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F4F405BB1D4C0CF8007A9707 /* skinny-autoplaying-video-with-audio.html */; };
</span><span class="cx">                 F660AA1115A5F631003A1243 /* GetInjectedBundleInitializationUserDataCallback_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F660AA0F15A5F624003A1243 /* GetInjectedBundleInitializationUserDataCallback_Bundle.cpp */; };
</span><span class="lines">@@ -544,6 +546,8 @@
</span><span class="cx">                         dstPath = TestWebKitAPI.resources;
</span><span class="cx">                         dstSubfolderSpec = 7;
</span><span class="cx">                         files = (
</span><ins>+                                2E9896151D8F093800739892 /* text-and-password-inputs.html in Copy Resources */,
+                                F42DA5161D8CEFE400336F40 /* large-input-field-focus-onload.html in Copy Resources */,
</ins><span class="cx">                                 2EFF06CD1D8A429A0004BB30 /* input-field-in-scrollable-document.html in Copy Resources */,
</span><span class="cx">                                 2EFF06C71D886A580004BB30 /* change-video-source-on-end.html in Copy Resources */,
</span><span class="cx">                                 2EFF06C51D8867760004BB30 /* change-video-source-on-click.html in Copy Resources */,
</span><span class="lines">@@ -790,6 +794,7 @@
</span><span class="cx">                 2E691AF21D79E75400129407 /* large-video-playing-scroll-away.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = &quot;large-video-playing-scroll-away.html&quot;; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 2E7765CC16C4D80A00BA2BB1 /* mainIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = mainIOS.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 2E7765CE16C4D81100BA2BB1 /* mainMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = mainMac.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                2E9896141D8F092B00739892 /* text-and-password-inputs.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = &quot;text-and-password-inputs.html&quot;; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 2EFF06C21D8862120004BB30 /* large-video-offscreen.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = &quot;large-video-offscreen.html&quot;; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 2EFF06C41D8867700004BB30 /* change-video-source-on-click.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = &quot;change-video-source-on-click.html&quot;; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 2EFF06C61D886A560004BB30 /* change-video-source-on-end.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = &quot;change-video-source-on-end.html&quot;; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -1178,6 +1183,7 @@
</span><span class="cx">                 E4A757D3178AEA5B00B5D7A4 /* Deque.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = Deque.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E4C9ABC71B3DB1710040A987 /* RunLoop.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RunLoop.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 F3FC3EE213678B7300126A65 /* libgtest.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libgtest.a; sourceTree = BUILT_PRODUCTS_DIR; };
</span><ins>+                F42DA5151D8CEFDB00336F40 /* large-input-field-focus-onload.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = &quot;large-input-field-focus-onload.html&quot;; path = &quot;Tests/WebKit2Cocoa/large-input-field-focus-onload.html&quot;; sourceTree = SOURCE_ROOT; };
</ins><span class="cx">                 F4F405BA1D4C0CF8007A9707 /* full-size-autoplaying-video-with-audio.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = &quot;full-size-autoplaying-video-with-audio.html&quot;; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 F4F405BB1D4C0CF8007A9707 /* skinny-autoplaying-video-with-audio.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = &quot;skinny-autoplaying-video-with-audio.html&quot;; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 F660AA0C15A5F061003A1243 /* GetInjectedBundleInitializationUserDataCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GetInjectedBundleInitializationUserDataCallback.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -1473,6 +1479,7 @@
</span><span class="cx">                 A16F66B81C40E9E100BD4D24 /* Resources */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><ins>+                                2E9896141D8F092B00739892 /* text-and-password-inputs.html */,
</ins><span class="cx">                                 2EFF06CC1D8A42910004BB30 /* input-field-in-scrollable-document.html */,
</span><span class="cx">                                 2EFF06C61D886A560004BB30 /* change-video-source-on-end.html */,
</span><span class="cx">                                 2EFF06C41D8867700004BB30 /* change-video-source-on-click.html */,
</span><span class="lines">@@ -1917,6 +1924,7 @@
</span><span class="cx">                 C07E6CB013FD737C0038B22B /* Resources */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><ins>+                                F42DA5151D8CEFDB00336F40 /* large-input-field-focus-onload.html */,
</ins><span class="cx">                                 379028B814FABE49007E6B43 /* acceptsFirstMouse.html */,
</span><span class="cx">                                 B55F11B9151916E600915916 /* Ahem.ttf */,
</span><span class="cx">                                 B55F11B01517A2C400915916 /* attributedStringCustomFont.html */,
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2CocoaVideoControlsManagermm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/VideoControlsManager.mm (206134 => 206135)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/VideoControlsManager.mm        2016-09-20 00:48:39 UTC (rev 206134)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/VideoControlsManager.mm        2016-09-20 01:02:40 UTC (rev 206135)
</span><span class="lines">@@ -121,11 +121,7 @@
</span><span class="cx"> {
</span><span class="cx">     RetainPtr&lt;WKWebViewConfiguration&gt; configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
</span><span class="cx">     configuration.get().mediaTypesRequiringUserActionForPlayback = WKAudiovisualMediaTypeNone;
</span><del>-    RetainPtr&lt;VideoControlsManagerTestWebView&gt; webView = adoptNS([[VideoControlsManagerTestWebView alloc] initWithFrame:frame configuration:configuration.get()]);
-    RetainPtr&lt;NSWindow&gt; window = adoptNS([[NSWindow alloc] initWithContentRect:[webView frame] styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO]);
-    [[window contentView] addSubview:webView.get()];
-
-    return webView;
</del><ins>+    return adoptNS([[VideoControlsManagerTestWebView alloc] initWithFrame:frame configuration:configuration.get()]);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> TEST(VideoControlsManager, VideoControlsManagerSingleLargeVideo)
</span><span class="lines">@@ -210,7 +206,7 @@
</span><span class="cx">     [webView loadTestPageNamed:@&quot;large-videos-autoplaying-click-to-pause&quot;];
</span><span class="cx">     [webView waitForPageToLoadWithAutoplayingVideos:2];
</span><span class="cx"> 
</span><del>-    [webView mouseDownAtPoint:clickPoint];
</del><ins>+    [webView mouseDownAtPoint:clickPoint simulatePressure:YES];
</ins><span class="cx"> 
</span><span class="cx">     __block bool firstVideoPaused = false;
</span><span class="cx">     __block bool secondVideoPaused = false;
</span><span class="lines">@@ -221,7 +217,7 @@
</span><span class="cx">             secondVideoPaused = true;
</span><span class="cx">         } else {
</span><span class="cx">             EXPECT_TRUE([controlledElementID isEqualToString:@&quot;first&quot;]);
</span><del>-            [webView mouseDownAtPoint:clickPoint];
</del><ins>+            [webView mouseDownAtPoint:clickPoint simulatePressure:YES];
</ins><span class="cx">         }
</span><span class="cx">         firstVideoPaused = true;
</span><span class="cx">     }];
</span><span class="lines">@@ -259,7 +255,7 @@
</span><span class="cx">     [webView loadTestPageNamed:@&quot;autoplaying-video-with-audio&quot;];
</span><span class="cx">     [webView waitForPageToLoadWithAutoplayingVideos:1];
</span><span class="cx"> 
</span><del>-    [webView mouseDownAtPoint:NSMakePoint(50, 50)];
</del><ins>+    [webView mouseDownAtPoint:NSMakePoint(50, 50) simulatePressure:YES];
</ins><span class="cx">     [webView expectControlsManager:YES afterReceivingMessage:@&quot;paused&quot;];
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -291,7 +287,7 @@
</span><span class="cx"> 
</span><span class="cx">     [webView loadTestPageNamed:@&quot;large-video-hides-controls-after-seek-to-end&quot;];
</span><span class="cx">     [webView waitForPageToLoadWithAutoplayingVideos:1];
</span><del>-    [webView mouseDownAtPoint:NSMakePoint(50, 50)];
</del><ins>+    [webView mouseDownAtPoint:NSMakePoint(50, 50) simulatePressure:YES];
</ins><span class="cx"> 
</span><span class="cx">     // We expect there to be media controls, since this is a user gestured seek to the end.
</span><span class="cx">     // This is akin to seeking to the end by scrubbing in the controls.
</span><span class="lines">@@ -342,7 +338,7 @@
</span><span class="cx">     RetainPtr&lt;VideoControlsManagerTestWebView*&gt; webView = setUpWebViewForTestingVideoControlsManager(NSMakeRect(0, 0, 1024, 768));
</span><span class="cx"> 
</span><span class="cx">     [webView loadTestPageNamed:@&quot;large-video-offscreen&quot;];
</span><del>-    [webView expectControlsManager:NO afterReceivingMessage:@&quot;moved&quot;];
</del><ins>+    [webView waitForMediaControlsToHide];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> TEST(VideoControlsManager, VideoControlsManagerKeepsControlsStableDuringSrcChangeOnClick)
</span><span class="lines">@@ -351,7 +347,7 @@
</span><span class="cx"> 
</span><span class="cx">     [webView loadTestPageNamed:@&quot;change-video-source-on-click&quot;];
</span><span class="cx">     [webView waitForPageToLoadWithAutoplayingVideos:1];
</span><del>-    [webView mouseDownAtPoint:NSMakePoint(400, 300)];
</del><ins>+    [webView mouseDownAtPoint:NSMakePoint(400, 300) simulatePressure:YES];
</ins><span class="cx"> 
</span><span class="cx">     [webView expectControlsManager:YES afterReceivingMessage:@&quot;changed&quot;];
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2CocoaWKWebViewCandidateTestsmm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WKWebViewCandidateTests.mm (206134 => 206135)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WKWebViewCandidateTests.mm        2016-09-20 00:48:39 UTC (rev 206134)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WKWebViewCandidateTests.mm        2016-09-20 01:02:40 UTC (rev 206135)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx"> #import &quot;PlatformUtilities.h&quot;
</span><span class="cx"> #import &quot;TestWKWebViewMac.h&quot;
</span><span class="cx"> 
</span><ins>+#import &lt;Carbon/Carbon.h&gt;
</ins><span class="cx"> #import &lt;WebKit/WebKitPrivate.h&gt;
</span><span class="cx"> 
</span><span class="cx"> static NSString *GetInputValueJSExpression = @&quot;document.querySelector('input').value&quot;;
</span><span class="lines">@@ -112,27 +113,41 @@
</span><span class="cx">         _candidateListVisibilityChangeCount++;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+- (void)typeString:(NSString *)string inputMessage:(NSString *)inputMessage
+{
+    for (uint64_t i = 0; i &lt; string.length; ++i) {
+        dispatch_async(dispatch_get_main_queue(), ^()
+        {
+            [self typeCharacter:[string characterAtIndex:i]];
+        });
+        [self waitForMessage:inputMessage];
+    }
+}
+
++ (instancetype)setUpWithFrame:(NSRect)frame testPage:(NSString *)testPageName
+{
+    CandidateTestWebView *wkWebView = [[CandidateTestWebView alloc] initWithFrame:frame];
+
+    [wkWebView loadTestPageNamed:testPageName];
+    [wkWebView waitForMessage:@&quot;focused&quot;];
+    [wkWebView _forceRequestCandidates];
+
+    return wkWebView;
+}
+
</ins><span class="cx"> @end
</span><span class="cx"> 
</span><span class="cx"> TEST(WKWebViewCandidateTests, SoftSpaceReplacementAfterCandidateInsertionWithoutReplacement)
</span><span class="cx"> {
</span><del>-    CandidateTestWebView *wkWebView = [[CandidateTestWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)];
</del><ins>+    CandidateTestWebView *wkWebView = [CandidateTestWebView setUpWithFrame:NSMakeRect(0, 0, 800, 600) testPage:@&quot;input-field-in-scrollable-document&quot;];
</ins><span class="cx"> 
</span><del>-    NSURL *contentURL = [[NSBundle mainBundle] URLForResource:@&quot;input-field-in-scrollable-document&quot; withExtension:@&quot;html&quot; subdirectory:@&quot;TestWebKitAPI.resources&quot;];
-    [wkWebView loadRequest:[NSURLRequest requestWithURL:contentURL]];
-
-    [wkWebView waitForMessage:@&quot;focused&quot;];
-    [wkWebView _forceRequestCandidates];
</del><span class="cx">     [wkWebView insertCandidatesAndWaitForResponse:@&quot;apple &quot; range:NSMakeRange(0, 0)];
</span><del>-
</del><span class="cx">     EXPECT_TRUE([[wkWebView stringByEvaluatingJavaScript:GetInputValueJSExpression] isEqualToString:@&quot;apple &quot;]);
</span><span class="cx"> 
</span><span class="cx">     [wkWebView expectCandidateListVisibilityUpdates:0 whenPerformingActions:^()
</span><span class="cx">     {
</span><del>-        [wkWebView typeCharacter:' '];
-        [wkWebView waitForMessage:@&quot;input&quot;];
</del><ins>+        [wkWebView typeString:@&quot; &quot; inputMessage:@&quot;input&quot;];
</ins><span class="cx">     }];
</span><del>-
</del><span class="cx">     EXPECT_TRUE([[wkWebView stringByEvaluatingJavaScript:GetInputValueJSExpression] isEqualToString:@&quot;apple &quot;]);
</span><span class="cx">     EXPECT_EQ([[wkWebView stringByEvaluatingJavaScript:GetDocumentScrollTopJSExpression] doubleValue], 0);
</span><span class="cx"> }
</span><span class="lines">@@ -139,54 +154,93 @@
</span><span class="cx"> 
</span><span class="cx"> TEST(WKWebViewCandidateTests, InsertCharactersAfterCandidateInsertionWithSoftSpace)
</span><span class="cx"> {
</span><del>-    CandidateTestWebView *wkWebView = [[CandidateTestWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)];
</del><ins>+    CandidateTestWebView *wkWebView = [CandidateTestWebView setUpWithFrame:NSMakeRect(0, 0, 800, 600) testPage:@&quot;input-field-in-scrollable-document&quot;];
</ins><span class="cx"> 
</span><del>-    NSURL *contentURL = [[NSBundle mainBundle] URLForResource:@&quot;input-field-in-scrollable-document&quot; withExtension:@&quot;html&quot; subdirectory:@&quot;TestWebKitAPI.resources&quot;];
-    [wkWebView loadRequest:[NSURLRequest requestWithURL:contentURL]];
-
-    [wkWebView waitForMessage:@&quot;focused&quot;];
-    [wkWebView _forceRequestCandidates];
</del><span class="cx">     [wkWebView insertCandidatesAndWaitForResponse:@&quot;foo &quot; range:NSMakeRange(0, 0)];
</span><del>-
</del><span class="cx">     EXPECT_TRUE([[wkWebView stringByEvaluatingJavaScript:GetInputValueJSExpression] isEqualToString:@&quot;foo &quot;]);
</span><span class="cx"> 
</span><del>-    [wkWebView typeCharacter:'a'];
-    [wkWebView waitForMessage:@&quot;input&quot;];
-
</del><ins>+    [wkWebView typeString:@&quot;a&quot; inputMessage:@&quot;input&quot;];
</ins><span class="cx">     EXPECT_TRUE([[wkWebView stringByEvaluatingJavaScript:GetInputValueJSExpression] isEqualToString:@&quot;foo a&quot;]);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> TEST(WKWebViewCandidateTests, InsertCandidateFromPartiallyTypedPhraseWithSoftSpace)
</span><span class="cx"> {
</span><del>-    CandidateTestWebView *wkWebView = [[CandidateTestWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)];
</del><ins>+    CandidateTestWebView *wkWebView = [CandidateTestWebView setUpWithFrame:NSMakeRect(0, 0, 800, 600) testPage:@&quot;input-field-in-scrollable-document&quot;];
</ins><span class="cx"> 
</span><del>-    NSURL *contentURL = [[NSBundle mainBundle] URLForResource:@&quot;input-field-in-scrollable-document&quot; withExtension:@&quot;html&quot; subdirectory:@&quot;TestWebKitAPI.resources&quot;];
-    [wkWebView loadRequest:[NSURLRequest requestWithURL:contentURL]];
-
-    [wkWebView waitForMessage:@&quot;focused&quot;];
-    [wkWebView _forceRequestCandidates];
-
-    NSString *initialValue = @&quot;hel&quot;;
-    for (uint64_t i = 0; i &lt; initialValue.length; ++i) {
-        [wkWebView typeCharacter:[initialValue characterAtIndex:i]];
-        [wkWebView waitForMessage:@&quot;input&quot;];
-    }
-
</del><ins>+    [wkWebView typeString:@&quot;hel&quot; inputMessage:@&quot;input&quot;];
</ins><span class="cx">     [wkWebView insertCandidatesAndWaitForResponse:@&quot;hello &quot; range:NSMakeRange(0, 3)];
</span><span class="cx">     EXPECT_TRUE([[wkWebView stringByEvaluatingJavaScript:GetInputValueJSExpression] isEqualToString:@&quot;hello &quot;]);
</span><span class="cx"> 
</span><span class="cx">     [wkWebView expectCandidateListVisibilityUpdates:0 whenPerformingActions:^()
</span><span class="cx">     {
</span><del>-        [wkWebView typeCharacter:' '];
-        [wkWebView waitForMessage:@&quot;input&quot;];
</del><ins>+        [wkWebView typeString:@&quot; &quot; inputMessage:@&quot;input&quot;];
</ins><span class="cx">         EXPECT_TRUE([[wkWebView stringByEvaluatingJavaScript:GetInputValueJSExpression] isEqualToString:@&quot;hello &quot;]);
</span><span class="cx">         EXPECT_EQ([[wkWebView stringByEvaluatingJavaScript:GetDocumentScrollTopJSExpression] doubleValue], 0);
</span><span class="cx"> 
</span><del>-        [wkWebView typeCharacter:' '];
-        [wkWebView waitForMessage:@&quot;input&quot;];
</del><ins>+        [wkWebView typeString:@&quot; &quot; inputMessage:@&quot;input&quot;];
</ins><span class="cx">         EXPECT_TRUE([[wkWebView stringByEvaluatingJavaScript:GetInputValueJSExpression] isEqualToString:@&quot;hello  &quot;]);
</span><span class="cx">         EXPECT_EQ([[wkWebView stringByEvaluatingJavaScript:GetDocumentScrollTopJSExpression] doubleValue], 0);
</span><span class="cx">     }];
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+TEST(WKWebViewCandidateTests, ClickingInTextFieldDoesNotThrashCandidateVisibility)
+{
+    CandidateTestWebView *wkWebView = [CandidateTestWebView setUpWithFrame:NSMakeRect(0, 0, 800, 600) testPage:@&quot;large-input-field-focus-onload&quot;];
+
+    [wkWebView typeString:@&quot;test&quot; inputMessage:@&quot;input&quot;];
+    [wkWebView expectCandidateListVisibilityUpdates:0 whenPerformingActions:^()
+    {
+        dispatch_async(dispatch_get_main_queue(), ^()
+        {
+            [wkWebView mouseDownAtPoint:NSMakePoint(100, 300) simulatePressure:YES];
+        });
+        [wkWebView waitForMessage:@&quot;mousedown&quot;];
+    }];
+    EXPECT_TRUE([[wkWebView stringByEvaluatingJavaScript:GetInputValueJSExpression] isEqualToString:@&quot;test&quot;]);
+}
+
+TEST(WKWebViewCandidateTests, ShouldNotRequestCandidatesInPasswordField)
+{
+    CandidateTestWebView *wkWebView = [[CandidateTestWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)];
+    [wkWebView loadTestPageNamed:@&quot;text-and-password-inputs&quot;];
+    [wkWebView waitForMessage:@&quot;loaded&quot;];
+    [wkWebView _forceRequestCandidates];
+
+    dispatch_async(dispatch_get_main_queue(), ^()
+    {
+        [wkWebView mouseDownAtPoint:NSMakePoint(400, 150) simulatePressure:YES];
+    });
+    [wkWebView waitForMessage:@&quot;password-focused&quot;];
+
+    [wkWebView typeString:@&quot;foo&quot; inputMessage:@&quot;password-input&quot;];
+    EXPECT_FALSE([wkWebView _shouldRequestCandidates]);
+
+    NSString *passwordFieldValue = [wkWebView stringByEvaluatingJavaScript:@&quot;document.querySelector('#password').value&quot;];
+    EXPECT_STREQ(passwordFieldValue.UTF8String, &quot;foo&quot;);
+}
+
+#if USE(APPLE_INTERNAL_SDK)
+
+TEST(WKWebViewCandidateTests, ShouldRequestCandidatesInTextField)
+{
+    CandidateTestWebView *wkWebView = [[CandidateTestWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)];
+    [wkWebView loadTestPageNamed:@&quot;text-and-password-inputs&quot;];
+    [wkWebView waitForMessage:@&quot;loaded&quot;];
+    [wkWebView _forceRequestCandidates];
+
+    dispatch_async(dispatch_get_main_queue(), ^()
+    {
+        [wkWebView mouseDownAtPoint:NSMakePoint(400, 450) simulatePressure:YES];
+    });
+    [wkWebView waitForMessage:@&quot;text-focused&quot;];
+
+    [wkWebView typeString:@&quot;bar&quot; inputMessage:@&quot;text-input&quot;];
+    EXPECT_TRUE([wkWebView _shouldRequestCandidates]);
+
+    NSString *textFieldValue = [wkWebView stringByEvaluatingJavaScript:@&quot;document.querySelector('#text').value&quot;];
+    EXPECT_STREQ(textFieldValue.UTF8String, &quot;bar&quot;);
+}
+
+#endif
+
</ins><span class="cx"> #endif /* WK_API_ENABLED &amp;&amp; PLATFORM(MAC) &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101200 */
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2Cocoalargeinputfieldfocusonloadhtml"></a>
<div class="addfile"><h4>Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-input-field-focus-onload.html (0 => 206135)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-input-field-focus-onload.html                                (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-input-field-focus-onload.html        2016-09-20 01:02:40 UTC (rev 206135)
</span><span class="lines">@@ -0,0 +1,38 @@
</span><ins>+&lt;html&gt;
+
+&lt;head&gt;
+    &lt;style&gt;
+        body {
+            margin: 0;
+        }
+
+        input {
+            width: 100vw;
+            height: 100vh;
+            font-size: 50vh;
+        }
+    &lt;/style&gt;
+    &lt;script type=&quot;text/javascript&quot;&gt;
+        function loaded() {
+            document.querySelector(&quot;input&quot;).focus();
+        }
+
+        function focused() {
+            setTimeout(() =&gt; window.webkit.messageHandlers.testHandler.postMessage(&quot;focused&quot;), 0);
+        }
+
+        function input() {
+            setTimeout(() =&gt; window.webkit.messageHandlers.testHandler.postMessage(&quot;input&quot;), 0);
+        }
+
+        function mousedown() {
+            setTimeout(() =&gt; window.webkit.messageHandlers.testHandler.postMessage(&quot;mousedown&quot;), 0);
+        }
+    &lt;/script&gt;
+&lt;/head&gt;
+
+&lt;body onload=loaded()&gt;
+    &lt;input onfocus=focused() oninput=input() onmousedown=mousedown()&gt;&lt;/input&gt;
+&lt;/body&gt;
+
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2Cocoatextandpasswordinputshtml"></a>
<div class="addfile"><h4>Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/text-and-password-inputs.html (0 => 206135)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/text-and-password-inputs.html                                (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/text-and-password-inputs.html        2016-09-20 01:02:40 UTC (rev 206135)
</span><span class="lines">@@ -0,0 +1,39 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+    &lt;script&gt;
+    function loaded() {
+        setTimeout(() =&gt; window.webkit.messageHandlers.testHandler.postMessage(&quot;loaded&quot;), 0);
+    }
+
+    function textFocused() {
+        setTimeout(() =&gt; window.webkit.messageHandlers.testHandler.postMessage(&quot;text-focused&quot;), 0);
+    }
+
+    function textInput() {
+        setTimeout(() =&gt; window.webkit.messageHandlers.testHandler.postMessage(&quot;text-input&quot;), 0);
+    }
+
+    function passwordFocused() {
+        setTimeout(() =&gt; window.webkit.messageHandlers.testHandler.postMessage(&quot;password-focused&quot;), 0);
+    }
+
+    function passwordInput() {
+        setTimeout(() =&gt; window.webkit.messageHandlers.testHandler.postMessage(&quot;password-input&quot;), 0);
+    }
+    &lt;/script&gt;
+
+    &lt;style&gt;
+    input {
+        width: 100%;
+        height: 50%;
+        font-size: 100px;
+    }
+    body { margin: 0; }
+    &lt;/style&gt;
+&lt;/head&gt;
+
+&lt;body onload=loaded() onmousedown=mousedown(event)&gt;
+    &lt;input id=&quot;text&quot; type=&quot;text&quot; onfocus=textFocused() oninput=textInput()&gt;&lt;/input&gt;
+    &lt;input id=&quot;password&quot; type=&quot;password&quot; onfocus=passwordFocused() oninput=passwordInput()&gt;&lt;/input&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkToolsTestWebKitAPImacTestWKWebViewMach"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/mac/TestWKWebViewMac.h (206134 => 206135)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/mac/TestWKWebViewMac.h        2016-09-20 00:48:39 UTC (rev 206134)
+++ trunk/Tools/TestWebKitAPI/mac/TestWKWebViewMac.h        2016-09-20 01:02:40 UTC (rev 206135)
</span><span class="lines">@@ -35,7 +35,11 @@
</span><span class="cx"> @end
</span><span class="cx"> 
</span><span class="cx"> @interface TestWKWebView : WKWebView
</span><del>-- (void)mouseDownAtPoint:(NSPoint)point;
</del><ins>+- (instancetype)initWithFrame:(CGRect)frame configuration:(WKWebViewConfiguration *)configuration NS_DESIGNATED_INITIALIZER;
+- (instancetype)initWithCoder:(NSCoder *)coder NS_UNAVAILABLE;
+
+// Simulates clicking with a pressure-sensitive device, if possible.
+- (void)mouseDownAtPoint:(NSPoint)point simulatePressure:(BOOL)simulatePressure;
</ins><span class="cx"> - (void)performAfterReceivingMessage:(NSString *)message action:(dispatch_block_t)action;
</span><span class="cx"> - (void)loadTestPageNamed:(NSString *)pageName;
</span><span class="cx"> - (void)typeCharacter:(char)character;
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPImacTestWKWebViewMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/mac/TestWKWebViewMac.mm (206134 => 206135)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/mac/TestWKWebViewMac.mm        2016-09-20 00:48:39 UTC (rev 206134)
+++ trunk/Tools/TestWebKitAPI/mac/TestWKWebViewMac.mm        2016-09-20 01:02:40 UTC (rev 206135)
</span><span class="lines">@@ -33,6 +33,7 @@
</span><span class="cx"> #import &lt;AppKit/AppKit.h&gt;
</span><span class="cx"> #import &lt;Carbon/Carbon.h&gt;
</span><span class="cx"> #import &lt;WebKit/WebKitPrivate.h&gt;
</span><ins>+#import &lt;objc/runtime.h&gt;
</ins><span class="cx"> #import &lt;wtf/RetainPtr.h&gt;
</span><span class="cx"> 
</span><span class="cx"> @implementation TestMessageHandler {
</span><span class="lines">@@ -59,18 +60,90 @@
</span><span class="cx"> 
</span><span class="cx"> @end
</span><span class="cx"> 
</span><del>-@implementation TestWKWebView
</del><ins>+@interface TestWKWebViewHostWindow : NSWindow
+@end
</ins><span class="cx"> 
</span><del>-- (void)mouseDownAtPoint:(NSPoint)point
</del><ins>+@implementation TestWKWebViewHostWindow
+
+static int gEventNumber = 1;
+
+#if __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101003
+NSEventMask __simulated_forceClickAssociatedEventsMask(id self, SEL _cmd)
</ins><span class="cx"> {
</span><ins>+    return NSEventMaskPressure | NSEventMaskLeftMouseDown | NSEventMaskLeftMouseUp | NSEventMaskLeftMouseDragged;
+}
+#endif
+
+- (void)_mouseDownAtPoint:(NSPoint)point simulatePressure:(BOOL)simulatePressure
+{
</ins><span class="cx"> #if __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101200
</span><span class="cx">     NSEventType mouseEventType = NSEventTypeLeftMouseDown;
</span><span class="cx"> #else
</span><span class="cx">     NSEventType mouseEventType = NSLeftMouseDown;
</span><span class="cx"> #endif
</span><del>-    [self mouseDown:[NSEvent mouseEventWithType:mouseEventType location:NSMakePoint(point.x, point.y) modifierFlags:0 timestamp:GetCurrentEventTime() windowNumber:0 context:[NSGraphicsContext currentContext] eventNumber:0 clickCount:0 pressure:0]];
</del><ins>+
+    NSEventMask modifierFlags = 0;
+#if __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101003
+    if (simulatePressure)
+        modifierFlags |= NSEventMaskPressure;
+#else
+    simulatePressure = NO;
+#endif
+
+    NSEvent *event = [NSEvent mouseEventWithType:mouseEventType location:point modifierFlags:modifierFlags timestamp:GetCurrentEventTime() windowNumber:self.windowNumber context:[NSGraphicsContext currentContext] eventNumber:++gEventNumber clickCount:1 pressure:simulatePressure];
+    if (!simulatePressure) {
+        [self sendEvent:event];
+        return;
+    }
+
+#if __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101003
+    IMP simulatedAssociatedEventsMaskImpl = (IMP)__simulated_forceClickAssociatedEventsMask;
+    Method associatedEventsMaskMethod = class_getInstanceMethod([NSEvent class], @selector(associatedEventsMask));
+    IMP originalAssociatedEventsMaskImpl = method_setImplementation(associatedEventsMaskMethod, simulatedAssociatedEventsMaskImpl);
+    @try {
+        [self sendEvent:event];
+    } @finally {
+        // In the case where event sending raises an exception, we still want to restore the original implementation
+        // to prevent subsequent event sending tests from being affected.
+        method_setImplementation(associatedEventsMaskMethod, originalAssociatedEventsMaskImpl);
+    }
+#endif
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+@end
+
+@implementation TestWKWebView {
+    TestWKWebViewHostWindow *_hostWindow;
+}
+
+- (instancetype)initWithFrame:(CGRect)frame
+{
+    WKWebViewConfiguration *defaultConfiguration = [[WKWebViewConfiguration alloc] init];
+    return [self initWithFrame:frame configuration:defaultConfiguration];
+}
+
+- (instancetype)initWithFrame:(CGRect)frame configuration:(WKWebViewConfiguration *)configuration
+{
+    if (self = [super initWithFrame:frame configuration:configuration])
+        [self _setUpTestWindow:frame];
+
+    return self;
+}
+
+- (void)_setUpTestWindow:(NSRect)frame
+{
+    _hostWindow = [[TestWKWebViewHostWindow alloc] initWithContentRect:frame styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO];
+    [_hostWindow setFrameOrigin:NSMakePoint(0, 0)];
+    [[_hostWindow contentView] addSubview:self];
+    [_hostWindow setIsVisible:YES];
+    [_hostWindow makeKeyAndOrderFront:self];
+}
+
+- (void)mouseDownAtPoint:(NSPoint)point simulatePressure:(BOOL)simulatePressure
+{
+    [_hostWindow _mouseDownAtPoint:point simulatePressure:simulatePressure];
+}
+
</ins><span class="cx"> - (void)performAfterReceivingMessage:(NSString *)message action:(dispatch_block_t)action
</span><span class="cx"> {
</span><span class="cx">     RetainPtr&lt;TestMessageHandler&gt; handler = adoptNS([[TestMessageHandler alloc] initWithMessage:message handler:action]);
</span><span class="lines">@@ -94,8 +167,8 @@
</span><span class="cx">     NSEventType keyDownEventType = NSKeyDown;
</span><span class="cx">     NSEventType keyUpEventType = NSKeyUp;
</span><span class="cx"> #endif
</span><del>-    [self keyDown:[NSEvent keyEventWithType:keyDownEventType location:NSZeroPoint modifierFlags:0 timestamp:GetCurrentEventTime() windowNumber:0 context:nil characters:characterAsString charactersIgnoringModifiers:characterAsString isARepeat:NO keyCode:character]];
-    [self keyUp:[NSEvent keyEventWithType:keyUpEventType location:NSZeroPoint modifierFlags:0 timestamp:GetCurrentEventTime() windowNumber:0 context:nil characters:characterAsString charactersIgnoringModifiers:characterAsString isARepeat:NO keyCode:character]];
</del><ins>+    [self keyDown:[NSEvent keyEventWithType:keyDownEventType location:NSZeroPoint modifierFlags:0 timestamp:GetCurrentEventTime() windowNumber:_hostWindow.windowNumber context:nil characters:characterAsString charactersIgnoringModifiers:characterAsString isARepeat:NO keyCode:character]];
+    [self keyUp:[NSEvent keyEventWithType:keyUpEventType location:NSZeroPoint modifierFlags:0 timestamp:GetCurrentEventTime() windowNumber:_hostWindow.windowNumber context:nil characters:characterAsString charactersIgnoringModifiers:characterAsString isARepeat:NO keyCode:character]];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (NSString *)stringByEvaluatingJavaScript:(NSString *)script
</span></span></pre>
</div>
</div>

</body>
</html>