<!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>[189365] 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/189365">189365</a></dd>
<dt>Author</dt> <dd>bdakin@apple.com</dd>
<dt>Date</dt> <dd>2015-09-04 11:45:48 -0700 (Fri, 04 Sep 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Need to be able to test default behaviors on force click
https://bugs.webkit.org/show_bug.cgi?id=148758

Reviewed by Tim Horton.

Source/WebCore:

WKTR needs access to this.
* platform/spi/mac/NSEventSPI.h:

Source/WebKit2:

The hit test seems to return synchronously in WKTR, so we need to do the hit 
test last before we clear state otherwise we will trample the hit test 
result.
* UIProcess/mac/WKImmediateActionController.mm:
(-[WKImmediateActionController immediateActionRecognizerWillPrepare:]):
(-[WKImmediateActionController immediateActionRecognizerWillBeginAnimation:]):

Tools:

This patch adds a new eventSender method to do a full, completed force click, 
and it re-works all of the existing force methods to dispatch their events in 
such a way that they will trigger the NSImmediateAction gesture recognizer. 
To do this, first we need to send the events to the app rather than straight 
to the view, and also needed to tweak some state and send the events in a 
delayed fashion.

New public function mouseForceClick() and private helper functions to make 
NSEvents.
* WebKitTestRunner/EventSenderProxy.h:

New public function mouseForceClick().
* WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl:
* WebKitTestRunner/InjectedBundle/EventSendingController.cpp:
(WTR::EventSendingController::mouseMoveTo):
(WTR::EventSendingController::mouseForceClick):
(WTR::EventSendingController::mouseForceDown):
* WebKitTestRunner/InjectedBundle/EventSendingController.h:
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::didReceiveSynchronousMessageFromInjectedBundle):

initPressureEventAtLocation needs to take a stageTransition and a window.
* WebKitTestRunner/mac/EventSenderProxy.mm:
(-[EventSenderSyntheticEvent initPressureEventAtLocation:globalLocation:stage:pressure:stageTransition:phase:time:eventNumber:window:]):
(-[EventSenderSyntheticEvent stageTransition]):
(-[EventSenderSyntheticEvent timestamp]):
(-[EventSenderSyntheticEvent _cgsEventRecord]):
(-[EventSenderSyntheticEvent window]):

In order to enter the gesture recognizer, we need to start with a mouse down 
that has a NSEventMaskPressure modifier.
(WTR::EventSenderProxy::sendMouseDownToStartPressureEvents):

This ensures that the events queue properly for the force monitor in AppKit.
(WTR::spinRunLoopForForce):

 We need to start the pressure change events with a began.
(WTR::EventSenderProxy::beginPressureEvent):

These functions can be used to create the NSEvent for a pressure change every 
time we need one.
(WTR::EventSenderProxy::pressureChangeEvent):

Send the right series of events to emulate a full, completed force click.
(WTR::EventSenderProxy::mouseForceClick):

Use all of the new things for these existing functions.
(WTR::EventSenderProxy::mouseForceDown):
(WTR::EventSenderProxy::mouseForceUp):
(WTR::EventSenderProxy::mouseForceChanged):

Set NSFakeForceTouchDevice to YES.
* WebKitTestRunner/mac/main.mm:
(setDefaultsToConsistentValuesForTesting):

LayoutTests:

One new test that tests a regression found during the work for 
http://trac.webkit.org/changeset/181660

* fast/events/force-click-on-link-navigation-expected.txt: Added.
* fast/events/force-click-on-link-navigation.html: Added.
* fast/events/resources/do-not-navigate-here.html: Added.
* platform/efl/TestExpectations:
* platform/gtk/TestExpectations:
* platform/ios-simulator/TestExpectations:
* platform/mac-mavericks/TestExpectations:
* platform/mac-wk1/TestExpectations:
* platform/win/TestExpectations:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsplatformeflTestExpectations">trunk/LayoutTests/platform/efl/TestExpectations</a></li>
<li><a href="#trunkLayoutTestsplatformgtkTestExpectations">trunk/LayoutTests/platform/gtk/TestExpectations</a></li>
<li><a href="#trunkLayoutTestsplatformiossimulatorTestExpectations">trunk/LayoutTests/platform/ios-simulator/TestExpectations</a></li>
<li><a href="#trunkLayoutTestsplatformmacmavericksTestExpectations">trunk/LayoutTests/platform/mac-mavericks/TestExpectations</a></li>
<li><a href="#trunkLayoutTestsplatformmacwk1TestExpectations">trunk/LayoutTests/platform/mac-wk1/TestExpectations</a></li>
<li><a href="#trunkLayoutTestsplatformwinTestExpectations">trunk/LayoutTests/platform/win/TestExpectations</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformspimacNSEventSPIh">trunk/Source/WebCore/platform/spi/mac/NSEventSPI.h</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacWKImmediateActionControllermm">trunk/Source/WebKit2/UIProcess/mac/WKImmediateActionController.mm</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsWebKitTestRunnerEventSenderProxyh">trunk/Tools/WebKitTestRunner/EventSenderProxy.h</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundleBindingsEventSendingControlleridl">trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundleEventSendingControllercpp">trunk/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundleEventSendingControllerh">trunk/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.h</a></li>
<li><a href="#trunkToolsWebKitTestRunnerTestControllercpp">trunk/Tools/WebKitTestRunner/TestController.cpp</a></li>
<li><a href="#trunkToolsWebKitTestRunnermacEventSenderProxymm">trunk/Tools/WebKitTestRunner/mac/EventSenderProxy.mm</a></li>
<li><a href="#trunkToolsWebKitTestRunnermacmainmm">trunk/Tools/WebKitTestRunner/mac/main.mm</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfasteventsforceclickonlinknavigationexpectedtxt">trunk/LayoutTests/fast/events/force-click-on-link-navigation-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfasteventsforceclickonlinknavigationhtml">trunk/LayoutTests/fast/events/force-click-on-link-navigation.html</a></li>
<li><a href="#trunkLayoutTestsfasteventsresourcesdonotnavigateherehtml">trunk/LayoutTests/fast/events/resources/do-not-navigate-here.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (189364 => 189365)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-09-04 18:44:29 UTC (rev 189364)
+++ trunk/LayoutTests/ChangeLog        2015-09-04 18:45:48 UTC (rev 189365)
</span><span class="lines">@@ -1,3 +1,23 @@
</span><ins>+2015-09-04  Beth Dakin  &lt;bdakin@apple.com&gt;
+
+        Need to be able to test default behaviors on force click
+        https://bugs.webkit.org/show_bug.cgi?id=148758
+
+        Reviewed by Tim Horton.
+
+        One new test that tests a regression found during the work for 
+        http://trac.webkit.org/changeset/181660
+
+        * fast/events/force-click-on-link-navigation-expected.txt: Added.
+        * fast/events/force-click-on-link-navigation.html: Added.
+        * fast/events/resources/do-not-navigate-here.html: Added.
+        * platform/efl/TestExpectations:
+        * platform/gtk/TestExpectations:
+        * platform/ios-simulator/TestExpectations:
+        * platform/mac-mavericks/TestExpectations:
+        * platform/mac-wk1/TestExpectations:
+        * platform/win/TestExpectations:
+
</ins><span class="cx"> 2015-09-04  Ryosuke Niwa  &lt;rniwa@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Import new multicolumn layout tests from CSS WG testss
</span></span></pre></div>
<a id="trunkLayoutTestsfasteventsforceclickonlinknavigationexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/events/force-click-on-link-navigation-expected.txt (0 => 189365)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/events/force-click-on-link-navigation-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/events/force-click-on-link-navigation-expected.txt        2015-09-04 18:45:48 UTC (rev 189365)
</span><span class="lines">@@ -0,0 +1,2 @@
</span><ins>+Link
+SUCCESS! We did not navigate to the link after force clicking it.
</ins></span></pre></div>
<a id="trunkLayoutTestsfasteventsforceclickonlinknavigationhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/events/force-click-on-link-navigation.html (0 => 189365)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/events/force-click-on-link-navigation.html                                (rev 0)
+++ trunk/LayoutTests/fast/events/force-click-on-link-navigation.html        2015-09-04 18:45:48 UTC (rev 189365)
</span><span class="lines">@@ -0,0 +1,49 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+&lt;script&gt;
+
+var didNavigate = false;
+
+window.onbeforeunload = function () {
+    didNavigate = true;
+};
+
+function checkForDone()
+{
+    if (!didNavigate) {
+        var console = document.getElementById(&quot;console&quot;);
+        console.innerHTML = &quot;SUCCESS! We did not navigate to the link after force clicking it.&quot;;
+    }
+
+    if (window.testRunner)
+        testRunner.notifyDone();
+}
+
+function spinRunLoop()
+{
+    window.setTimeout(checkForDone, 0);
+}
+
+function startTest()
+{
+    if (window.testRunner) {
+        testRunner.dumpAsText();
+        testRunner.waitUntilDone();
+    }
+
+    if (window.eventSender) {
+        eventSender.mouseMoveTo(16, 16);
+        eventSender.mouseForceClick();
+        window.setTimeout(spinRunLoop, 0);
+    }
+}
+&lt;/script&gt;
+&lt;/head&gt;
+
+&lt;body onload=&quot;startTest()&quot;&gt;
+
+&lt;a href=&quot;resources/do-not-navigate-here.html&quot;&gt;Link&lt;/a&gt;
+&lt;pre id=&quot;console&quot;&gt;Failed. This test must be run in the test harness. To run the test manually, force click on the link and make sure that the original document does not navigate anywhere.&lt;/pre&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfasteventsresourcesdonotnavigateherehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/events/resources/do-not-navigate-here.html (0 => 189365)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/events/resources/do-not-navigate-here.html                                (rev 0)
+++ trunk/LayoutTests/fast/events/resources/do-not-navigate-here.html        2015-09-04 18:45:48 UTC (rev 189365)
</span><span class="lines">@@ -0,0 +1,15 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+&lt;script&gt;
+
+if (window.testRunner) {
+    testRunner.dumpAsText();
+    testRunner.notifyDone();
+}
+
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+Force click tests should not navigate to this page after a successful force click or a started-then-cancelled force click. If navigation occurs, then this test FAILS.
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformeflTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/efl/TestExpectations (189364 => 189365)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/efl/TestExpectations        2015-09-04 18:44:29 UTC (rev 189364)
+++ trunk/LayoutTests/platform/efl/TestExpectations        2015-09-04 18:45:48 UTC (rev 189365)
</span><span class="lines">@@ -69,6 +69,7 @@
</span><span class="cx"> animations/trigger-container-scroll-boundaries.html [ Skip ]
</span><span class="cx"> 
</span><span class="cx"> # No support for force events
</span><ins>+fast/events/force-click-on-link-navigation.html [ Skip ]
</ins><span class="cx"> fast/events/mouse-force-changed.html [ Skip ]
</span><span class="cx"> fast/events/mouse-force-down.html [ Skip ]
</span><span class="cx"> fast/events/mouse-force-up.html [ Skip ]
</span></span></pre></div>
<a id="trunkLayoutTestsplatformgtkTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/gtk/TestExpectations (189364 => 189365)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/gtk/TestExpectations        2015-09-04 18:44:29 UTC (rev 189364)
+++ trunk/LayoutTests/platform/gtk/TestExpectations        2015-09-04 18:45:48 UTC (rev 189365)
</span><span class="lines">@@ -570,6 +570,7 @@
</span><span class="cx"> webkit.org/b/143703 fast/forms/listbox-visible-size.html [ Failure ]
</span><span class="cx"> 
</span><span class="cx"> # No support for force events
</span><ins>+fast/events/force-click-on-link-navigation.html [ Skip ]
</ins><span class="cx"> fast/events/mouse-force-changed.html [ Skip ]
</span><span class="cx"> fast/events/mouse-force-down.html [ Skip ]
</span><span class="cx"> fast/events/mouse-force-up.html [ Skip ]
</span></span></pre></div>
<a id="trunkLayoutTestsplatformiossimulatorTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/ios-simulator/TestExpectations (189364 => 189365)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/ios-simulator/TestExpectations        2015-09-04 18:44:29 UTC (rev 189364)
+++ trunk/LayoutTests/platform/ios-simulator/TestExpectations        2015-09-04 18:45:48 UTC (rev 189365)
</span><span class="lines">@@ -178,6 +178,7 @@
</span><span class="cx"> http/tests/security/drag-over-remote-content-iframe.html
</span><span class="cx"> 
</span><span class="cx"> # No support for force events
</span><ins>+fast/events/force-click-on-link-navigation.html [ Skip ]
</ins><span class="cx"> fast/events/mouse-force-changed.html [ Skip ]
</span><span class="cx"> fast/events/mouse-force-down.html [ Skip ]
</span><span class="cx"> fast/events/mouse-force-up.html [ Skip ]
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacmavericksTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac-mavericks/TestExpectations (189364 => 189365)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac-mavericks/TestExpectations        2015-09-04 18:44:29 UTC (rev 189364)
+++ trunk/LayoutTests/platform/mac-mavericks/TestExpectations        2015-09-04 18:45:48 UTC (rev 189365)
</span><span class="lines">@@ -2,6 +2,7 @@
</span><span class="cx"> http/tests/cache/disk-cache/disk-cache-validation-back-navigation-policy.html
</span><span class="cx"> 
</span><span class="cx"> # No support for force events
</span><ins>+fast/events/force-click-on-link-navigation.html [ Skip ]
</ins><span class="cx"> fast/events/mouse-force-changed.html [ Skip ]
</span><span class="cx"> fast/events/mouse-force-down.html [ Skip ]
</span><span class="cx"> fast/events/mouse-force-up.html [ Skip ]
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacwk1TestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac-wk1/TestExpectations (189364 => 189365)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac-wk1/TestExpectations        2015-09-04 18:44:29 UTC (rev 189364)
+++ trunk/LayoutTests/platform/mac-wk1/TestExpectations        2015-09-04 18:45:48 UTC (rev 189365)
</span><span class="lines">@@ -124,6 +124,7 @@
</span><span class="cx"> http/tests/cache/disk-cache
</span><span class="cx"> 
</span><span class="cx"> # There is not yet support for force events in WK1.
</span><ins>+fast/events/force-click-on-link-navigation.html [ Skip ]
</ins><span class="cx"> fast/events/mouse-force-changed.html [ Skip ]
</span><span class="cx"> fast/events/mouse-force-down.html [ Skip ]
</span><span class="cx"> fast/events/mouse-force-up.html [ Skip ]
</span></span></pre></div>
<a id="trunkLayoutTestsplatformwinTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/win/TestExpectations (189364 => 189365)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/win/TestExpectations        2015-09-04 18:44:29 UTC (rev 189364)
+++ trunk/LayoutTests/platform/win/TestExpectations        2015-09-04 18:45:48 UTC (rev 189365)
</span><span class="lines">@@ -619,6 +619,7 @@
</span><span class="cx"> animations/trigger-container-scroll-boundaries.html [ Skip ]
</span><span class="cx"> 
</span><span class="cx"> # No support for force events
</span><ins>+fast/events/force-click-on-link-navigation.html [ Skip ]
</ins><span class="cx"> fast/events/mouse-force-changed.html [ Skip ]
</span><span class="cx"> fast/events/mouse-force-down.html [ Skip ]
</span><span class="cx"> fast/events/mouse-force-up.html [ Skip ]
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (189364 => 189365)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-09-04 18:44:29 UTC (rev 189364)
+++ trunk/Source/WebCore/ChangeLog        2015-09-04 18:45:48 UTC (rev 189365)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2015-09-04  Beth Dakin  &lt;bdakin@apple.com&gt;
+
+        Need to be able to test default behaviors on force click
+        https://bugs.webkit.org/show_bug.cgi?id=148758
+
+        Reviewed by Tim Horton.
+
+        WKTR needs access to this.
+        * platform/spi/mac/NSEventSPI.h:
+
</ins><span class="cx"> 2015-09-04  Dean Jackson  &lt;dino@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [mediacontrols] Test the ordering of elements in the controls panel
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformspimacNSEventSPIh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/spi/mac/NSEventSPI.h (189364 => 189365)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/spi/mac/NSEventSPI.h        2015-09-04 18:44:29 UTC (rev 189364)
+++ trunk/Source/WebCore/platform/spi/mac/NSEventSPI.h        2015-09-04 18:45:48 UTC (rev 189365)
</span><span class="lines">@@ -39,4 +39,8 @@
</span><span class="cx"> 
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+@interface NSEvent (ForTestRunner)
+- (void)_postDelayed;
+@end
+
</ins><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (189364 => 189365)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2015-09-04 18:44:29 UTC (rev 189364)
+++ trunk/Source/WebKit2/ChangeLog        2015-09-04 18:45:48 UTC (rev 189365)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2015-09-04  Beth Dakin  &lt;bdakin@apple.com&gt;
+
+        Need to be able to test default behaviors on force click
+        https://bugs.webkit.org/show_bug.cgi?id=148758
+
+        Reviewed by Tim Horton.
+
+        The hit test seems to return synchronously in WKTR, so we need to do the hit 
+        test last before we clear state otherwise we will trample the hit test 
+        result.
+        * UIProcess/mac/WKImmediateActionController.mm:
+        (-[WKImmediateActionController immediateActionRecognizerWillPrepare:]):
+        (-[WKImmediateActionController immediateActionRecognizerWillBeginAnimation:]):
+
</ins><span class="cx"> 2015-09-03  Commit Queue  &lt;commit-queue@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed, rolling out r189338.
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacWKImmediateActionControllermm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/WKImmediateActionController.mm (189364 => 189365)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/WKImmediateActionController.mm        2015-09-04 18:44:29 UTC (rev 189364)
+++ trunk/Source/WebKit2/UIProcess/mac/WKImmediateActionController.mm        2015-09-04 18:45:48 UTC (rev 189365)
</span><span class="lines">@@ -173,10 +173,10 @@
</span><span class="cx"> 
</span><span class="cx">     _page-&gt;setMaintainsInactiveSelection(true);
</span><span class="cx"> 
</span><del>-    _page-&gt;performImmediateActionHitTestAtLocation([immediateActionRecognizer locationInView:immediateActionRecognizer.view]);
-
</del><span class="cx">     _state = ImmediateActionState::Pending;
</span><span class="cx">     immediateActionRecognizer.animationController = nil;
</span><ins>+
+    _page-&gt;performImmediateActionHitTestAtLocation([immediateActionRecognizer locationInView:immediateActionRecognizer.view]);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)immediateActionRecognizerWillBeginAnimation:(NSImmediateActionGestureRecognizer *)immediateActionRecognizer
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (189364 => 189365)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2015-09-04 18:44:29 UTC (rev 189364)
+++ trunk/Tools/ChangeLog        2015-09-04 18:45:48 UTC (rev 189365)
</span><span class="lines">@@ -1,3 +1,65 @@
</span><ins>+2015-09-04  Beth Dakin  &lt;bdakin@apple.com&gt;
+
+        Need to be able to test default behaviors on force click
+        https://bugs.webkit.org/show_bug.cgi?id=148758
+
+        Reviewed by Tim Horton.
+
+        This patch adds a new eventSender method to do a full, completed force click, 
+        and it re-works all of the existing force methods to dispatch their events in 
+        such a way that they will trigger the NSImmediateAction gesture recognizer. 
+        To do this, first we need to send the events to the app rather than straight 
+        to the view, and also needed to tweak some state and send the events in a 
+        delayed fashion.
+
+        New public function mouseForceClick() and private helper functions to make 
+        NSEvents.
+        * WebKitTestRunner/EventSenderProxy.h:
+
+        New public function mouseForceClick().
+        * WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl:
+        * WebKitTestRunner/InjectedBundle/EventSendingController.cpp:
+        (WTR::EventSendingController::mouseMoveTo):
+        (WTR::EventSendingController::mouseForceClick):
+        (WTR::EventSendingController::mouseForceDown):
+        * WebKitTestRunner/InjectedBundle/EventSendingController.h:
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::didReceiveSynchronousMessageFromInjectedBundle):
+
+        initPressureEventAtLocation needs to take a stageTransition and a window.
+        * WebKitTestRunner/mac/EventSenderProxy.mm:
+        (-[EventSenderSyntheticEvent initPressureEventAtLocation:globalLocation:stage:pressure:stageTransition:phase:time:eventNumber:window:]):
+        (-[EventSenderSyntheticEvent stageTransition]):
+        (-[EventSenderSyntheticEvent timestamp]):
+        (-[EventSenderSyntheticEvent _cgsEventRecord]):
+        (-[EventSenderSyntheticEvent window]):
+
+        In order to enter the gesture recognizer, we need to start with a mouse down 
+        that has a NSEventMaskPressure modifier.
+        (WTR::EventSenderProxy::sendMouseDownToStartPressureEvents):
+
+        This ensures that the events queue properly for the force monitor in AppKit.
+        (WTR::spinRunLoopForForce):
+
+         We need to start the pressure change events with a began.
+        (WTR::EventSenderProxy::beginPressureEvent):
+
+        These functions can be used to create the NSEvent for a pressure change every 
+        time we need one.
+        (WTR::EventSenderProxy::pressureChangeEvent):
+
+        Send the right series of events to emulate a full, completed force click.
+        (WTR::EventSenderProxy::mouseForceClick):
+
+        Use all of the new things for these existing functions.
+        (WTR::EventSenderProxy::mouseForceDown):
+        (WTR::EventSenderProxy::mouseForceUp):
+        (WTR::EventSenderProxy::mouseForceChanged):
+
+        Set NSFakeForceTouchDevice to YES.
+        * WebKitTestRunner/mac/main.mm:
+        (setDefaultsToConsistentValuesForTesting):
+
</ins><span class="cx"> 2015-09-04  Jason Marcell  &lt;jmarcell@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         prepare-ChangeLog needs to know how to parse Swift files.
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerEventSenderProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/EventSenderProxy.h (189364 => 189365)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/EventSenderProxy.h        2015-09-04 18:44:29 UTC (rev 189364)
+++ trunk/Tools/WebKitTestRunner/EventSenderProxy.h        2015-09-04 18:45:48 UTC (rev 189365)
</span><span class="lines">@@ -29,6 +29,7 @@
</span><span class="cx"> 
</span><span class="cx"> #include &lt;wtf/Deque.h&gt;
</span><span class="cx"> #include &lt;wtf/HashMap.h&gt;
</span><ins>+#include &lt;wtf/RetainPtr.h&gt;
</ins><span class="cx"> #include &lt;wtf/Vector.h&gt;
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(GTK)
</span><span class="lines">@@ -39,6 +40,10 @@
</span><span class="cx"> #include &quot;EWebKit2.h&quot;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if PLATFORM(COCOA)
+OBJC_CLASS NSEvent;
+#endif
+
</ins><span class="cx"> namespace WTR {
</span><span class="cx"> 
</span><span class="cx"> class TestController;
</span><span class="lines">@@ -61,6 +66,7 @@
</span><span class="cx">     void mouseForceDown();
</span><span class="cx">     void mouseForceUp();
</span><span class="cx">     void mouseForceChanged(float);
</span><ins>+    void mouseForceClick();
</ins><span class="cx">     void mouseMoveTo(double x, double y);
</span><span class="cx">     void mouseScrollBy(int x, int y);
</span><span class="cx">     void mouseScrollByWithWheelAndMomentumPhases(int x, int y, int phase, int momentum);
</span><span class="lines">@@ -96,6 +102,14 @@
</span><span class="cx">     void replaySavedEvents();
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+    void sendMouseDownToStartPressureEvents();
+#if PLATFORM(COCOA)
+    enum class PressureChangeDirection { Increasing, Decreasing };
+    RetainPtr&lt;NSEvent&gt; beginPressureEvent(int stage);
+    RetainPtr&lt;NSEvent&gt; pressureChangeEvent(int stage, PressureChangeDirection);
+    RetainPtr&lt;NSEvent&gt; pressureChangeEvent(int stage, float pressure, PressureChangeDirection);
+#endif
+
</ins><span class="cx"> #if PLATFORM(GTK)
</span><span class="cx">     void sendOrQueueEvent(GdkEvent*);
</span><span class="cx">     void dispatchEvent(GdkEvent*);
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundleBindingsEventSendingControlleridl"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl (189364 => 189365)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl        2015-09-04 18:44:29 UTC (rev 189364)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl        2015-09-04 18:45:48 UTC (rev 189365)
</span><span class="lines">@@ -27,6 +27,7 @@
</span><span class="cx">     void mouseDown(long buttonNumber, object modifierArray);
</span><span class="cx">     void mouseUp(long buttonNumber, object modifierArray);
</span><span class="cx">     void mouseMoveTo(long x, long y);
</span><ins>+    void mouseForceClick();
</ins><span class="cx">     void mouseForceDown();
</span><span class="cx">     void mouseForceUp();
</span><span class="cx">     void mouseForceChanged(double force);
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundleEventSendingControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp (189364 => 189365)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp        2015-09-04 18:44:29 UTC (rev 189364)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp        2015-09-04 18:45:48 UTC (rev 189365)
</span><span class="lines">@@ -255,6 +255,18 @@
</span><span class="cx">     WKBundlePagePostSynchronousMessageForTesting(InjectedBundle::singleton().page()-&gt;page(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void EventSendingController::mouseForceClick()
+{
+    WKRetainPtr&lt;WKStringRef&gt; EventSenderMessageName(AdoptWK, WKStringCreateWithUTF8CString(&quot;EventSender&quot;));
+    WKRetainPtr&lt;WKMutableDictionaryRef&gt; EventSenderMessageBody(AdoptWK, WKMutableDictionaryCreate());
+
+    WKRetainPtr&lt;WKStringRef&gt; subMessageKey(AdoptWK, WKStringCreateWithUTF8CString(&quot;SubMessage&quot;));
+    WKRetainPtr&lt;WKStringRef&gt; subMessageName(AdoptWK, WKStringCreateWithUTF8CString(&quot;MouseForceClick&quot;));
+    WKDictionarySetItem(EventSenderMessageBody.get(), subMessageKey.get(), subMessageName.get());
+
+    WKBundlePagePostSynchronousMessageForTesting(InjectedBundle::singleton().page()-&gt;page(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
+}
+
</ins><span class="cx"> void EventSendingController::mouseForceDown()
</span><span class="cx"> {
</span><span class="cx">     WKRetainPtr&lt;WKStringRef&gt; EventSenderMessageName(AdoptWK, WKStringCreateWithUTF8CString(&quot;EventSender&quot;));
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundleEventSendingControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.h (189364 => 189365)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.h        2015-09-04 18:44:29 UTC (rev 189364)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.h        2015-09-04 18:45:48 UTC (rev 189365)
</span><span class="lines">@@ -46,6 +46,7 @@
</span><span class="cx">     void mouseDown(int button, JSValueRef modifierArray);
</span><span class="cx">     void mouseUp(int button, JSValueRef modifierArray);
</span><span class="cx">     void mouseMoveTo(int x, int y);
</span><ins>+    void mouseForceClick();
</ins><span class="cx">     void mouseForceDown();
</span><span class="cx">     void mouseForceUp();
</span><span class="cx">     void mouseForceChanged(double force);
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerTestControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (189364 => 189365)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/TestController.cpp        2015-09-04 18:44:29 UTC (rev 189364)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp        2015-09-04 18:45:48 UTC (rev 189365)
</span><span class="lines">@@ -1211,6 +1211,11 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(MAC)
</span><ins>+        if (WKStringIsEqualToUTF8CString(subMessageName, &quot;MouseForceClick&quot;)) {
+            m_eventSenderProxy-&gt;mouseForceClick();
+            return 0;
+        }
+
</ins><span class="cx">         if (WKStringIsEqualToUTF8CString(subMessageName, &quot;MouseForceDown&quot;)) {
</span><span class="cx">             m_eventSenderProxy-&gt;mouseForceDown();
</span><span class="cx">             return 0;
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnermacEventSenderProxymm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/mac/EventSenderProxy.mm (189364 => 189365)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/mac/EventSenderProxy.mm        2015-09-04 18:44:29 UTC (rev 189364)
+++ trunk/Tools/WebKitTestRunner/mac/EventSenderProxy.mm        2015-09-04 18:45:48 UTC (rev 189365)
</span><span class="lines">@@ -31,6 +31,7 @@
</span><span class="cx"> #import &quot;StringFunctions.h&quot;
</span><span class="cx"> #import &quot;TestController.h&quot;
</span><span class="cx"> #import &lt;Carbon/Carbon.h&gt;
</span><ins>+#import &lt;WebCore/NSEventSPI.h&gt;
</ins><span class="cx"> #import &lt;WebKit/WKString.h&gt;
</span><span class="cx"> #import &lt;WebKit/WKPagePrivate.h&gt;
</span><span class="cx"> #import &lt;WebKit/WKWebView.h&gt;
</span><span class="lines">@@ -68,25 +69,28 @@
</span><span class="cx">     NSPoint _eventSender_location;
</span><span class="cx">     NSInteger _eventSender_stage;
</span><span class="cx">     float _eventSender_pressure;
</span><ins>+    CGFloat _eventSender_stageTransition;
</ins><span class="cx">     NSEventPhase _eventSender_phase;
</span><span class="cx">     NSEventPhase _eventSender_momentumPhase;
</span><span class="cx">     NSTimeInterval _eventSender_timestamp;
</span><span class="cx">     NSInteger _eventSender_eventNumber;
</span><span class="cx">     short _eventSender_subtype;
</span><span class="cx">     NSEventType _eventSender_type;
</span><ins>+    NSWindow *_eventSender_window;
</ins><span class="cx"> 
</span><ins>+
</ins><span class="cx"> #if defined(__LP64__)
</span><span class="cx">     WKTRCGSEventRecord _eventSender_cgsEventRecord;
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (id)initPressureEventAtLocation:(NSPoint)location globalLocation:(NSPoint)globalLocation stage:(NSInteger)stage pressure:(float)pressure phase:(NSEventPhase)phase time:(NSTimeInterval)time eventNumber:(NSInteger)eventNumber;
</del><ins>+- (id)initPressureEventAtLocation:(NSPoint)location globalLocation:(NSPoint)globalLocation stage:(NSInteger)stage pressure:(float)pressure stageTransition:(float)stageTransition phase:(NSEventPhase)phase time:(NSTimeInterval)time eventNumber:(NSInteger)eventNumber window:(NSWindow *)window;
</ins><span class="cx"> - (NSTimeInterval)timestamp;
</span><span class="cx"> @end
</span><span class="cx"> 
</span><span class="cx"> @implementation EventSenderSyntheticEvent
</span><span class="cx"> 
</span><del>-- (id)initPressureEventAtLocation:(NSPoint)location globalLocation:(NSPoint)globalLocation stage:(NSInteger)stage pressure:(float)pressure phase:(NSEventPhase)phase time:(NSTimeInterval)time eventNumber:(NSInteger)eventNumber
</del><ins>+- (id)initPressureEventAtLocation:(NSPoint)location globalLocation:(NSPoint)globalLocation stage:(NSInteger)stage pressure:(float)pressure stageTransition:(float)stageTransition phase:(NSEventPhase)phase time:(NSTimeInterval)time eventNumber:(NSInteger)eventNumber window:(NSWindow *)window
</ins><span class="cx"> {
</span><span class="cx">     self = [super init];
</span><span class="cx"> 
</span><span class="lines">@@ -97,9 +101,11 @@
</span><span class="cx">     _eventSender_locationInWindow = globalLocation;
</span><span class="cx">     _eventSender_stage = stage;
</span><span class="cx">     _eventSender_pressure = pressure;
</span><ins>+    _eventSender_stageTransition = stageTransition;
</ins><span class="cx">     _eventSender_phase = phase;
</span><span class="cx">     _eventSender_timestamp = time;
</span><span class="cx">     _eventSender_eventNumber = eventNumber;
</span><ins>+    _eventSender_window = window;
</ins><span class="cx"> #if defined(__LP64__) &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101003
</span><span class="cx">     _eventSender_type = NSEventTypePressure;
</span><span class="cx"> #endif
</span><span class="lines">@@ -107,6 +113,11 @@
</span><span class="cx">     return self;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+- (CGFloat)stageTransition
+{
+    return _eventSender_stageTransition;
+}
+
</ins><span class="cx"> - (NSTimeInterval)timestamp
</span><span class="cx"> {
</span><span class="cx">     return _eventSender_timestamp;
</span><span class="lines">@@ -176,6 +187,11 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+- (NSWindow *)window
+{
+    return _eventSender_window;
+}
+
</ins><span class="cx"> @end
</span><span class="cx"> 
</span><span class="cx"> namespace WTR {
</span><span class="lines">@@ -350,33 +366,95 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if defined(__LP64__) &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101003
</span><del>-void EventSenderProxy::mouseForceDown()
</del><ins>+void EventSenderProxy::sendMouseDownToStartPressureEvents()
</ins><span class="cx"> {
</span><del>-    EventSenderSyntheticEvent *firstEvent = [[EventSenderSyntheticEvent alloc] initPressureEventAtLocation:NSMakePoint(m_position.x, m_position.y)
</del><ins>+    updateClickCountForButton(0);
+
+    NSEvent *event = [NSEvent mouseEventWithType:NSLeftMouseDown
+        location:NSMakePoint(m_position.x, m_position.y)
+        modifierFlags:NSEventMaskPressure
+        timestamp:absoluteTimeForEventTime(currentEventTime())
+        windowNumber:[m_testController-&gt;mainWebView()-&gt;platformWindow() windowNumber]
+        context:[NSGraphicsContext currentContext]
+        eventNumber:++eventNumber
+        clickCount:m_clickCount
+        pressure:0.0];
+
+    [NSApp sendEvent:event];
+}
+
+static void handleForceEventSynchronously(NSEvent *event)
+{
+    // Force events have to be pushed onto the queue, then popped off right away and handled synchronously in order
+    // to get the NSImmediateActionGestureRecognizer to do the right thing.
+    [event _postDelayed];
+    [NSApp sendEvent:[NSApp nextEventMatchingMask:NSEventMaskPressure untilDate:[NSDate dateWithTimeIntervalSinceNow:0.05] inMode:NSDefaultRunLoopMode dequeue:YES]];
+}
+
+RetainPtr&lt;NSEvent&gt; EventSenderProxy::beginPressureEvent(int stage)
+{
+    RetainPtr&lt;EventSenderSyntheticEvent&gt; event = adoptNS([[EventSenderSyntheticEvent alloc] initPressureEventAtLocation:NSMakePoint(m_position.x, m_position.y)
</ins><span class="cx">         globalLocation:([m_testController-&gt;mainWebView()-&gt;platformWindow() convertRectToScreen:NSMakeRect(m_position.x, m_position.y, 1, 1)].origin)
</span><del>-        stage:1
-        pressure:0.9
-        phase:NSEventPhaseChanged
</del><ins>+        stage:stage
+        pressure:0.5
+        stageTransition:0
+        phase:NSEventPhaseBegan
</ins><span class="cx">         time:absoluteTimeForEventTime(currentEventTime())
</span><del>-        eventNumber:++eventNumber];
-    EventSenderSyntheticEvent *secondEvent = [[EventSenderSyntheticEvent alloc] initPressureEventAtLocation:NSMakePoint(m_position.x, m_position.y)
</del><ins>+        eventNumber:++eventNumber
+        window:[m_testController-&gt;mainWebView()-&gt;platformView() window]]);
+
+    return event;
+}
+
+RetainPtr&lt;NSEvent&gt; EventSenderProxy::pressureChangeEvent(int stage, float pressure, EventSenderProxy::PressureChangeDirection direction)
+{
+    RetainPtr&lt;EventSenderSyntheticEvent&gt; event = adoptNS([[EventSenderSyntheticEvent alloc] initPressureEventAtLocation:NSMakePoint(m_position.x, m_position.y)
</ins><span class="cx">         globalLocation:([m_testController-&gt;mainWebView()-&gt;platformWindow() convertRectToScreen:NSMakeRect(m_position.x, m_position.y, 1, 1)].origin)
</span><del>-        stage:2
-        pressure:0.1
</del><ins>+        stage:stage
+        pressure:pressure
+        stageTransition:direction == PressureChangeDirection::Increasing ? 0.5 : -0.5
</ins><span class="cx">         phase:NSEventPhaseChanged
</span><span class="cx">         time:absoluteTimeForEventTime(currentEventTime())
</span><del>-        eventNumber:++eventNumber];
</del><ins>+        eventNumber:++eventNumber
+        window:[m_testController-&gt;mainWebView()-&gt;platformView() window]]);
</ins><span class="cx"> 
</span><del>-    NSView *targetView = [m_testController-&gt;mainWebView()-&gt;platformView() hitTest:[firstEvent locationInWindow]];
</del><ins>+    return event;
+}
+
+RetainPtr&lt;NSEvent&gt; EventSenderProxy::pressureChangeEvent(int stage, EventSenderProxy::PressureChangeDirection direction)
+{
+    return pressureChangeEvent(stage, 0.5, direction);
+}
+
+void EventSenderProxy::mouseForceClick()
+{
+    sendMouseDownToStartPressureEvents();
+
+    RetainPtr&lt;NSEvent&gt; beginPressure = beginPressureEvent(1);
+    RetainPtr&lt;NSEvent&gt; preForceClick = pressureChangeEvent(1, PressureChangeDirection::Increasing);
+    RetainPtr&lt;NSEvent&gt; forceClick = pressureChangeEvent(2, PressureChangeDirection::Increasing);
+    RetainPtr&lt;NSEvent&gt; releasingPressure = pressureChangeEvent(1, PressureChangeDirection::Decreasing);
+    NSEvent *mouseUp = [NSEvent mouseEventWithType:NSLeftMouseUp
+        location:NSMakePoint(m_position.x, m_position.y)
+        modifierFlags:0
+        timestamp:absoluteTimeForEventTime(currentEventTime())
+        windowNumber:[m_testController-&gt;mainWebView()-&gt;platformWindow() windowNumber]
+        context:[NSGraphicsContext currentContext]
+        eventNumber:++eventNumber
+        clickCount:m_clickCount
+        pressure:0.0];
+
+    NSView *targetView = [m_testController-&gt;mainWebView()-&gt;platformView() hitTest:[preForceClick.get() locationInWindow]];
</ins><span class="cx">     targetView = targetView ? targetView : m_testController-&gt;mainWebView()-&gt;platformView();
</span><span class="cx">     ASSERT(targetView);
</span><span class="cx"> 
</span><span class="cx">     // Since AppKit does not implement forceup/down as mouse events, we need to send two pressure events to detect
</span><span class="cx">     // the change in stage that marks those moments.
</span><del>-    [NSApp _setCurrentEvent:firstEvent];
-    [targetView pressureChangeWithEvent:firstEvent];
-    [NSApp _setCurrentEvent:secondEvent];
-    [targetView pressureChangeWithEvent:secondEvent];
</del><ins>+    handleForceEventSynchronously(beginPressure.get());
+    handleForceEventSynchronously(preForceClick.get());
+    handleForceEventSynchronously(forceClick.get());
+    handleForceEventSynchronously(releasingPressure.get());
+    [NSApp sendEvent:mouseUp];
</ins><span class="cx"> 
</span><span class="cx">     [NSApp _setCurrentEvent:nil];
</span><span class="cx"> #pragma clang diagnostic push
</span><span class="lines">@@ -384,77 +462,102 @@
</span><span class="cx">     // WKView caches the most recent pressure event, so send it a nil event to clear the cache.
</span><span class="cx">     [targetView pressureChangeWithEvent:nil];
</span><span class="cx"> #pragma clang diagnostic pop
</span><del>-
-    [firstEvent release];
-    [secondEvent release];
</del><span class="cx"> }
</span><span class="cx"> 
</span><del>-void EventSenderProxy::mouseForceUp()
</del><ins>+void EventSenderProxy::mouseForceDown()
</ins><span class="cx"> {
</span><del>-    EventSenderSyntheticEvent *firstEvent = [[EventSenderSyntheticEvent alloc] initPressureEventAtLocation:NSMakePoint(m_position.x, m_position.y)
-        globalLocation:([m_testController-&gt;mainWebView()-&gt;platformWindow() convertRectToScreen:NSMakeRect(m_position.x, m_position.y, 1, 1)].origin)
-        stage:2
-        pressure:0.1
-        phase:NSEventPhaseChanged
-        time:absoluteTimeForEventTime(currentEventTime())
-        eventNumber:++eventNumber];
-    EventSenderSyntheticEvent *secondEvent = [[EventSenderSyntheticEvent alloc] initPressureEventAtLocation:NSMakePoint(m_position.x, m_position.y)
-        globalLocation:([m_testController-&gt;mainWebView()-&gt;platformWindow() convertRectToScreen:NSMakeRect(m_position.x, m_position.y, 1, 1)].origin)
-        stage:1
-        pressure:0.9
-        phase:NSEventPhaseChanged
-        time:absoluteTimeForEventTime(currentEventTime())
-        eventNumber:++eventNumber];
</del><ins>+    sendMouseDownToStartPressureEvents();
</ins><span class="cx"> 
</span><del>-    NSView *targetView = [m_testController-&gt;mainWebView()-&gt;platformView() hitTest:[firstEvent locationInWindow]];
</del><ins>+    RetainPtr&lt;NSEvent&gt; beginPressure = beginPressureEvent(1);
+    RetainPtr&lt;NSEvent&gt; preForceClick = pressureChangeEvent(1, PressureChangeDirection::Increasing);
+    RetainPtr&lt;NSEvent&gt; forceMouseDown = pressureChangeEvent(2, PressureChangeDirection::Increasing);
+
+    NSView *targetView = [m_testController-&gt;mainWebView()-&gt;platformView() hitTest:[beginPressure locationInWindow]];
</ins><span class="cx">     targetView = targetView ? targetView : m_testController-&gt;mainWebView()-&gt;platformView();
</span><span class="cx">     ASSERT(targetView);
</span><span class="cx"> 
</span><span class="cx">     // Since AppKit does not implement forceup/down as mouse events, we need to send two pressure events to detect
</span><span class="cx">     // the change in stage that marks those moments.
</span><del>-    [NSApp _setCurrentEvent:firstEvent];
-    [targetView pressureChangeWithEvent:firstEvent];
-    [NSApp _setCurrentEvent:secondEvent];
-    [targetView pressureChangeWithEvent:secondEvent];
</del><ins>+    handleForceEventSynchronously(beginPressure.get());
+    handleForceEventSynchronously(preForceClick.get());
+    [forceMouseDown _postDelayed];
</ins><span class="cx"> 
</span><span class="cx">     [NSApp _setCurrentEvent:nil];
</span><ins>+#pragma clang diagnostic push
+#pragma clang diagnostic ignored &quot;-Wnonnull&quot;
+    // WKView caches the most recent pressure event, so send it a nil event to clear the cache.
+    [targetView pressureChangeWithEvent:nil];
+#pragma clang diagnostic pop
+}
</ins><span class="cx"> 
</span><ins>+void EventSenderProxy::mouseForceUp()
+{
+    RetainPtr&lt;NSEvent&gt; beginPressure = beginPressureEvent(2);
+    RetainPtr&lt;NSEvent&gt; stageTwoEvent = pressureChangeEvent(2, PressureChangeDirection::Decreasing);
+    RetainPtr&lt;NSEvent&gt; stageOneEvent = pressureChangeEvent(1, PressureChangeDirection::Decreasing);
+
+    // Since AppKit does not implement forceup/down as mouse events, we need to send two pressure events to detect
+    // the change in stage that marks those moments.
+    [NSApp sendEvent:beginPressure.get()];
+    [NSApp sendEvent:stageTwoEvent.get()];
+    [NSApp sendEvent:stageOneEvent.get()];
+
+    NSView *targetView = [m_testController-&gt;mainWebView()-&gt;platformView() hitTest:[beginPressure locationInWindow]];
+    targetView = targetView ? targetView : m_testController-&gt;mainWebView()-&gt;platformView();
+    ASSERT(targetView);
+
+    [NSApp _setCurrentEvent:nil];
+
</ins><span class="cx"> #pragma clang diagnostic push
</span><span class="cx"> #pragma clang diagnostic ignored &quot;-Wnonnull&quot;
</span><span class="cx"> // WKView caches the most recent pressure event, so send it a nil event to clear the cache.
</span><span class="cx">     [targetView pressureChangeWithEvent:nil];
</span><span class="cx"> #pragma clang diagnostic pop
</span><del>-
-    [firstEvent release];
-    [secondEvent release];
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void EventSenderProxy::mouseForceChanged(float force)
</span><span class="cx"> {
</span><del>-    EventSenderSyntheticEvent *event = [[EventSenderSyntheticEvent alloc] initPressureEventAtLocation:NSMakePoint(m_position.x, m_position.y)
-        globalLocation:([m_testController-&gt;mainWebView()-&gt;platformWindow() convertRectToScreen:NSMakeRect(m_position.x, m_position.y, 1, 1)].origin)
-        stage:force &lt; 1 ? 1 : 2
-        pressure:force
-        phase:NSEventPhaseChanged
-        time:absoluteTimeForEventTime(currentEventTime())
-        eventNumber:++eventNumber];
</del><ins>+    int stage = force &lt; 1 ? 1 : 2;
+    float pressure = force &lt; 1 ? force : force - 1;
+    RetainPtr&lt;NSEvent&gt; beginPressure = beginPressureEvent(stage);
+    RetainPtr&lt;NSEvent&gt; pressureChangedEvent = pressureChangeEvent(stage, pressure, PressureChangeDirection::Increasing);
</ins><span class="cx"> 
</span><del>-    NSView *targetView = [m_testController-&gt;mainWebView()-&gt;platformView() hitTest:[event locationInWindow]];
</del><ins>+    NSView *targetView = [m_testController-&gt;mainWebView()-&gt;platformView() hitTest:[beginPressure locationInWindow]];
</ins><span class="cx">     targetView = targetView ? targetView : m_testController-&gt;mainWebView()-&gt;platformView();
</span><span class="cx">     ASSERT(targetView);
</span><del>-    [NSApp _setCurrentEvent:event];
-    [targetView pressureChangeWithEvent:event];
-    [NSApp _setCurrentEvent:nil];
</del><span class="cx"> 
</span><ins>+    [NSApp sendEvent:beginPressure.get()];
+    [NSApp sendEvent:pressureChangedEvent.get()];
+
</ins><span class="cx"> #pragma clang diagnostic push
</span><span class="cx"> #pragma clang diagnostic ignored &quot;-Wnonnull&quot;
</span><span class="cx">     // WKView caches the most recent pressure event, so send it a nil event to clear the cache.
</span><span class="cx">     [targetView pressureChangeWithEvent:nil];
</span><span class="cx"> #pragma clang diagnostic pop
</span><ins>+}
+#else
</ins><span class="cx"> 
</span><del>-    [event release];
</del><ins>+#if PLATFORM(COCOA)
+RetainPtr&lt;NSEvent&gt; EventSenderProxy::beginPressureEvent(int)
+{
+    return nil;
</ins><span class="cx"> }
</span><del>-#else
</del><ins>+
+RetainPtr&lt;NSEvent&gt; EventSenderProxy::pressureChangeEvent(int, PressureChangeDirection)
+{
+    return nil;
+}
+
+RetainPtr&lt;NSEvent&gt; EventSenderProxy::pressureChangeEvent(int, float, PressureChangeDirection)
+{
+    return nil;
+}
+#endif // PLATFORM(COCOA)
+
+void EventSenderProxy::sendMouseDownToStartPressureEvents()
+{
+}
+
</ins><span class="cx"> void EventSenderProxy::mouseForceDown()
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="lines">@@ -466,6 +569,10 @@
</span><span class="cx"> void EventSenderProxy::mouseForceChanged(float)
</span><span class="cx"> {
</span><span class="cx"> }
</span><ins>+
+void EventSenderProxy::mouseForceClick()
+{
+}
</ins><span class="cx"> #endif // defined(__LP64__) &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101003
</span><span class="cx"> 
</span><span class="cx"> void EventSenderProxy::mouseMoveTo(double x, double y)
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnermacmainmm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/mac/main.mm (189364 => 189365)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/mac/main.mm        2015-09-04 18:44:29 UTC (rev 189364)
+++ trunk/Tools/WebKitTestRunner/mac/main.mm        2015-09-04 18:45:48 UTC (rev 189365)
</span><span class="lines">@@ -33,7 +33,8 @@
</span><span class="cx">         @&quot;AppleKeyboardUIMode&quot;: @1,
</span><span class="cx">         // FIXME: This is likely insufficient, as tests change (and don't reset) these settings via Internals.
</span><span class="cx">         @&quot;WebAutomaticQuoteSubstitutionEnabled&quot;: @NO,
</span><del>-        @&quot;WebAutomaticDashSubstitutionEnabled&quot;: @NO
</del><ins>+        @&quot;WebAutomaticDashSubstitutionEnabled&quot;: @NO,
+        @&quot;NSFakeForceTouchDevice&quot; : @YES
</ins><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx">     [[NSUserDefaults standardUserDefaults] setValuesForKeysWithDictionary:dict];
</span></span></pre>
</div>
</div>

</body>
</html>