<!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>[206543] branches/safari-602-branch</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/206543">206543</a></dd>
<dt>Author</dt> <dd>bshafiei@apple.com</dd>
<dt>Date</dt> <dd>2016-09-28 13:48:24 -0700 (Wed, 28 Sep 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/206135">r206135</a>. rdar://problem/28499358</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari602branchSourceWebKit2ChangeLog">branches/safari-602-branch/Source/WebKit2/ChangeLog</a></li>
<li><a href="#branchessafari602branchSourceWebKit2UIProcessAPICocoaWKWebViewmm">branches/safari-602-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm</a></li>
<li><a href="#branchessafari602branchSourceWebKit2UIProcessAPICocoaWKWebViewPrivateh">branches/safari-602-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h</a></li>
<li><a href="#branchessafari602branchToolsChangeLog">branches/safari-602-branch/Tools/ChangeLog</a></li>
<li><a href="#branchessafari602branchToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj">branches/safari-602-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj</a></li>
<li><a href="#branchessafari602branchToolsTestWebKitAPITestsWebKit2CocoaVideoControlsManagermm">branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/VideoControlsManager.mm</a></li>
<li><a href="#branchessafari602branchToolsTestWebKitAPITestsWebKit2CocoaWKWebViewCandidateTestsmm">branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WKWebViewCandidateTests.mm</a></li>
<li><a href="#branchessafari602branchToolsTestWebKitAPImacTestWKWebViewMach">branches/safari-602-branch/Tools/TestWebKitAPI/mac/TestWKWebViewMac.h</a></li>
<li><a href="#branchessafari602branchToolsTestWebKitAPImacTestWKWebViewMacmm">branches/safari-602-branch/Tools/TestWebKitAPI/mac/TestWKWebViewMac.mm</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#branchessafari602branchToolsTestWebKitAPITestsWebKit2Cocoalargeinputfieldfocusonloadhtml">branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-input-field-focus-onload.html</a></li>
<li><a href="#branchessafari602branchToolsTestWebKitAPITestsWebKit2Cocoatextandpasswordinputshtml">branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/text-and-password-inputs.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari602branchSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-602-branch/Source/WebKit2/ChangeLog (206542 => 206543)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/Source/WebKit2/ChangeLog        2016-09-28 20:41:29 UTC (rev 206542)
+++ branches/safari-602-branch/Source/WebKit2/ChangeLog        2016-09-28 20:48:24 UTC (rev 206543)
</span><span class="lines">@@ -1,3 +1,22 @@
</span><ins>+2016-09-28 Babak Shafiei <bshafiei@apple.com>
+
+ Merge r206135. rdar://problem/28499358
+
+ 2016-09-19 Wenson Hsieh <wenson_hsieh@apple.com>
+
+ Add a unit test covering <https://trac.webkit.org/changeset/205983>
+ 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-26 Babak Shafiei <bshafiei@apple.com>
</span><span class="cx">
</span><span class="cx"> Merge r206238. rdar://problem/28450514
</span></span></pre></div>
<a id="branchessafari602branchSourceWebKit2UIProcessAPICocoaWKWebViewmm"></a>
<div class="modfile"><h4>Modified: branches/safari-602-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (206542 => 206543)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm        2016-09-28 20:41:29 UTC (rev 206542)
+++ branches/safari-602-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm        2016-09-28 20:48:24 UTC (rev 206543)
</span><span class="lines">@@ -4574,6 +4574,11 @@
</span><span class="cx"> {
</span><span class="cx"> _impl->forceRequestCandidatesForTesting();
</span><span class="cx"> }
</span><ins>+
+- (BOOL)_shouldRequestCandidates
+{
+ return _impl->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="branchessafari602branchSourceWebKit2UIProcessAPICocoaWKWebViewPrivateh"></a>
<div class="modfile"><h4>Modified: branches/safari-602-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h (206542 => 206543)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h        2016-09-28 20:41:29 UTC (rev 206542)
+++ branches/safari-602-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h        2016-09-28 20:48:24 UTC (rev 206543)
</span><span class="lines">@@ -274,6 +274,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(WK_MAC_TBA), ios(WK_IOS_TBA));
</span></span></pre></div>
<a id="branchessafari602branchToolsChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-602-branch/Tools/ChangeLog (206542 => 206543)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/Tools/ChangeLog        2016-09-28 20:41:29 UTC (rev 206542)
+++ branches/safari-602-branch/Tools/ChangeLog        2016-09-28 20:48:24 UTC (rev 206543)
</span><span class="lines">@@ -1,3 +1,43 @@
</span><ins>+2016-09-28 Babak Shafiei <bshafiei@apple.com>
+
+ Merge r206135. rdar://problem/28499358
+
+ 2016-09-19 Wenson Hsieh <wenson_hsieh@apple.com>
+
+ Add a unit test covering <https://trac.webkit.org/changeset/205983>
+ 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-22 Babak Shafiei <bshafiei@apple.com>
</span><span class="cx">
</span><span class="cx"> Merge r206038. rdar://problem/28086237
</span></span></pre></div>
<a id="branchessafari602branchToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: branches/safari-602-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (206542 => 206543)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2016-09-28 20:41:29 UTC (rev 206542)
+++ branches/safari-602-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2016-09-28 20:48:24 UTC (rev 206543)
</span><span class="lines">@@ -72,6 +72,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">@@ -451,6 +452,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">@@ -578,6 +580,8 @@
</span><span class="cx">                                 7AE9E5091AE5AE8B00CF874B /* test.pdf in Copy Resources */,
</span><span class="cx">                                 7A1458FC1AD5C07000E06772 /* mouse-button-listener.html in Copy Resources */,
</span><span class="cx">                                 7C486BA11AA12567003F6F9B /* bundle-file.html in Copy Resources */,
</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">@@ -762,6 +766,7 @@
</span><span class="cx">                 2E691AF21D79E75400129407 /* large-video-playing-scroll-away.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "large-video-playing-scroll-away.html"; sourceTree = "<group>"; };
</span><span class="cx">                 2E7765CC16C4D80A00BA2BB1 /* mainIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = mainIOS.mm; sourceTree = "<group>"; };
</span><span class="cx">                 2E7765CE16C4D81100BA2BB1 /* mainMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = mainMac.mm; sourceTree = "<group>"; };
</span><ins>+                2E9896141D8F092B00739892 /* text-and-password-inputs.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "text-and-password-inputs.html"; sourceTree = "<group>"; };
</ins><span class="cx">                 2EFF06C21D8862120004BB30 /* large-video-offscreen.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "large-video-offscreen.html"; sourceTree = "<group>"; };
</span><span class="cx">                 2EFF06C41D8867700004BB30 /* change-video-source-on-click.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "change-video-source-on-click.html"; sourceTree = "<group>"; };
</span><span class="cx">                 2EFF06C61D886A560004BB30 /* change-video-source-on-end.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "change-video-source-on-end.html"; sourceTree = "<group>"; };
</span><span class="lines">@@ -1132,6 +1137,7 @@
</span><span class="cx">                 E4A757D3178AEA5B00B5D7A4 /* Deque.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = Deque.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 E4C9ABC71B3DB1710040A987 /* RunLoop.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RunLoop.cpp; sourceTree = "<group>"; };
</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 = "large-input-field-focus-onload.html"; path = "Tests/WebKit2Cocoa/large-input-field-focus-onload.html"; sourceTree = SOURCE_ROOT; };
</ins><span class="cx">                 F4F405BA1D4C0CF8007A9707 /* full-size-autoplaying-video-with-audio.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "full-size-autoplaying-video-with-audio.html"; sourceTree = "<group>"; };
</span><span class="cx">                 F4F405BB1D4C0CF8007A9707 /* skinny-autoplaying-video-with-audio.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "skinny-autoplaying-video-with-audio.html"; sourceTree = "<group>"; };
</span><span class="cx">                 F660AA0C15A5F061003A1243 /* GetInjectedBundleInitializationUserDataCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GetInjectedBundleInitializationUserDataCallback.cpp; sourceTree = "<group>"; };
</span><span class="lines">@@ -1413,6 +1419,7 @@
</span><span class="cx">                                 2E1DFDF01D42E14400714A00 /* large-video-seek-to-beginning-and-play-after-ending.html */,
</span><span class="cx">                                 2E1B7B011D41B1B3007558B4 /* large-video-hides-controls-after-seek-to-end.html */,
</span><span class="cx">                                 2E1DFDEE1D42A6EB00714A00 /* large-videos-with-audio-autoplay.html */,
</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">@@ -1846,6 +1853,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="branchessafari602branchToolsTestWebKitAPITestsWebKit2CocoaVideoControlsManagermm"></a>
<div class="modfile"><h4>Modified: branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/VideoControlsManager.mm (206542 => 206543)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/VideoControlsManager.mm        2016-09-28 20:41:29 UTC (rev 206542)
+++ branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/VideoControlsManager.mm        2016-09-28 20:48:24 UTC (rev 206543)
</span><span class="lines">@@ -121,11 +121,7 @@
</span><span class="cx"> {
</span><span class="cx"> RetainPtr<WKWebViewConfiguration> configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
</span><span class="cx"> configuration.get().mediaTypesRequiringUserActionForPlayback = WKAudiovisualMediaTypeNone;
</span><del>- RetainPtr<VideoControlsManagerTestWebView> webView = adoptNS([[VideoControlsManagerTestWebView alloc] initWithFrame:frame configuration:configuration.get()]);
- RetainPtr<NSWindow> 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:@"large-videos-autoplaying-click-to-pause"];
</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:@"first"]);
</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:@"autoplaying-video-with-audio"];
</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:@"paused"];
</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:@"large-video-hides-controls-after-seek-to-end"];
</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<VideoControlsManagerTestWebView*> webView = setUpWebViewForTestingVideoControlsManager(NSMakeRect(0, 0, 1024, 768));
</span><span class="cx">
</span><span class="cx"> [webView loadTestPageNamed:@"large-video-offscreen"];
</span><del>- [webView expectControlsManager:NO afterReceivingMessage:@"moved"];
</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:@"change-video-source-on-click"];
</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:@"changed"];
</span><span class="cx"> }
</span></span></pre></div>
<a id="branchessafari602branchToolsTestWebKitAPITestsWebKit2CocoaWKWebViewCandidateTestsmm"></a>
<div class="modfile"><h4>Modified: branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WKWebViewCandidateTests.mm (206542 => 206543)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WKWebViewCandidateTests.mm        2016-09-28 20:41:29 UTC (rev 206542)
+++ branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WKWebViewCandidateTests.mm        2016-09-28 20:48:24 UTC (rev 206543)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx"> #import "PlatformUtilities.h"
</span><span class="cx"> #import "TestWKWebViewMac.h"
</span><span class="cx">
</span><ins>+#import <Carbon/Carbon.h>
</ins><span class="cx"> #import <WebKit/WebKitPrivate.h>
</span><span class="cx">
</span><span class="cx"> static NSString *GetInputValueJSExpression = @"document.querySelector('input').value";
</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 < 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:@"focused"];
+ [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:@"input-field-in-scrollable-document"];
</ins><span class="cx">
</span><del>- NSURL *contentURL = [[NSBundle mainBundle] URLForResource:@"input-field-in-scrollable-document" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"];
- [wkWebView loadRequest:[NSURLRequest requestWithURL:contentURL]];
-
- [wkWebView waitForMessage:@"focused"];
- [wkWebView _forceRequestCandidates];
</del><span class="cx"> [wkWebView insertCandidatesAndWaitForResponse:@"apple " range:NSMakeRange(0, 0)];
</span><del>-
</del><span class="cx"> EXPECT_TRUE([[wkWebView stringByEvaluatingJavaScript:GetInputValueJSExpression] isEqualToString:@"apple "]);
</span><span class="cx">
</span><span class="cx"> [wkWebView expectCandidateListVisibilityUpdates:0 whenPerformingActions:^()
</span><span class="cx"> {
</span><del>- [wkWebView typeCharacter:' '];
- [wkWebView waitForMessage:@"input"];
</del><ins>+ [wkWebView typeString:@" " inputMessage:@"input"];
</ins><span class="cx"> }];
</span><del>-
</del><span class="cx"> EXPECT_TRUE([[wkWebView stringByEvaluatingJavaScript:GetInputValueJSExpression] isEqualToString:@"apple "]);
</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:@"input-field-in-scrollable-document"];
</ins><span class="cx">
</span><del>- NSURL *contentURL = [[NSBundle mainBundle] URLForResource:@"input-field-in-scrollable-document" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"];
- [wkWebView loadRequest:[NSURLRequest requestWithURL:contentURL]];
-
- [wkWebView waitForMessage:@"focused"];
- [wkWebView _forceRequestCandidates];
</del><span class="cx"> [wkWebView insertCandidatesAndWaitForResponse:@"foo " range:NSMakeRange(0, 0)];
</span><del>-
</del><span class="cx"> EXPECT_TRUE([[wkWebView stringByEvaluatingJavaScript:GetInputValueJSExpression] isEqualToString:@"foo "]);
</span><span class="cx">
</span><del>- [wkWebView typeCharacter:'a'];
- [wkWebView waitForMessage:@"input"];
-
</del><ins>+ [wkWebView typeString:@"a" inputMessage:@"input"];
</ins><span class="cx"> EXPECT_TRUE([[wkWebView stringByEvaluatingJavaScript:GetInputValueJSExpression] isEqualToString:@"foo a"]);
</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:@"input-field-in-scrollable-document"];
</ins><span class="cx">
</span><del>- NSURL *contentURL = [[NSBundle mainBundle] URLForResource:@"input-field-in-scrollable-document" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"];
- [wkWebView loadRequest:[NSURLRequest requestWithURL:contentURL]];
-
- [wkWebView waitForMessage:@"focused"];
- [wkWebView _forceRequestCandidates];
-
- NSString *initialValue = @"hel";
- for (uint64_t i = 0; i < initialValue.length; ++i) {
- [wkWebView typeCharacter:[initialValue characterAtIndex:i]];
- [wkWebView waitForMessage:@"input"];
- }
-
</del><ins>+ [wkWebView typeString:@"hel" inputMessage:@"input"];
</ins><span class="cx"> [wkWebView insertCandidatesAndWaitForResponse:@"hello " range:NSMakeRange(0, 3)];
</span><span class="cx"> EXPECT_TRUE([[wkWebView stringByEvaluatingJavaScript:GetInputValueJSExpression] isEqualToString:@"hello "]);
</span><span class="cx">
</span><span class="cx"> [wkWebView expectCandidateListVisibilityUpdates:0 whenPerformingActions:^()
</span><span class="cx"> {
</span><del>- [wkWebView typeCharacter:' '];
- [wkWebView waitForMessage:@"input"];
</del><ins>+ [wkWebView typeString:@" " inputMessage:@"input"];
</ins><span class="cx"> EXPECT_TRUE([[wkWebView stringByEvaluatingJavaScript:GetInputValueJSExpression] isEqualToString:@"hello "]);
</span><span class="cx"> EXPECT_EQ([[wkWebView stringByEvaluatingJavaScript:GetDocumentScrollTopJSExpression] doubleValue], 0);
</span><span class="cx">
</span><del>- [wkWebView typeCharacter:' '];
- [wkWebView waitForMessage:@"input"];
</del><ins>+ [wkWebView typeString:@" " inputMessage:@"input"];
</ins><span class="cx"> EXPECT_TRUE([[wkWebView stringByEvaluatingJavaScript:GetInputValueJSExpression] isEqualToString:@"hello "]);
</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:@"large-input-field-focus-onload"];
+
+ [wkWebView typeString:@"test" inputMessage:@"input"];
+ [wkWebView expectCandidateListVisibilityUpdates:0 whenPerformingActions:^()
+ {
+ dispatch_async(dispatch_get_main_queue(), ^()
+ {
+ [wkWebView mouseDownAtPoint:NSMakePoint(100, 300) simulatePressure:YES];
+ });
+ [wkWebView waitForMessage:@"mousedown"];
+ }];
+ EXPECT_TRUE([[wkWebView stringByEvaluatingJavaScript:GetInputValueJSExpression] isEqualToString:@"test"]);
+}
+
+TEST(WKWebViewCandidateTests, ShouldNotRequestCandidatesInPasswordField)
+{
+ CandidateTestWebView *wkWebView = [[CandidateTestWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)];
+ [wkWebView loadTestPageNamed:@"text-and-password-inputs"];
+ [wkWebView waitForMessage:@"loaded"];
+ [wkWebView _forceRequestCandidates];
+
+ dispatch_async(dispatch_get_main_queue(), ^()
+ {
+ [wkWebView mouseDownAtPoint:NSMakePoint(400, 150) simulatePressure:YES];
+ });
+ [wkWebView waitForMessage:@"password-focused"];
+
+ [wkWebView typeString:@"foo" inputMessage:@"password-input"];
+ EXPECT_FALSE([wkWebView _shouldRequestCandidates]);
+
+ NSString *passwordFieldValue = [wkWebView stringByEvaluatingJavaScript:@"document.querySelector('#password').value"];
+ EXPECT_STREQ(passwordFieldValue.UTF8String, "foo");
+}
+
+#if USE(APPLE_INTERNAL_SDK)
+
+TEST(WKWebViewCandidateTests, ShouldRequestCandidatesInTextField)
+{
+ CandidateTestWebView *wkWebView = [[CandidateTestWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)];
+ [wkWebView loadTestPageNamed:@"text-and-password-inputs"];
+ [wkWebView waitForMessage:@"loaded"];
+ [wkWebView _forceRequestCandidates];
+
+ dispatch_async(dispatch_get_main_queue(), ^()
+ {
+ [wkWebView mouseDownAtPoint:NSMakePoint(400, 450) simulatePressure:YES];
+ });
+ [wkWebView waitForMessage:@"text-focused"];
+
+ [wkWebView typeString:@"bar" inputMessage:@"text-input"];
+ EXPECT_TRUE([wkWebView _shouldRequestCandidates]);
+
+ NSString *textFieldValue = [wkWebView stringByEvaluatingJavaScript:@"document.querySelector('#text').value"];
+ EXPECT_STREQ(textFieldValue.UTF8String, "bar");
+}
+
+#endif
+
</ins><span class="cx"> #endif /* WK_API_ENABLED && PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200 */
</span></span></pre></div>
<a id="branchessafari602branchToolsTestWebKitAPITestsWebKit2Cocoalargeinputfieldfocusonloadhtml"></a>
<div class="addfile"><h4>Added: branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-input-field-focus-onload.html (0 => 206543)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-input-field-focus-onload.html         (rev 0)
+++ branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-input-field-focus-onload.html        2016-09-28 20:48:24 UTC (rev 206543)
</span><span class="lines">@@ -0,0 +1,38 @@
</span><ins>+<html>
+
+<head>
+ <style>
+ body {
+ margin: 0;
+ }
+
+ input {
+ width: 100vw;
+ height: 100vh;
+ font-size: 50vh;
+ }
+ </style>
+ <script type="text/javascript">
+ function loaded() {
+ document.querySelector("input").focus();
+ }
+
+ function focused() {
+ setTimeout(() => window.webkit.messageHandlers.testHandler.postMessage("focused"), 0);
+ }
+
+ function input() {
+ setTimeout(() => window.webkit.messageHandlers.testHandler.postMessage("input"), 0);
+ }
+
+ function mousedown() {
+ setTimeout(() => window.webkit.messageHandlers.testHandler.postMessage("mousedown"), 0);
+ }
+ </script>
+</head>
+
+<body onload=loaded()>
+ <input onfocus=focused() oninput=input() onmousedown=mousedown()></input>
+</body>
+
+</html>
</ins></span></pre></div>
<a id="branchessafari602branchToolsTestWebKitAPITestsWebKit2Cocoatextandpasswordinputshtml"></a>
<div class="addfile"><h4>Added: branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/text-and-password-inputs.html (0 => 206543)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/text-and-password-inputs.html         (rev 0)
+++ branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/text-and-password-inputs.html        2016-09-28 20:48:24 UTC (rev 206543)
</span><span class="lines">@@ -0,0 +1,39 @@
</span><ins>+<html>
+<head>
+ <script>
+ function loaded() {
+ setTimeout(() => window.webkit.messageHandlers.testHandler.postMessage("loaded"), 0);
+ }
+
+ function textFocused() {
+ setTimeout(() => window.webkit.messageHandlers.testHandler.postMessage("text-focused"), 0);
+ }
+
+ function textInput() {
+ setTimeout(() => window.webkit.messageHandlers.testHandler.postMessage("text-input"), 0);
+ }
+
+ function passwordFocused() {
+ setTimeout(() => window.webkit.messageHandlers.testHandler.postMessage("password-focused"), 0);
+ }
+
+ function passwordInput() {
+ setTimeout(() => window.webkit.messageHandlers.testHandler.postMessage("password-input"), 0);
+ }
+ </script>
+
+ <style>
+ input {
+ width: 100%;
+ height: 50%;
+ font-size: 100px;
+ }
+ body { margin: 0; }
+ </style>
+</head>
+
+<body onload=loaded() onmousedown=mousedown(event)>
+ <input id="text" type="text" onfocus=textFocused() oninput=textInput()></input>
+ <input id="password" type="password" onfocus=passwordFocused() oninput=passwordInput()></input>
+</body>
+</html>
</ins></span></pre></div>
<a id="branchessafari602branchToolsTestWebKitAPImacTestWKWebViewMach"></a>
<div class="modfile"><h4>Modified: branches/safari-602-branch/Tools/TestWebKitAPI/mac/TestWKWebViewMac.h (206542 => 206543)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/Tools/TestWebKitAPI/mac/TestWKWebViewMac.h        2016-09-28 20:41:29 UTC (rev 206542)
+++ branches/safari-602-branch/Tools/TestWebKitAPI/mac/TestWKWebViewMac.h        2016-09-28 20:48:24 UTC (rev 206543)
</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="branchessafari602branchToolsTestWebKitAPImacTestWKWebViewMacmm"></a>
<div class="modfile"><h4>Modified: branches/safari-602-branch/Tools/TestWebKitAPI/mac/TestWKWebViewMac.mm (206542 => 206543)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/Tools/TestWebKitAPI/mac/TestWKWebViewMac.mm        2016-09-28 20:41:29 UTC (rev 206542)
+++ branches/safari-602-branch/Tools/TestWebKitAPI/mac/TestWKWebViewMac.mm        2016-09-28 20:48:24 UTC (rev 206543)
</span><span class="lines">@@ -33,6 +33,7 @@
</span><span class="cx"> #import <AppKit/AppKit.h>
</span><span class="cx"> #import <Carbon/Carbon.h>
</span><span class="cx"> #import <WebKit/WebKitPrivate.h>
</span><ins>+#import <objc/runtime.h>
</ins><span class="cx"> #import <wtf/RetainPtr.h>
</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 >= 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 >= 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 >= 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 >= 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<TestMessageHandler> 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>