Title: [182912] trunk
Revision
182912
Author
bda...@apple.com
Date
2015-04-16 15:18:35 -0700 (Thu, 16 Apr 2015)

Log Message

Force mouse events should go through normal mouse event handling code paths
https://bugs.webkit.org/show_bug.cgi?id=143749
-and corresponding-
rdar://problem/20472895

Reviewed by Dean Jackson.

Source/WebCore:

This patch moves all of the code to dispatch mouseforcedown, mouseforceup, and 
mouseforcechanged into normal mouse event dispatching code. This patch leaves 
behind the cancel and click events because we plan to remove those, and it also 
leaves mouseforcewillbegin because that is necessarily a very different event more 
tied to the NSImmediateActionGestureRecognizer than these other events which are 
tied to NSResponder’s pressureChangeWithEvent.

New helper functions.
* dom/Document.cpp:
(WebCore::Document::hasListenerTypeForEventType):
* dom/Document.h:
* dom/Element.cpp:
(WebCore::isForceEvent):

Move the code to ensure the force events have listeners in order to fire to 
dispatchMouseEvent, and delete the old implementations.
(WebCore::Element::dispatchMouseEvent):
(WebCore::Element::dispatchMouseForceChanged): Deleted.
(WebCore::Element::dispatchMouseForceDown): Deleted.
(WebCore::Element::dispatchMouseForceUp): Deleted.
* dom/Element.h:

Perform a hit test and pipe the events through dispatchMouseEvent(). 
* page/EventHandler.cpp:
(WebCore::EventHandler::handleMouseForceEvent):
* page/EventHandler.h:

New types for the new events.
* platform/PlatformEvent.h:

Forward to EventHandler. 
* replay/UserInputBridge.cpp:
(WebCore::UserInputBridge::handleMouseForceEvent):
* replay/UserInputBridge.h:

Source/WebKit2:

This patch makes pressureChangeWithEvent create NativeWebMouseEvents with the 
NSEventTypePressures that is gets and sends those down to the web process.

Re-name pressureEvent to lastPressureEvent. Now that event can sometimes be an 
NSEventTypePressure, the new name makes it clear how the second parameter differs 
from the first.
* Shared/NativeWebMouseEvent.h:

New event types for the new types of events.
* Shared/WebEvent.h:
* Shared/WebEventConversion.cpp:
(WebKit::WebKit2PlatformMouseEvent::WebKit2PlatformMouseEvent):
* Shared/mac/NativeWebMouseEventMac.mm:
(WebKit::NativeWebMouseEvent::NativeWebMouseEvent):
* Shared/mac/WebEventFactory.h:

All of the square-peg, round-hole problems of massaging the NSEventTypePressures 
events into WebMouseEvents is taken care of here.
* Shared/mac/WebEventFactory.mm:
(WebKit::mouseButtonForEvent):
(WebKit::globalPointForEvent):
(WebKit::pointForEvent):
(WebKit::WebEventFactory::createWebMouseEvent):

Instead of calling the old inputDeviceForceDidChange, create a NativeWebMouseEvent 
and handle it.
* UIProcess/API/mac/WKView.mm:
(-[WKView pressureChangeWithEvent:]):

Handle the new types.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didReceiveEvent):

Can delete inputDeviceForceDidChange since it’s no longer used.
(WebKit::WebPageProxy::inputDeviceForceDidChange): Deleted.
* UIProcess/WebPageProxy.h:

Handle the new types of mouse events properly.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::handleMouseEvent):

Delete inputDeviceForceDidChange() and m_lastForceStage.
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::inputDeviceForceDidChange): Deleted.

Handle new WebEvent types.
* WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp:

Tools:

Add mouseForceDown/mouseForceUp/mouseForceChanged support to WebKitTestRunner. 
Since there is not a way to create an NSEventTypePressure from scratch, we 
subclass NSEvent and override all of the critical methods.

* WebKitTestRunner/EventSenderProxy.h:
* WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl:
* WebKitTestRunner/InjectedBundle/EventSendingController.cpp:
(WTR::EventSendingController::mouseForceDown):
(WTR::EventSendingController::mouseForceUp):
(WTR::EventSendingController::mouseForceChanged):
* WebKitTestRunner/InjectedBundle/EventSendingController.h:
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::didReceiveSynchronousMessageFromInjectedBundle):
* WebKitTestRunner/mac/EventSenderProxy.mm:
(-[EventSenderPressureEvent initAtLocation:globalLocation:stage:pressure:phase:time:eventNumber:]):
(-[EventSenderPressureEvent timestamp]):
(-[EventSenderPressureEvent type]):
(-[EventSenderPressureEvent locationInWindow]):
(-[EventSenderPressureEvent location]):
(-[EventSenderPressureEvent stage]):
(-[EventSenderPressureEvent pressure]):
(-[EventSenderPressureEvent phase]):
(-[EventSenderPressureEvent eventNumber]):
(WTR::EventSenderProxy::mouseForceDown):
(WTR::EventSenderProxy::mouseForceUp):
(WTR::EventSenderProxy::mouseForceChanged):

LayoutTests:

Just a few new tests. More to come.
* fast/events/mouse-force-changed-expected.txt: Added.
* fast/events/mouse-force-changed.html: Added.
* fast/events/mouse-force-down-expected.txt: Added.
* fast/events/mouse-force-down.html: Added.
* fast/events/mouse-force-up-expected.txt: Added.
* fast/events/mouse-force-up.html: Added.

Right now the new tests will only work on Mac 10.10.3 and beyond.
* platform/efl/TestExpectations:
* platform/gtk/TestExpectations:
* platform/ios-simulator/TestExpectations:
* platform/mac-mavericks/TestExpectations:
* platform/win/TestExpectations:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (182911 => 182912)


--- trunk/LayoutTests/ChangeLog	2015-04-16 21:35:30 UTC (rev 182911)
+++ trunk/LayoutTests/ChangeLog	2015-04-16 22:18:35 UTC (rev 182912)
@@ -1,3 +1,27 @@
+2015-04-16  Beth Dakin  <bda...@apple.com>
+
+        Force mouse events should go through normal mouse event handling code paths
+        https://bugs.webkit.org/show_bug.cgi?id=143749
+        -and corresponding-
+        rdar://problem/20472895
+
+        Reviewed by Dean Jackson.
+
+        Just a few new tests. More to come.
+        * fast/events/mouse-force-changed-expected.txt: Added.
+        * fast/events/mouse-force-changed.html: Added.
+        * fast/events/mouse-force-down-expected.txt: Added.
+        * fast/events/mouse-force-down.html: Added.
+        * fast/events/mouse-force-up-expected.txt: Added.
+        * fast/events/mouse-force-up.html: Added.
+
+        Right now the new tests will only work on Mac 10.10.3 and beyond.
+        * platform/efl/TestExpectations:
+        * platform/gtk/TestExpectations:
+        * platform/ios-simulator/TestExpectations:
+        * platform/mac-mavericks/TestExpectations:
+        * platform/win/TestExpectations:
+
 2015-04-16  Chris Dumez  <cdu...@apple.com>
 
         Regression(r182517): WebSocket::suspend() causes error event to be fired

Added: trunk/LayoutTests/fast/events/mouse-force-changed-expected.txt (0 => 182912)


--- trunk/LayoutTests/fast/events/mouse-force-changed-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/events/mouse-force-changed-expected.txt	2015-04-16 22:18:35 UTC (rev 182912)
@@ -0,0 +1 @@
+Success! The mouseforcechanged event was dispatched.

Added: trunk/LayoutTests/fast/events/mouse-force-changed.html (0 => 182912)


--- trunk/LayoutTests/fast/events/mouse-force-changed.html	                        (rev 0)
+++ trunk/LayoutTests/fast/events/mouse-force-changed.html	2015-04-16 22:18:35 UTC (rev 182912)
@@ -0,0 +1,43 @@
+<html>
+<head>
+<style>
+#forceSensor {
+    width: 200px;
+    height: 200px;
+    border: 2px solid black;
+}
+</style>
+<script>
+
+function forceChanged()
+{
+    var console = document.getElementById("console");
+    console.innerHTML = "Success! The mouseforcechanged event was dispatched.";
+    testRunner.notifyDone();
+}
+
+function startTest()
+{
+    var forceSensor = document.getElementById("forceSensor");
+    forceSensor.addEventListener("webkitmouseforcechanged", forceChanged, false);
+
+    if (window.testRunner) {
+        testRunner.dumpAsText();
+        testRunner.waitUntilDone();
+    }
+
+    if (window.eventSender) {
+        eventSender.mouseMoveTo(100, 100);
+        eventSender.mouseForceChanged(1.5);
+    }
+}
+</script>
+</head>
+
+<body _onload_="startTest()">
+
+<div id="forceSensor"></div>
+<pre id="console">Failed. This test must be run in the test harness.</pre>
+
+</body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/fast/events/mouse-force-down-expected.txt (0 => 182912)


--- trunk/LayoutTests/fast/events/mouse-force-down-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/events/mouse-force-down-expected.txt	2015-04-16 22:18:35 UTC (rev 182912)
@@ -0,0 +1 @@
+Success! The mouseforcedown event was dispatched.

Added: trunk/LayoutTests/fast/events/mouse-force-down.html (0 => 182912)


--- trunk/LayoutTests/fast/events/mouse-force-down.html	                        (rev 0)
+++ trunk/LayoutTests/fast/events/mouse-force-down.html	2015-04-16 22:18:35 UTC (rev 182912)
@@ -0,0 +1,43 @@
+<html>
+<head>
+<style>
+#forceSensor {
+    width: 200px;
+    height: 200px;
+    border: 2px solid black;
+}
+</style>
+<script>
+
+function forceDown()
+{
+    var console = document.getElementById("console");
+    console.innerHTML = "Success! The mouseforcedown event was dispatched.";
+    testRunner.notifyDone();
+}
+
+function startTest()
+{
+    var forceSensor = document.getElementById("forceSensor");
+    forceSensor.addEventListener("webkitmouseforcedown", forceDown, false);
+
+    if (window.testRunner) {
+        testRunner.dumpAsText();
+        testRunner.waitUntilDone();
+    }
+
+    if (window.eventSender) {
+        eventSender.mouseMoveTo(100, 100);
+        eventSender.mouseForceDown();
+    }
+}
+</script>
+</head>
+
+<body _onload_="startTest()">
+
+<div id="forceSensor"></div>
+<pre id="console">Failed. This test must be run in the test harness.</pre>
+
+</body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/fast/events/mouse-force-up-expected.txt (0 => 182912)


--- trunk/LayoutTests/fast/events/mouse-force-up-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/events/mouse-force-up-expected.txt	2015-04-16 22:18:35 UTC (rev 182912)
@@ -0,0 +1 @@
+Success! The mouseforceup event was dispatched.

Added: trunk/LayoutTests/fast/events/mouse-force-up.html (0 => 182912)


--- trunk/LayoutTests/fast/events/mouse-force-up.html	                        (rev 0)
+++ trunk/LayoutTests/fast/events/mouse-force-up.html	2015-04-16 22:18:35 UTC (rev 182912)
@@ -0,0 +1,44 @@
+<html>
+<head>
+<style>
+#forceSensor {
+    width: 200px;
+    height: 200px;
+    border: 2px solid black;
+}
+</style>
+<script>
+
+function forceUp()
+{
+    var console = document.getElementById("console");
+    console.innerHTML = "Success! The mouseforceup event was dispatched.";
+    testRunner.notifyDone();
+}
+
+function startTest()
+{
+    var forceSensor = document.getElementById("forceSensor");
+    forceSensor.addEventListener("webkitmouseforceup", forceUp, false);
+
+    if (window.testRunner) {
+        testRunner.dumpAsText();
+        testRunner.waitUntilDone();
+    }
+
+    if (window.eventSender) {
+        eventSender.mouseMoveTo(100, 100);
+        eventSender.mouseForceDown();
+        eventSender.mouseForceUp();
+    }
+}
+</script>
+</head>
+
+<body _onload_="startTest()">
+
+<div id="forceSensor"></div>
+<pre id="console">Failed. This test must be run in the test harness.</pre>
+
+</body>
+</html>
\ No newline at end of file

Modified: trunk/LayoutTests/platform/efl/TestExpectations (182911 => 182912)


--- trunk/LayoutTests/platform/efl/TestExpectations	2015-04-16 21:35:30 UTC (rev 182911)
+++ trunk/LayoutTests/platform/efl/TestExpectations	2015-04-16 22:18:35 UTC (rev 182912)
@@ -68,6 +68,11 @@
 animations/trigger-container-scroll-simple.html [ Skip ]
 animations/trigger-container-scroll-boundaries.html [ Skip ]
 
+# No support for force events
+fast/events/mouse-force-changed.html [ Skip ]
+fast/events/mouse-force-down.html [ Skip ]
+fast/events/mouse-force-up.html [ Skip ]
+
 # ----------------------------------------
 # Tests which also fail in other platforms
 # ----------------------------------------

Modified: trunk/LayoutTests/platform/gtk/TestExpectations (182911 => 182912)


--- trunk/LayoutTests/platform/gtk/TestExpectations	2015-04-16 21:35:30 UTC (rev 182911)
+++ trunk/LayoutTests/platform/gtk/TestExpectations	2015-04-16 22:18:35 UTC (rev 182912)
@@ -638,6 +638,11 @@
 
 webkit.org/b/143703 fast/forms/listbox-visible-size.html [ Failure ]
 
+# No support for force events
+fast/events/mouse-force-changed.html [ Skip ]
+fast/events/mouse-force-down.html [ Skip ]
+fast/events/mouse-force-up.html [ Skip ]
+
 #////////////////////////////////////////////////////////////////////////////////////////
 # End of Expected failures
 #////////////////////////////////////////////////////////////////////////////////////////

Modified: trunk/LayoutTests/platform/ios-simulator/TestExpectations (182911 => 182912)


--- trunk/LayoutTests/platform/ios-simulator/TestExpectations	2015-04-16 21:35:30 UTC (rev 182911)
+++ trunk/LayoutTests/platform/ios-simulator/TestExpectations	2015-04-16 22:18:35 UTC (rev 182912)
@@ -204,6 +204,11 @@
 http/tests/local/fileapi/send-dragged-file.html
 http/tests/local/fileapi/send-sliced-dragged-file.html
 
+# No support for force events
+fast/events/mouse-force-changed.html [ Skip ]
+fast/events/mouse-force-down.html [ Skip ]
+fast/events/mouse-force-up.html [ Skip ]
+
 ###
 # Known failures
 ##

Modified: trunk/LayoutTests/platform/mac-mavericks/TestExpectations (182911 => 182912)


--- trunk/LayoutTests/platform/mac-mavericks/TestExpectations	2015-04-16 21:35:30 UTC (rev 182911)
+++ trunk/LayoutTests/platform/mac-mavericks/TestExpectations	2015-04-16 22:18:35 UTC (rev 182912)
@@ -1,2 +1,7 @@
 # https://bugs.webkit.org/show_bug.cgi?id=143258
 http/tests/cache/disk-cache/disk-cache-validation-back-navigation-policy.html
+
+# No support for force events
+fast/events/mouse-force-changed.html [ Skip ]
+fast/events/mouse-force-down.html [ Skip ]
+fast/events/mouse-force-up.html [ Skip ]

Modified: trunk/LayoutTests/platform/win/TestExpectations (182911 => 182912)


--- trunk/LayoutTests/platform/win/TestExpectations	2015-04-16 21:35:30 UTC (rev 182911)
+++ trunk/LayoutTests/platform/win/TestExpectations	2015-04-16 22:18:35 UTC (rev 182912)
@@ -603,6 +603,11 @@
 animations/trigger-container-scroll-simple.html [ Skip ]
 animations/trigger-container-scroll-boundaries.html [ Skip ]
 
+# No support for force events
+fast/events/mouse-force-changed.html [ Skip ]
+fast/events/mouse-force-down.html [ Skip ]
+fast/events/mouse-force-up.html [ Skip ]
+
 ################################################################################
 ###########    End Missing Functionality Prevents Testing         ##############
 ################################################################################

Modified: trunk/Source/WebCore/ChangeLog (182911 => 182912)


--- trunk/Source/WebCore/ChangeLog	2015-04-16 21:35:30 UTC (rev 182911)
+++ trunk/Source/WebCore/ChangeLog	2015-04-16 22:18:35 UTC (rev 182912)
@@ -1,3 +1,47 @@
+2015-04-16  Beth Dakin  <bda...@apple.com>
+
+        Force mouse events should go through normal mouse event handling code paths
+        https://bugs.webkit.org/show_bug.cgi?id=143749
+        -and corresponding-
+        rdar://problem/20472895
+
+        Reviewed by Dean Jackson.
+
+        This patch moves all of the code to dispatch mouseforcedown, mouseforceup, and 
+        mouseforcechanged into normal mouse event dispatching code. This patch leaves 
+        behind the cancel and click events because we plan to remove those, and it also 
+        leaves mouseforcewillbegin because that is necessarily a very different event more 
+        tied to the NSImmediateActionGestureRecognizer than these other events which are 
+        tied to NSResponder’s pressureChangeWithEvent.
+
+        New helper functions.
+        * dom/Document.cpp:
+        (WebCore::Document::hasListenerTypeForEventType):
+        * dom/Document.h:
+        * dom/Element.cpp:
+        (WebCore::isForceEvent):
+
+        Move the code to ensure the force events have listeners in order to fire to 
+        dispatchMouseEvent, and delete the old implementations.
+        (WebCore::Element::dispatchMouseEvent):
+        (WebCore::Element::dispatchMouseForceChanged): Deleted.
+        (WebCore::Element::dispatchMouseForceDown): Deleted.
+        (WebCore::Element::dispatchMouseForceUp): Deleted.
+        * dom/Element.h:
+
+        Perform a hit test and pipe the events through dispatchMouseEvent(). 
+        * page/EventHandler.cpp:
+        (WebCore::EventHandler::handleMouseForceEvent):
+        * page/EventHandler.h:
+
+        New types for the new events.
+        * platform/PlatformEvent.h:
+
+        Forward to EventHandler. 
+        * replay/UserInputBridge.cpp:
+        (WebCore::UserInputBridge::handleMouseForceEvent):
+        * replay/UserInputBridge.h:
+
 2015-04-16  Tim Horton  <timothy_hor...@apple.com>
 
         Sites with both width=device-width and height=device-height load zoomed out

Modified: trunk/Source/WebCore/dom/Document.cpp (182911 => 182912)


--- trunk/Source/WebCore/dom/Document.cpp	2015-04-16 21:35:30 UTC (rev 182911)
+++ trunk/Source/WebCore/dom/Document.cpp	2015-04-16 22:18:35 UTC (rev 182912)
@@ -3966,6 +3966,22 @@
     return nullptr;
 }
 
+bool Document::hasListenerTypeForEventType(PlatformEvent::Type eventType) const
+{
+    switch (eventType) {
+    case PlatformEvent::MouseForceChanged:
+        return m_listenerTypes & Document::FORCECHANGED_LISTENER;
+    case PlatformEvent::MouseForceDown:
+        return m_listenerTypes & Document::FORCEDOWN_LISTENER;
+    case PlatformEvent::MouseForceUp:
+        return m_listenerTypes & Document::FORCEUP_LISTENER;
+    case PlatformEvent::MouseScroll:
+        return m_listenerTypes & Document::SCROLL_LISTENER;
+    default:
+        return false;
+    }
+}
+
 void Document::addListenerTypeIfNeeded(const AtomicString& eventType)
 {
     if (eventType == eventNames().DOMSubtreeModifiedEvent)

Modified: trunk/Source/WebCore/dom/Document.h (182911 => 182912)


--- trunk/Source/WebCore/dom/Document.h	2015-04-16 21:35:30 UTC (rev 182911)
+++ trunk/Source/WebCore/dom/Document.h	2015-04-16 22:18:35 UTC (rev 182912)
@@ -38,6 +38,7 @@
 #include "FontSelector.h"
 #include "MutationObserver.h"
 #include "PageVisibilityState.h"
+#include "PlatformEvent.h"
 #include "PlatformScreen.h"
 #include "ReferrerPolicy.h"
 #include "Region.h"
@@ -780,6 +781,7 @@
     };
 
     bool hasListenerType(ListenerType listenerType) const { return (m_listenerTypes & listenerType); }
+    bool hasListenerTypeForEventType(PlatformEvent::Type) const;
     void addListenerTypeIfNeeded(const AtomicString& eventType);
 
     bool hasMutationObserversOfType(MutationObserver::MutationType type) const

Modified: trunk/Source/WebCore/dom/Element.cpp (182911 => 182912)


--- trunk/Source/WebCore/dom/Element.cpp	2015-04-16 21:35:30 UTC (rev 182911)
+++ trunk/Source/WebCore/dom/Element.cpp	2015-04-16 22:18:35 UTC (rev 182912)
@@ -244,11 +244,19 @@
     return computeEditability(UserSelectAllIsAlwaysNonEditable, ShouldUpdateStyle::Update) != Editability::ReadOnly;
 }
 
+static bool isForceEvent(const PlatformMouseEvent& platformEvent)
+{
+    return platformEvent.type() == PlatformEvent::MouseForceChanged || platformEvent.type() == PlatformEvent::MouseForceDown || platformEvent.type() == PlatformEvent::MouseForceUp;
+}
+
 bool Element::dispatchMouseEvent(const PlatformMouseEvent& platformEvent, const AtomicString& eventType, int detail, Element* relatedTarget)
 {
     if (isDisabledFormControl())
         return false;
 
+    if (isForceEvent(platformEvent) && !document().hasListenerTypeForEventType(platformEvent.type()))
+        return false;
+
     RefPtr<MouseEvent> mouseEvent = MouseEvent::create(eventType, document().defaultView(), platformEvent, detail, relatedTarget);
 
     if (mouseEvent->type().isEmpty())
@@ -2253,54 +2261,6 @@
     return false;
 }
 
-void Element::dispatchMouseForceChanged(float force)
-{
-    if (!document().hasListenerType(Document::FORCECHANGED_LISTENER))
-        return;
-
-    Frame* frame = document().frame();
-    if (!frame)
-        return;
-
-    PlatformMouseEvent platformMouseEvent(frame->eventHandler().lastKnownMousePosition(), frame->eventHandler().lastKnownMouseGlobalPosition(), NoButton, PlatformEvent::NoType, 1, false, false, false, false, WTF::currentTime(), force);
-    RefPtr<MouseEvent> mouseForceChangedEvent =  MouseEvent::create(eventNames().webkitmouseforcechangedEvent, document().defaultView(), platformMouseEvent, 0, nullptr);
-
-    mouseForceChangedEvent->setTarget(this);
-    dispatchEvent(mouseForceChangedEvent);
-}
-
-void Element::dispatchMouseForceDown()
-{
-    if (!document().hasListenerType(Document::FORCEDOWN_LISTENER))
-        return;
-
-    Frame* frame = document().frame();
-    if (!frame)
-        return;
-
-    PlatformMouseEvent platformMouseEvent(frame->eventHandler().lastKnownMousePosition(), frame->eventHandler().lastKnownMouseGlobalPosition(), NoButton, PlatformEvent::NoType, 1, false, false, false, false, WTF::currentTime(), ForceAtForceClick);
-    RefPtr<MouseEvent> mouseForceDownEvent =  MouseEvent::create(eventNames().webkitmouseforcedownEvent, document().defaultView(), platformMouseEvent, 0, nullptr);
-
-    mouseForceDownEvent->setTarget(this);
-    dispatchEvent(mouseForceDownEvent);
-}
-
-void Element::dispatchMouseForceUp()
-{
-    if (!document().hasListenerType(Document::FORCEUP_LISTENER))
-        return;
-
-    Frame* frame = document().frame();
-    if (!frame)
-        return;
-
-    PlatformMouseEvent platformMouseEvent(frame->eventHandler().lastKnownMousePosition(), frame->eventHandler().lastKnownMouseGlobalPosition(), NoButton, PlatformEvent::NoType, 1, false, false, false, false, WTF::currentTime(), ForceAtForceClick);
-    RefPtr<MouseEvent> mouseForceUpEvent =  MouseEvent::create(eventNames().webkitmouseforceupEvent, document().defaultView(), platformMouseEvent, 0, nullptr);
-
-    mouseForceUpEvent->setTarget(this);
-    dispatchEvent(mouseForceUpEvent);
-}
-
 void Element::dispatchMouseForceClick()
 {
     if (!document().hasListenerType(Document::FORCECLICK_LISTENER))
@@ -2340,18 +2300,6 @@
     return false;
 }
 
-void Element::dispatchMouseForceChanged(float)
-{
-}
-
-void Element::dispatchMouseForceDown()
-{
-}
-
-void Element::dispatchMouseForceUp()
-{
-}
-
 void Element::dispatchMouseForceClick()
 {
 }

Modified: trunk/Source/WebCore/dom/Element.h (182911 => 182912)


--- trunk/Source/WebCore/dom/Element.h	2015-04-16 21:35:30 UTC (rev 182911)
+++ trunk/Source/WebCore/dom/Element.h	2015-04-16 22:18:35 UTC (rev 182912)
@@ -469,9 +469,6 @@
     virtual void dispatchBlurEvent(RefPtr<Element>&& newFocusedElement);
 
     WEBCORE_EXPORT bool dispatchMouseForceWillBegin();
-    WEBCORE_EXPORT void dispatchMouseForceChanged(float force);
-    WEBCORE_EXPORT void dispatchMouseForceDown();
-    WEBCORE_EXPORT void dispatchMouseForceUp();
     WEBCORE_EXPORT void dispatchMouseForceClick();
     WEBCORE_EXPORT void dispatchMouseForceCancelled();
 

Modified: trunk/Source/WebCore/page/EventHandler.cpp (182911 => 182912)


--- trunk/Source/WebCore/page/EventHandler.cpp	2015-04-16 21:35:30 UTC (rev 182911)
+++ trunk/Source/WebCore/page/EventHandler.cpp	2015-04-16 22:18:35 UTC (rev 182912)
@@ -2104,6 +2104,33 @@
     return swallowMouseUpEvent || swallowClickEvent || swallowMouseReleaseEvent;
 }
 
+#if ENABLE(MOUSE_FORCE_EVENTS)
+bool EventHandler::handleMouseForceEvent(const PlatformMouseEvent& event)
+{
+    RefPtr<FrameView> protector(m_frame.view());
+
+    setLastKnownMousePosition(event);
+
+    HitTestRequest::HitTestRequestType hitType = HitTestRequest::DisallowShadowContent | HitTestRequest::Active;
+
+    HitTestRequest request(hitType);
+    MouseEventWithHitTestResults mouseEvent = prepareMouseEvent(request, event);
+
+    bool swallowedEvent = !dispatchMouseEvent(eventNames().webkitmouseforcechangedEvent, mouseEvent.targetNode(), false, 0, event, false);
+    if (event.type() == PlatformEvent::MouseForceDown)
+        swallowedEvent |= !dispatchMouseEvent(eventNames().webkitmouseforcedownEvent, mouseEvent.targetNode(), false, 0, event, false);
+    if (event.type() == PlatformEvent::MouseForceUp)
+        swallowedEvent |= !dispatchMouseEvent(eventNames().webkitmouseforceupEvent, mouseEvent.targetNode(), false, 0, event, false);
+
+    return swallowedEvent;
+}
+#else
+bool EventHandler::handleMouseForceEvent(const PlatformMouseEvent& )
+{
+    return false;
+}
+#endif // #if ENABLE(MOUSE_FORCE_EVENTS)
+
 bool EventHandler::handlePasteGlobalSelection(const PlatformMouseEvent& platformMouseEvent)
 {
     // If the event was a middle click, attempt to copy global selection in after

Modified: trunk/Source/WebCore/page/EventHandler.h (182911 => 182912)


--- trunk/Source/WebCore/page/EventHandler.h	2015-04-16 21:35:30 UTC (rev 182911)
+++ trunk/Source/WebCore/page/EventHandler.h	2015-04-16 22:18:35 UTC (rev 182912)
@@ -202,6 +202,7 @@
     WEBCORE_EXPORT bool handleMousePressEvent(const PlatformMouseEvent&);
     bool handleMouseMoveEvent(const PlatformMouseEvent&, HitTestResult* hoveredNode = 0, bool _onlyUpdateScrollbars_ = false);
     WEBCORE_EXPORT bool handleMouseReleaseEvent(const PlatformMouseEvent&);
+    bool handleMouseForceEvent(const PlatformMouseEvent&);
     WEBCORE_EXPORT bool handleWheelEvent(const PlatformWheelEvent&);
     void defaultWheelEventHandler(Node*, WheelEvent*);
     bool handlePasteGlobalSelection(const PlatformMouseEvent&);

Modified: trunk/Source/WebCore/platform/PlatformEvent.h (182911 => 182912)


--- trunk/Source/WebCore/platform/PlatformEvent.h	2015-04-16 21:35:30 UTC (rev 182911)
+++ trunk/Source/WebCore/platform/PlatformEvent.h	2015-04-16 22:18:35 UTC (rev 182912)
@@ -43,6 +43,9 @@
         MouseMoved,
         MousePressed,
         MouseReleased,
+        MouseForceChanged,
+        MouseForceDown,
+        MouseForceUp,
         MouseScroll,
 
         // PlatformWheelEvent

Modified: trunk/Source/WebCore/replay/UserInputBridge.cpp (182911 => 182912)


--- trunk/Source/WebCore/replay/UserInputBridge.cpp	2015-04-16 21:35:30 UTC (rev 182911)
+++ trunk/Source/WebCore/replay/UserInputBridge.cpp	2015-04-16 22:18:35 UTC (rev 182912)
@@ -147,6 +147,11 @@
     return m_page.mainFrame().eventHandler().passMouseMovedEventToScrollbars(mouseEvent);
 }
 
+bool UserInputBridge::handleMouseForceEvent(const PlatformMouseEvent& mouseEvent, InputSource)
+{
+    return m_page.mainFrame().eventHandler().handleMouseForceEvent(mouseEvent);
+}
+
 bool UserInputBridge::handleKeyEvent(const PlatformKeyboardEvent& keyEvent, InputSource inputSource)
 {
 #if ENABLE(WEB_REPLAY)

Modified: trunk/Source/WebCore/replay/UserInputBridge.h (182911 => 182912)


--- trunk/Source/WebCore/replay/UserInputBridge.h	2015-04-16 21:35:30 UTC (rev 182911)
+++ trunk/Source/WebCore/replay/UserInputBridge.h	2015-04-16 22:18:35 UTC (rev 182912)
@@ -78,6 +78,7 @@
     WEBCORE_EXPORT bool handleMouseReleaseEvent(const PlatformMouseEvent&, InputSource source = InputSource::User);
     WEBCORE_EXPORT bool handleMouseMoveEvent(const PlatformMouseEvent&, InputSource source = InputSource::User);
     WEBCORE_EXPORT bool handleMouseMoveOnScrollbarEvent(const PlatformMouseEvent&, InputSource source = InputSource::User);
+    WEBCORE_EXPORT bool handleMouseForceEvent(const PlatformMouseEvent&, InputSource = InputSource::User);
     WEBCORE_EXPORT bool handleWheelEvent(const PlatformWheelEvent&, InputSource source = InputSource::User);
     WEBCORE_EXPORT bool handleKeyEvent(const PlatformKeyboardEvent&, InputSource source = InputSource::User);
     WEBCORE_EXPORT bool handleAccessKeyEvent(const PlatformKeyboardEvent&, InputSource source = InputSource::User);

Modified: trunk/Source/WebKit2/ChangeLog (182911 => 182912)


--- trunk/Source/WebKit2/ChangeLog	2015-04-16 21:35:30 UTC (rev 182911)
+++ trunk/Source/WebKit2/ChangeLog	2015-04-16 22:18:35 UTC (rev 182912)
@@ -1,3 +1,62 @@
+2015-04-16  Beth Dakin  <bda...@apple.com>
+
+        Force mouse events should go through normal mouse event handling code paths
+        https://bugs.webkit.org/show_bug.cgi?id=143749
+        -and corresponding-
+        rdar://problem/20472895
+
+        Reviewed by Dean Jackson.
+
+        This patch makes pressureChangeWithEvent create NativeWebMouseEvents with the 
+        NSEventTypePressures that is gets and sends those down to the web process.
+
+        Re-name pressureEvent to lastPressureEvent. Now that event can sometimes be an 
+        NSEventTypePressure, the new name makes it clear how the second parameter differs 
+        from the first.
+        * Shared/NativeWebMouseEvent.h:
+
+        New event types for the new types of events.
+        * Shared/WebEvent.h:
+        * Shared/WebEventConversion.cpp:
+        (WebKit::WebKit2PlatformMouseEvent::WebKit2PlatformMouseEvent):
+        * Shared/mac/NativeWebMouseEventMac.mm:
+        (WebKit::NativeWebMouseEvent::NativeWebMouseEvent):
+        * Shared/mac/WebEventFactory.h:
+
+        All of the square-peg, round-hole problems of massaging the NSEventTypePressures 
+        events into WebMouseEvents is taken care of here.
+        * Shared/mac/WebEventFactory.mm:
+        (WebKit::mouseButtonForEvent):
+        (WebKit::globalPointForEvent):
+        (WebKit::pointForEvent):
+        (WebKit::WebEventFactory::createWebMouseEvent):
+
+        Instead of calling the old inputDeviceForceDidChange, create a NativeWebMouseEvent 
+        and handle it.
+        * UIProcess/API/mac/WKView.mm:
+        (-[WKView pressureChangeWithEvent:]):
+
+        Handle the new types.
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::didReceiveEvent):
+
+        Can delete inputDeviceForceDidChange since it’s no longer used.
+        (WebKit::WebPageProxy::inputDeviceForceDidChange): Deleted.
+        * UIProcess/WebPageProxy.h:
+
+        Handle the new types of mouse events properly.
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::handleMouseEvent):
+
+        Delete inputDeviceForceDidChange() and m_lastForceStage.
+        * WebProcess/WebPage/WebPage.h:
+        * WebProcess/WebPage/WebPage.messages.in:
+        * WebProcess/WebPage/mac/WebPageMac.mm:
+        (WebKit::WebPage::inputDeviceForceDidChange): Deleted.
+
+        Handle new WebEvent types.
+        * WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp:
+
 2015-04-16  Dan Bernstein  <m...@apple.com>
 
         <rdar://problem/20575744> Also include a definition of __NSd_{current deployment target} in WKFoundation.h.

Modified: trunk/Source/WebKit2/Shared/NativeWebMouseEvent.h (182911 => 182912)


--- trunk/Source/WebKit2/Shared/NativeWebMouseEvent.h	2015-04-16 21:35:30 UTC (rev 182911)
+++ trunk/Source/WebKit2/Shared/NativeWebMouseEvent.h	2015-04-16 22:18:35 UTC (rev 182912)
@@ -49,7 +49,7 @@
 class NativeWebMouseEvent : public WebMouseEvent {
 public:
 #if USE(APPKIT)
-    NativeWebMouseEvent(NSEvent *, NSEvent *pressureEvent, NSView *);
+    NativeWebMouseEvent(NSEvent *, NSEvent *lastPressureEvent, NSView *);
 #elif PLATFORM(GTK)
     NativeWebMouseEvent(const NativeWebMouseEvent&);
     NativeWebMouseEvent(GdkEvent*, int);

Modified: trunk/Source/WebKit2/Shared/WebEvent.h (182911 => 182912)


--- trunk/Source/WebKit2/Shared/WebEvent.h	2015-04-16 21:35:30 UTC (rev 182911)
+++ trunk/Source/WebKit2/Shared/WebEvent.h	2015-04-16 22:18:35 UTC (rev 182912)
@@ -58,6 +58,9 @@
         MouseDown,
         MouseUp,
         MouseMove,
+        MouseForceChanged,
+        MouseForceDown,
+        MouseForceUp,
 
         // WebWheelEvent
         Wheel,

Modified: trunk/Source/WebKit2/Shared/WebEventConversion.cpp (182911 => 182912)


--- trunk/Source/WebKit2/Shared/WebEventConversion.cpp	2015-04-16 21:35:30 UTC (rev 182911)
+++ trunk/Source/WebKit2/Shared/WebEventConversion.cpp	2015-04-16 22:18:35 UTC (rev 182912)
@@ -48,6 +48,18 @@
             m_type = WebCore::PlatformEvent::MouseMoved;
             m_force = webEvent.force();
             break;
+        case WebEvent::MouseForceChanged:
+            m_type = WebCore::PlatformEvent::MouseForceChanged;
+            m_force = webEvent.force();
+            break;
+        case WebEvent::MouseForceDown:
+            m_type = WebCore::PlatformEvent::MouseForceDown;
+            m_force = WebCore::ForceAtForceClick;
+            break;
+        case WebEvent::MouseForceUp:
+            m_type = WebCore::PlatformEvent::MouseForceUp;
+            m_force = WebCore::ForceAtForceClick;
+            break;
         default:
             ASSERT_NOT_REACHED();
         }

Modified: trunk/Source/WebKit2/Shared/mac/NativeWebMouseEventMac.mm (182911 => 182912)


--- trunk/Source/WebKit2/Shared/mac/NativeWebMouseEventMac.mm	2015-04-16 21:35:30 UTC (rev 182911)
+++ trunk/Source/WebKit2/Shared/mac/NativeWebMouseEventMac.mm	2015-04-16 22:18:35 UTC (rev 182912)
@@ -32,8 +32,8 @@
 
 namespace WebKit {
 
-NativeWebMouseEvent::NativeWebMouseEvent(NSEvent *event, NSEvent *pressureEvent, NSView *view)
-    : WebMouseEvent(WebEventFactory::createWebMouseEvent(event, pressureEvent, view))
+NativeWebMouseEvent::NativeWebMouseEvent(NSEvent *event, NSEvent *lastPressureEvent, NSView *view)
+    : WebMouseEvent(WebEventFactory::createWebMouseEvent(event, lastPressureEvent, view))
     , m_nativeEvent(event)
 {
 }

Modified: trunk/Source/WebKit2/Shared/mac/WebEventFactory.h (182911 => 182912)


--- trunk/Source/WebKit2/Shared/mac/WebEventFactory.h	2015-04-16 21:35:30 UTC (rev 182911)
+++ trunk/Source/WebKit2/Shared/mac/WebEventFactory.h	2015-04-16 22:18:35 UTC (rev 182912)
@@ -42,7 +42,7 @@
 class WebEventFactory {
 public:
 #if USE(APPKIT)
-    static WebMouseEvent createWebMouseEvent(NSEvent *, NSEvent *pressureEvent, NSView *windowView);
+    static WebMouseEvent createWebMouseEvent(NSEvent *, NSEvent *lastPressureEvent, NSView *windowView);
     static WebWheelEvent createWebWheelEvent(NSEvent *, NSView *windowView);
     static WebKeyboardEvent createWebKeyboardEvent(NSEvent *, bool handledByInputMethod, const Vector<WebCore::KeypressCommand>&);
     static bool shouldBeHandledAsContextClick(const WebCore::PlatformMouseEvent&);

Modified: trunk/Source/WebKit2/Shared/mac/WebEventFactory.mm (182911 => 182912)


--- trunk/Source/WebKit2/Shared/mac/WebEventFactory.mm	2015-04-16 21:35:30 UTC (rev 182911)
+++ trunk/Source/WebKit2/Shared/mac/WebEventFactory.mm	2015-04-16 22:18:35 UTC (rev 182912)
@@ -76,6 +76,9 @@
         case NSOtherMouseUp:
         case NSOtherMouseDragged:
             return WebMouseEvent::MiddleButton;
+#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 101003
+        case NSEventTypePressure:
+#endif
         case NSMouseEntered:
         case NSMouseExited:
             return currentMouseButton();
@@ -156,51 +159,57 @@
 static NSPoint globalPointForEvent(NSEvent *event)
 {
     switch ([event type]) {
-        case NSLeftMouseDown:
-        case NSLeftMouseDragged:
-        case NSLeftMouseUp:
-        case NSMouseEntered:
-        case NSMouseExited:
-        case NSMouseMoved:
-        case NSOtherMouseDown:
-        case NSOtherMouseDragged:
-        case NSOtherMouseUp:
-        case NSRightMouseDown:
-        case NSRightMouseDragged:
-        case NSRightMouseUp:
-        case NSScrollWheel:
-            return globalPoint([event locationInWindow], [event window]);
-        default:
-            return NSZeroPoint;
+#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 101003
+    case NSEventTypePressure:
+#endif
+    case NSLeftMouseDown:
+    case NSLeftMouseDragged:
+    case NSLeftMouseUp:
+    case NSMouseEntered:
+    case NSMouseExited:
+    case NSMouseMoved:
+    case NSOtherMouseDown:
+    case NSOtherMouseDragged:
+    case NSOtherMouseUp:
+    case NSRightMouseDown:
+    case NSRightMouseDragged:
+    case NSRightMouseUp:
+    case NSScrollWheel:
+        return globalPoint([event locationInWindow], [event window]);
+    default:
+        return NSZeroPoint;
     }
 }
 
 static NSPoint pointForEvent(NSEvent *event, NSView *windowView)
 {
     switch ([event type]) {
-        case NSLeftMouseDown:
-        case NSLeftMouseDragged:
-        case NSLeftMouseUp:
-        case NSMouseEntered:
-        case NSMouseExited:
-        case NSMouseMoved:
-        case NSOtherMouseDown:
-        case NSOtherMouseDragged:
-        case NSOtherMouseUp:
-        case NSRightMouseDown:
-        case NSRightMouseDragged:
-        case NSRightMouseUp:
-        case NSScrollWheel: {
-            // Note: This will have its origin at the bottom left of the window unless windowView is flipped.
-            // In those cases, the Y coordinate gets flipped by Widget::convertFromContainingWindow.
-            NSPoint location = [event locationInWindow];
-            if (windowView)
-                location = [windowView convertPoint:location fromView:nil];
-            return location;
-        }
-        default:
-            return NSZeroPoint;
+#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 101003
+    case NSEventTypePressure:
+#endif
+    case NSLeftMouseDown:
+    case NSLeftMouseDragged:
+    case NSLeftMouseUp:
+    case NSMouseEntered:
+    case NSMouseExited:
+    case NSMouseMoved:
+    case NSOtherMouseDown:
+    case NSOtherMouseDragged:
+    case NSOtherMouseUp:
+    case NSRightMouseDown:
+    case NSRightMouseDragged:
+    case NSRightMouseUp:
+    case NSScrollWheel: {
+        // Note: This will have its origin at the bottom left of the window unless windowView is flipped.
+        // In those cases, the Y coordinate gets flipped by Widget::convertFromContainingWindow.
+        NSPoint location = [event locationInWindow];
+        if (windowView)
+            location = [windowView convertPoint:location fromView:nil];
+        return location;
     }
+    default:
+        return NSZeroPoint;
+    }
 }
 
 static WebWheelEvent::Phase phaseForEvent(NSEvent *event)
@@ -358,25 +367,38 @@
     return (static_cast<NSMenuType>(event.menuTypeForEvent()) == NSMenuTypeContextMenu);
 }
 
-WebMouseEvent WebEventFactory::createWebMouseEvent(NSEvent *event, NSEvent *pressureEvent, NSView *windowView)
+WebMouseEvent WebEventFactory::createWebMouseEvent(NSEvent *event, NSEvent *lastPressureEvent, NSView *windowView)
 {
     NSPoint position = pointForEvent(event, windowView);
     NSPoint globalPosition = globalPointForEvent(event);
 
-    WebEvent::Type type                     = mouseEventTypeForEvent(event);
-    WebMouseEvent::Button button            = mouseButtonForEvent(event);
-    float deltaX                            = [event deltaX];
-    float deltaY                            = [event deltaY];
-    float deltaZ                            = [event deltaZ];
-    int clickCount                          = clickCountForEvent(event);
-    WebEvent::Modifiers modifiers           = modifiersForEvent(event);
-    double timestamp                        = eventTimeStampSince1970(event);
-    int eventNumber                         = [event eventNumber];
-    int menuTypeForEvent                    = typeForEvent(event);
+    WebEvent::Type type = mouseEventTypeForEvent(event);
+#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 101003
+    if ([event type] == NSEventTypePressure) {
+        // Since AppKit doesn't send mouse events for force down or force up, we have to use the current pressure
+        // event and lastPressureEvent to detect if this is MouseForceDown, MouseForceUp, or just MouseForceChanged.
+        if (lastPressureEvent.stage == 1 && event.stage == 2)
+            type = WebEvent::MouseForceDown;
+        else if (lastPressureEvent.stage == 2 && event.stage == 1)
+            type = WebEvent::MouseForceUp;
+        else
+            type = WebEvent::MouseForceChanged;
+    }
+#endif
 
+    WebMouseEvent::Button button = mouseButtonForEvent(event);
+    float deltaX = [event deltaX];
+    float deltaY = [event deltaY];
+    float deltaZ = [event deltaZ];
+    int clickCount = clickCountForEvent(event);
+    WebEvent::Modifiers modifiers = modifiersForEvent(event);
+    double timestamp = eventTimeStampSince1970(event);
+    int eventNumber = [event eventNumber];
+    int menuTypeForEvent = typeForEvent(event);
+
     double force = 0;
 #if __MAC_OS_X_VERSION_MAX_ALLOWED >= 101003
-    force = pressureEvent.stage < 1 ? pressureEvent.pressure : pressureEvent.pressure + pressureEvent.stage - 1;
+    force = lastPressureEvent.stage < 1 ? lastPressureEvent.pressure : lastPressureEvent.pressure + lastPressureEvent.stage - 1;
 #endif
 
     return WebMouseEvent(type, button, IntPoint(position), IntPoint(globalPosition), deltaX, deltaY, deltaZ, clickCount, modifiers, timestamp, force, eventNumber, menuTypeForEvent);

Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm (182911 => 182912)


--- trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm	2015-04-16 21:35:30 UTC (rev 182911)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm	2015-04-16 22:18:35 UTC (rev 182912)
@@ -1431,13 +1431,17 @@
     if (event == _data->_pressureEvent)
         return;
 
+    if (_data->_ignoresNonWheelEvents)
+        return;
+
     if (event.phase != NSEventPhaseChanged && event.phase != NSEventPhaseBegan && event.phase != NSEventPhaseEnded)
         return;
 
+    NativeWebMouseEvent webEvent(event, _data->_pressureEvent, self);
+    _data->_page->handleMouseEvent(webEvent);
+
     [_data->_pressureEvent release];
     _data->_pressureEvent = [event retain];
-
-    _data->_page->inputDeviceForceDidChange(event.pressure, event.stage);
 #endif
 }
 

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (182911 => 182912)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2015-04-16 21:35:30 UTC (rev 182911)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2015-04-16 22:18:35 UTC (rev 182912)
@@ -4397,6 +4397,9 @@
 
     case WebEvent::MouseDown:
     case WebEvent::MouseUp:
+    case WebEvent::MouseForceChanged:
+    case WebEvent::MouseForceDown:
+    case WebEvent::MouseForceUp:
     case WebEvent::Wheel:
     case WebEvent::KeyDown:
     case WebEvent::KeyUp:
@@ -4427,6 +4430,10 @@
     case WebEvent::MouseUp:
         m_currentlyProcessedMouseDownEvent = nullptr;
         break;
+    case WebEvent::MouseForceChanged:
+    case WebEvent::MouseForceDown:
+    case WebEvent::MouseForceUp:
+        break;
 
     case WebEvent::Wheel: {
         MESSAGE_CHECK(!m_currentlyProcessedWheelEvents.isEmpty());
@@ -5674,11 +5681,6 @@
     m_process->send(Messages::WebPage::FocusAndSelectLastActionMenuHitTestResult(), m_pageID);
 }
 
-void WebPageProxy::inputDeviceForceDidChange(float force, int stage)
-{
-    m_process->send(Messages::WebPage::InputDeviceForceDidChange(force, stage), m_pageID);
-}
-
 void WebPageProxy::immediateActionDidUpdate()
 {
     m_process->send(Messages::WebPage::ImmediateActionDidUpdate(), m_pageID);

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (182911 => 182912)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2015-04-16 21:35:30 UTC (rev 182911)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2015-04-16 22:18:35 UTC (rev 182912)
@@ -994,7 +994,6 @@
     void selectLastActionMenuRange();
     void focusAndSelectLastActionMenuHitTestResult();
 
-    void inputDeviceForceDidChange(float force, int stage);
     void immediateActionDidUpdate();
     void immediateActionDidCancel();
     void immediateActionDidComplete();

Modified: trunk/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp (182911 => 182912)


--- trunk/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp	2015-04-16 21:35:30 UTC (rev 182911)
+++ trunk/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp	2015-04-16 22:18:35 UTC (rev 182912)
@@ -474,6 +474,9 @@
     case WebEvent::MouseMove:
         setXMotionEventFields(xEvent, event, convertToRootView(IntPoint()));
         break;
+    case WebEvent::MouseForceChanged:
+    case WebEvent::MouseForceDown:
+    case WebEvent::MouseForceUp:
     case WebEvent::NoType:
     case WebEvent::Wheel:
     case WebEvent::KeyDown:

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (182911 => 182912)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2015-04-16 21:35:30 UTC (rev 182911)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2015-04-16 22:18:35 UTC (rev 182912)
@@ -1903,6 +1903,12 @@
             if (onlyUpdateScrollbars)
                 return page->corePage()->userInputBridge().handleMouseMoveOnScrollbarEvent(platformMouseEvent);
             return page->corePage()->userInputBridge().handleMouseMoveEvent(platformMouseEvent);
+
+        case PlatformEvent::MouseForceChanged:
+        case PlatformEvent::MouseForceDown:
+        case PlatformEvent::MouseForceUp:
+            return page->corePage()->userInputBridge().handleMouseForceEvent(platformMouseEvent);
+
         default:
             ASSERT_NOT_REACHED();
             return false;

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (182911 => 182912)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2015-04-16 21:35:30 UTC (rev 182911)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2015-04-16 22:18:35 UTC (rev 182912)
@@ -1094,7 +1094,6 @@
     PassRefPtr<WebCore::Range> lookupTextAtLocation(WebCore::FloatPoint, NSDictionary **options);
     void selectLastActionMenuRange();
     void focusAndSelectLastActionMenuHitTestResult();
-    void inputDeviceForceDidChange(float force, int stage);
     void immediateActionDidUpdate();
     void immediateActionDidCancel();
     void immediateActionDidComplete();
@@ -1355,7 +1354,6 @@
     RefPtr<WebCore::Range> m_lastActionMenuRangeForSelection;
     WebCore::HitTestResult m_lastActionMenuHitTestResult;
     RefPtr<WebPageOverlay> m_lastActionMenuHitPageOverlay;
-    int m_lastForceStage { 0 };
 #endif
 
     bool m_mainFrameProgressCompleted;

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in (182911 => 182912)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in	2015-04-16 21:35:30 UTC (rev 182911)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in	2015-04-16 22:18:35 UTC (rev 182912)
@@ -407,7 +407,6 @@
     PerformActionMenuHitTestAtLocation(WebCore::FloatPoint location, bool forImmediateAction)
     SelectLastActionMenuRange()
     FocusAndSelectLastActionMenuHitTestResult()
-    InputDeviceForceDidChange(float force, int stage)
     ImmediateActionDidUpdate()
     ImmediateActionDidCancel()
     ImmediateActionDidComplete()

Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm (182911 => 182912)


--- trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm	2015-04-16 21:35:30 UTC (rev 182911)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm	2015-04-16 22:18:35 UTC (rev 182912)
@@ -1141,25 +1141,6 @@
     frame->selection().setSelection(position);
 }
 
-void WebPage::inputDeviceForceDidChange(float force, int stage)
-{
-    Element* element = m_lastActionMenuHitTestResult.innerElement();
-    if (!element)
-        return;
-
-    float overallForce = stage < 1 ? force : force + stage - 1;
-    element->dispatchMouseForceChanged(overallForce);
-
-    if (m_lastForceStage == 1 && stage == 2)
-        element->dispatchMouseForceDown();
-    else if (m_lastForceStage == 2 && stage == 1) {
-        element->dispatchMouseForceUp();
-        element->dispatchMouseForceClick();
-    }
-
-    m_lastForceStage = stage;
-}
-
 void WebPage::immediateActionDidUpdate()
 {
     m_page->mainFrame().eventHandler().setImmediateActionStage(ImmediateActionStage::ActionUpdated);

Modified: trunk/Tools/ChangeLog (182911 => 182912)


--- trunk/Tools/ChangeLog	2015-04-16 21:35:30 UTC (rev 182911)
+++ trunk/Tools/ChangeLog	2015-04-16 22:18:35 UTC (rev 182912)
@@ -1,3 +1,39 @@
+2015-04-16  Beth Dakin  <bda...@apple.com>
+
+        Force mouse events should go through normal mouse event handling code paths
+        https://bugs.webkit.org/show_bug.cgi?id=143749
+        -and corresponding-
+        rdar://problem/20472895
+
+        Reviewed by Dean Jackson.
+
+        Add mouseForceDown/mouseForceUp/mouseForceChanged support to WebKitTestRunner. 
+        Since there is not a way to create an NSEventTypePressure from scratch, we 
+        subclass NSEvent and override all of the critical methods.
+
+        * WebKitTestRunner/EventSenderProxy.h:
+        * WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl:
+        * WebKitTestRunner/InjectedBundle/EventSendingController.cpp:
+        (WTR::EventSendingController::mouseForceDown):
+        (WTR::EventSendingController::mouseForceUp):
+        (WTR::EventSendingController::mouseForceChanged):
+        * WebKitTestRunner/InjectedBundle/EventSendingController.h:
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::didReceiveSynchronousMessageFromInjectedBundle):
+        * WebKitTestRunner/mac/EventSenderProxy.mm:
+        (-[EventSenderPressureEvent initAtLocation:globalLocation:stage:pressure:phase:time:eventNumber:]):
+        (-[EventSenderPressureEvent timestamp]):
+        (-[EventSenderPressureEvent type]):
+        (-[EventSenderPressureEvent locationInWindow]):
+        (-[EventSenderPressureEvent location]):
+        (-[EventSenderPressureEvent stage]):
+        (-[EventSenderPressureEvent pressure]):
+        (-[EventSenderPressureEvent phase]):
+        (-[EventSenderPressureEvent eventNumber]):
+        (WTR::EventSenderProxy::mouseForceDown):
+        (WTR::EventSenderProxy::mouseForceUp):
+        (WTR::EventSenderProxy::mouseForceChanged):
+
 2015-04-16  Csaba Osztrogonác  <o...@webkit.org>
 
         [EFL] Bump LLVM to version 3.6.0 on X86_64

Modified: trunk/Tools/WebKitTestRunner/EventSenderProxy.h (182911 => 182912)


--- trunk/Tools/WebKitTestRunner/EventSenderProxy.h	2015-04-16 21:35:30 UTC (rev 182911)
+++ trunk/Tools/WebKitTestRunner/EventSenderProxy.h	2015-04-16 22:18:35 UTC (rev 182912)
@@ -58,6 +58,9 @@
 
     void mouseDown(unsigned button, WKEventModifiers);
     void mouseUp(unsigned button, WKEventModifiers);
+    void mouseForceDown();
+    void mouseForceUp();
+    void mouseForceChanged(float);
     void mouseMoveTo(double x, double y);
     void mouseScrollBy(int x, int y);
     void mouseScrollByWithWheelAndMomentumPhases(int x, int y, int phase, int momentum);

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl (182911 => 182912)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl	2015-04-16 21:35:30 UTC (rev 182911)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl	2015-04-16 22:18:35 UTC (rev 182912)
@@ -27,6 +27,9 @@
     void mouseDown(long buttonNumber, object modifierArray);
     void mouseUp(long buttonNumber, object modifierArray);
     void mouseMoveTo(long x, long y);
+    void mouseForceDown();
+    void mouseForceUp();
+    void mouseForceChanged(double force);
     void mouseScrollBy(long x, long y);
     void mouseScrollByWithWheelAndMomentumPhases(long x, long y, DOMString phase, DOMString momentum, optional boolean asyncScrolling);
     void continuousMouseScrollBy(long x, long y, optional boolean paged);

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp (182911 => 182912)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp	2015-04-16 21:35:30 UTC (rev 182911)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp	2015-04-16 22:18:35 UTC (rev 182912)
@@ -253,6 +253,46 @@
     WKBundlePagePostSynchronousMessage(InjectedBundle::singleton().page()->page(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
 }
 
+void EventSendingController::mouseForceDown()
+{
+    WKRetainPtr<WKStringRef> EventSenderMessageName(AdoptWK, WKStringCreateWithUTF8CString("EventSender"));
+    WKRetainPtr<WKMutableDictionaryRef> EventSenderMessageBody(AdoptWK, WKMutableDictionaryCreate());
+
+    WKRetainPtr<WKStringRef> subMessageKey(AdoptWK, WKStringCreateWithUTF8CString("SubMessage"));
+    WKRetainPtr<WKStringRef> subMessageName(AdoptWK, WKStringCreateWithUTF8CString("MouseForceDown"));
+    WKDictionarySetItem(EventSenderMessageBody.get(), subMessageKey.get(), subMessageName.get());
+
+    WKBundlePagePostSynchronousMessage(InjectedBundle::singleton().page()->page(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
+}
+
+void EventSendingController::mouseForceUp()
+{
+    WKRetainPtr<WKStringRef> EventSenderMessageName(AdoptWK, WKStringCreateWithUTF8CString("EventSender"));
+    WKRetainPtr<WKMutableDictionaryRef> EventSenderMessageBody(AdoptWK, WKMutableDictionaryCreate());
+
+    WKRetainPtr<WKStringRef> subMessageKey(AdoptWK, WKStringCreateWithUTF8CString("SubMessage"));
+    WKRetainPtr<WKStringRef> subMessageName(AdoptWK, WKStringCreateWithUTF8CString("MouseForceUp"));
+    WKDictionarySetItem(EventSenderMessageBody.get(), subMessageKey.get(), subMessageName.get());
+
+    WKBundlePagePostSynchronousMessage(InjectedBundle::singleton().page()->page(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
+}
+
+void EventSendingController::mouseForceChanged(double force)
+{
+    WKRetainPtr<WKStringRef> EventSenderMessageName(AdoptWK, WKStringCreateWithUTF8CString("EventSender"));
+    WKRetainPtr<WKMutableDictionaryRef> EventSenderMessageBody(AdoptWK, WKMutableDictionaryCreate());
+
+    WKRetainPtr<WKStringRef> subMessageKey(AdoptWK, WKStringCreateWithUTF8CString("SubMessage"));
+    WKRetainPtr<WKStringRef> subMessageName(AdoptWK, WKStringCreateWithUTF8CString("MouseForceChanged"));
+    WKDictionarySetItem(EventSenderMessageBody.get(), subMessageKey.get(), subMessageName.get());
+
+    WKRetainPtr<WKStringRef> forceKey(AdoptWK, WKStringCreateWithUTF8CString("Force"));
+    WKRetainPtr<WKDoubleRef> forceRef(AdoptWK, WKDoubleCreate(force));
+    WKDictionarySetItem(EventSenderMessageBody.get(), forceKey.get(), forceRef.get());
+
+    WKBundlePagePostSynchronousMessage(InjectedBundle::singleton().page()->page(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
+}
+
 void EventSendingController::leapForward(int milliseconds)
 {
     WKRetainPtr<WKStringRef> EventSenderMessageName(AdoptWK, WKStringCreateWithUTF8CString("EventSender"));

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.h (182911 => 182912)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.h	2015-04-16 21:35:30 UTC (rev 182911)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.h	2015-04-16 22:18:35 UTC (rev 182912)
@@ -46,6 +46,9 @@
     void mouseDown(int button, JSValueRef modifierArray);
     void mouseUp(int button, JSValueRef modifierArray);
     void mouseMoveTo(int x, int y);
+    void mouseForceDown();
+    void mouseForceUp();
+    void mouseForceChanged(double force);
     void mouseScrollBy(int x, int y);
     void mouseScrollByWithWheelAndMomentumPhases(int x, int y, JSStringRef phase, JSStringRef momentum, bool asyncScrolling);
     void continuousMouseScrollBy(int x, int y, bool paged);

Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (182911 => 182912)


--- trunk/Tools/WebKitTestRunner/TestController.cpp	2015-04-16 21:35:30 UTC (rev 182911)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp	2015-04-16 22:18:35 UTC (rev 182912)
@@ -1102,6 +1102,32 @@
             return 0;
         }
 
+#if PLATFORM(MAC)
+        if (WKStringIsEqualToUTF8CString(subMessageName, "MouseForceDown")) {
+            WKPageSetShouldSendEventsSynchronously(mainWebView()->page(), true);
+            m_eventSenderProxy->mouseForceDown();
+            WKPageSetShouldSendEventsSynchronously(mainWebView()->page(), false);
+            return 0;
+        }
+
+        if (WKStringIsEqualToUTF8CString(subMessageName, "MouseForceUp")) {
+            WKPageSetShouldSendEventsSynchronously(mainWebView()->page(), true);
+            m_eventSenderProxy->mouseForceUp();
+            WKPageSetShouldSendEventsSynchronously(mainWebView()->page(), false);
+            return 0;
+        }
+
+        if (WKStringIsEqualToUTF8CString(subMessageName, "MouseForceChanged")) {
+            WKRetainPtr<WKStringRef> forceKey = adoptWK(WKStringCreateWithUTF8CString("Force"));
+            double force = WKDoubleGetValue(static_cast<WKDoubleRef>(WKDictionaryGetItemForKey(messageBodyDictionary, forceKey.get())));
+
+            WKPageSetShouldSendEventsSynchronously(mainWebView()->page(), true);
+            m_eventSenderProxy->mouseForceChanged(force);
+            WKPageSetShouldSendEventsSynchronously(mainWebView()->page(), false);
+            return 0;
+        }
+#endif // PLATFORM(MAC)
+
         if (WKStringIsEqualToUTF8CString(subMessageName, "MouseScrollBy")) {
             WKRetainPtr<WKStringRef> xKey = adoptWK(WKStringCreateWithUTF8CString("X"));
             double x = WKDoubleGetValue(static_cast<WKDoubleRef>(WKDictionaryGetItemForKey(messageBodyDictionary, xKey.get())));

Modified: trunk/Tools/WebKitTestRunner/mac/EventSenderProxy.mm (182911 => 182912)


--- trunk/Tools/WebKitTestRunner/mac/EventSenderProxy.mm	2015-04-16 21:35:30 UTC (rev 182911)
+++ trunk/Tools/WebKitTestRunner/mac/EventSenderProxy.mm	2015-04-16 22:18:35 UTC (rev 182912)
@@ -39,6 +39,85 @@
 - (void)_setCurrentEvent:(NSEvent *)event;
 @end
 
+#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 101003
+@interface EventSenderPressureEvent : NSEvent {
+@public
+    NSPoint _eventSender_locationInWindow;
+    NSPoint _eventSender_location;
+    NSInteger _eventSender_stage;
+    float _eventSender_pressure;
+    NSEventPhase _eventSender_phase;
+    NSTimeInterval _eventSender_timestamp;
+    NSInteger _eventSender_eventNumber;
+}
+
+- (id)initAtLocation:(NSPoint)location globalLocation:(NSPoint)globalLocation stage:(NSInteger)stage pressure:(float)pressure phase:(NSEventPhase)phase time:(NSTimeInterval)time eventNumber:(NSInteger)eventNumber;
+- (NSTimeInterval)timestamp;
+@end
+
+@implementation EventSenderPressureEvent
+
+- (id)initAtLocation:(NSPoint)location globalLocation:(NSPoint)globalLocation stage:(NSInteger)stage pressure:(float)pressure phase:(NSEventPhase)phase time:(NSTimeInterval)time eventNumber:(NSInteger)eventNumber
+{
+    self = [super init];
+
+    if (!self)
+        return nil;
+
+    _eventSender_location = location;
+    _eventSender_locationInWindow = globalLocation;
+    _eventSender_stage = stage;
+    _eventSender_pressure = pressure;
+    _eventSender_phase = phase;
+    _eventSender_timestamp = time;
+    _eventSender_eventNumber = eventNumber;
+
+    return self;
+}
+
+- (NSTimeInterval)timestamp
+{
+    return _eventSender_timestamp;
+}
+
+- (NSEventType)type
+{
+    return NSEventTypePressure;
+}
+
+- (NSPoint)locationInWindow
+{
+    return self->_eventSender_location;
+}
+
+- (NSPoint)location
+{
+    return self->_eventSender_locationInWindow;
+}
+
+- (NSInteger)stage
+{
+    return _eventSender_stage;
+}
+
+- (float)pressure
+{
+    return _eventSender_pressure;
+}
+
+- (NSEventPhase)phase
+{
+    return _eventSender_phase;
+}
+
+- (NSInteger)eventNumber
+{
+    return _eventSender_eventNumber;
+}
+
+@end
+#endif // __MAC_OS_X_VERSION_MAX_ALLOWED >= 101003
+
 namespace WTR {
 
 enum MouseAction {
@@ -200,6 +279,115 @@
     m_clickPosition = m_position;
 }
 
+#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 101003
+void EventSenderProxy::mouseForceDown()
+{
+    EventSenderPressureEvent *firstEvent = [[EventSenderPressureEvent alloc] initAtLocation:NSMakePoint(m_position.x, m_position.y)
+        globalLocation:([m_testController->mainWebView()->platformWindow() convertRectToScreen:NSMakeRect(m_position.x, m_position.y, 1, 1)].origin)
+        stage:1
+        pressure:0.9
+        phase:NSEventPhaseChanged
+        time:absoluteTimeForEventTime(currentEventTime())
+        eventNumber:++eventNumber];
+    EventSenderPressureEvent *secondEvent = [[EventSenderPressureEvent alloc] initAtLocation:NSMakePoint(m_position.x, m_position.y)
+        globalLocation:([m_testController->mainWebView()->platformWindow() convertRectToScreen:NSMakeRect(m_position.x, m_position.y, 1, 1)].origin)
+        stage:2
+        pressure:0.1
+        phase:NSEventPhaseChanged
+        time:absoluteTimeForEventTime(currentEventTime())
+        eventNumber:++eventNumber];
+
+    NSView *targetView = [m_testController->mainWebView()->platformView() hitTest:[firstEvent locationInWindow]];
+    targetView = targetView ? targetView : m_testController->mainWebView()->platformView();
+    ASSERT(targetView);
+
+    // 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 _setCurrentEvent:firstEvent];
+    [targetView pressureChangeWithEvent:firstEvent];
+    [NSApp _setCurrentEvent:secondEvent];
+    [targetView pressureChangeWithEvent:secondEvent];
+
+    [NSApp _setCurrentEvent:nil];
+    // WKView caches the most recent pressure event, so send it a nil event to clear the cache.
+    [targetView pressureChangeWithEvent:nil];
+
+    [firstEvent release];
+    [secondEvent release];
+}
+
+void EventSenderProxy::mouseForceUp()
+{
+    EventSenderPressureEvent *firstEvent = [[EventSenderPressureEvent alloc] initAtLocation:NSMakePoint(m_position.x, m_position.y)
+        globalLocation:([m_testController->mainWebView()->platformWindow() convertRectToScreen:NSMakeRect(m_position.x, m_position.y, 1, 1)].origin)
+        stage:2
+        pressure:0.1
+        phase:NSEventPhaseChanged
+        time:absoluteTimeForEventTime(currentEventTime())
+        eventNumber:++eventNumber];
+    EventSenderPressureEvent *secondEvent = [[EventSenderPressureEvent alloc] initAtLocation:NSMakePoint(m_position.x, m_position.y)
+        globalLocation:([m_testController->mainWebView()->platformWindow() convertRectToScreen:NSMakeRect(m_position.x, m_position.y, 1, 1)].origin)
+        stage:1
+        pressure:0.9
+        phase:NSEventPhaseChanged
+        time:absoluteTimeForEventTime(currentEventTime())
+        eventNumber:++eventNumber];
+
+    NSView *targetView = [m_testController->mainWebView()->platformView() hitTest:[firstEvent locationInWindow]];
+    targetView = targetView ? targetView : m_testController->mainWebView()->platformView();
+    ASSERT(targetView);
+
+    // 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 _setCurrentEvent:firstEvent];
+    [targetView pressureChangeWithEvent:firstEvent];
+    [NSApp _setCurrentEvent:secondEvent];
+    [targetView pressureChangeWithEvent:secondEvent];
+
+    [NSApp _setCurrentEvent:nil];
+    // WKView caches the most recent pressure event, so send it a nil event to clear the cache.
+    [targetView pressureChangeWithEvent:nil];
+
+    [firstEvent release];
+    [secondEvent release];
+}
+
+void EventSenderProxy::mouseForceChanged(float force)
+{
+    EventSenderPressureEvent *event = [[EventSenderPressureEvent alloc] initAtLocation:NSMakePoint(m_position.x, m_position.y)
+        globalLocation:([m_testController->mainWebView()->platformWindow() convertRectToScreen:NSMakeRect(m_position.x, m_position.y, 1, 1)].origin)
+        stage:force < 1 ? 1 : 2
+        pressure:force
+        phase:NSEventPhaseChanged
+        time:absoluteTimeForEventTime(currentEventTime())
+        eventNumber:++eventNumber];
+
+    NSView *targetView = [m_testController->mainWebView()->platformView() hitTest:[event locationInWindow]];
+    targetView = targetView ? targetView : m_testController->mainWebView()->platformView();
+    ASSERT(targetView);
+    [NSApp _setCurrentEvent:event];
+    [targetView pressureChangeWithEvent:event];
+    [NSApp _setCurrentEvent:nil];
+
+    // WKView caches the most recent pressure event, so send it a nil event to clear the cache.
+    [targetView pressureChangeWithEvent:nil];
+
+    [event release];
+}
+#else
+void EventSenderProxy::mouseForceDown()
+{
+}
+
+void EventSenderProxy::mouseForceUp()
+{
+}
+
+void EventSenderProxy::mouseForceChanged(float)
+{
+}
+#endif // __MAC_OS_X_VERSION_MAX_ALLOWED >= 101003
+
 void EventSenderProxy::mouseMoveTo(double x, double y)
 {
     NSView *view = m_testController->mainWebView()->platformView();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to