Add force property to MouseEvents
authorbdakin@apple.com <bdakin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 13 Apr 2015 19:17:48 +0000 (19:17 +0000)
committerbdakin@apple.com <bdakin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 13 Apr 2015 19:17:48 +0000 (19:17 +0000)
commit6ec2a15ceb091f7e5091ae2a03daa0af66dbdd18
treebd49b2a2643da8fd3954be57a47e4abef919487e
parent4b9e000ab501065c51bbc10fd62327c83d924113
Add force property to MouseEvents
https://bugs.webkit.org/show_bug.cgi?id=143569
-and corresponding-
rdar://problem/20472954

Reviewed by Darin Adler.

Source/WebCore:

This patch removes WebKitMouseForceEvent and uses a MouseEvent everywhere that it
was used. That’s possible because this patch also adds a force property to all
MouseEvents and to PlatformMouseEvent.

Remove WebKitMouseForceEvent.
* CMakeLists.txt:
* DerivedSources.cpp:
* DerivedSources.make:
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.vcxproj/WebCore.vcxproj.filters:
* WebCore.xcodeproj/project.pbxproj:
* dom/DOMAllInOne.cpp:

Create MouseEvents with the appropriate force instead of WebKitMouseForceEvents.
This patch also gets rid of the PlatformMouseEvent parameter for these events.
They were re-using the cached mousedown event before, which they never should have
done. Instead, we create PlatformMouseEvents inside these functions and then use
that to make MouseEvents.
* dom/Element.cpp:
(WebCore::Element::dispatchMouseForceWillBegin):
(WebCore::Element::dispatchMouseForceChanged):
(WebCore::Element::dispatchMouseForceDown):
(WebCore::Element::dispatchMouseForceUp):
(WebCore::Element::dispatchMouseForceClick):
(WebCore::Element::dispatchMouseForceCancelled):
* dom/Element.h:

No More WebKitMouseForceEvent.
* dom/EventNames.in:

Add force to MouseEvent.
* dom/MouseEvent.cpp:
(WebCore::MouseEvent::create):
(WebCore::MouseEvent::MouseEvent):
(WebCore::MouseEvent::cloneFor):
(WebCore::SimulatedMouseEvent::SimulatedMouseEvent):
* dom/MouseEvent.h:
(WebCore::MouseEvent::force):
(WebCore::MouseEvent::setForce):
* dom/MouseEvent.idl:

No More WebKitMouseForceEvent.
* dom/WebKitMouseForceEvent.cpp: Removed.
* dom/WebKitMouseForceEvent.h: Removed.
* dom/WebKitMouseForceEvent.idl: Removed.

PlatformMouseEvent now takes a force parameter.
* dom/WheelEvent.cpp:
(WebCore::WheelEvent::WheelEvent):
* page/ContextMenuController.cpp:
(WebCore::ContextMenuController::showContextMenuAt):
* page/DragController.cpp:
(WebCore::createMouseEvent):
* page/EventHandler.cpp:
(WebCore::EventHandler::dispatchDragEvent):
(WebCore::EventHandler::sendContextMenuEventForKey):
(WebCore::EventHandler::fakeMouseMoveEventTimerFired):

We don’t need lastMouseDownEvent() anymore. We were using it to avoid creating new
PlatformMouseEvents for the force events, but we fix that in this patch.
(WebCore::EventHandler::lastMouseDownEvent): Deleted.
* page/EventHandler.h:

At force to PlatformMouseEvent.
* platform/PlatformMouseEvent.h:
(WebCore::PlatformMouseEvent::PlatformMouseEvent):
(WebCore::PlatformMouseEvent::force):
* replay/SerializationMethods.cpp:
(JSC::EncodingTraits<PlatformMouseEvent>::encodeValue):
(JSC::EncodingTraits<PlatformMouseEvent>::decodeValue):

Source/WebKit/ios:

Send the appropriate force with this simulated click event.
* WebView/WebPDFViewPlaceholder.mm:
(-[WebPDFViewPlaceholder simulateClickOnLinkToURL:]):

Source/WebKit/mac:

PlatformMouseEvent and MouseEvent now take force parameters.
* WebView/WebFrame.mm:
(-[WebFrame _dragSourceEndedAt:operation:]):
* WebView/WebPDFView.mm:
(-[WebPDFView PDFViewWillClickOnLink:withURL:]):

Source/WebKit/win:

PlatformMouseEvent takes a force parameter.
* WebDropSource.cpp:
(generateMouseEvent):

Source/WebKit2:

In order to accommodate adding force to all PlatformMouseEvents, we have to add it
to pass a caches pressure event to NativeWebMouseEvent and add force to
WebMouseEvent.

NativeWebMouseEvent now requires a second NSEvent for the pressureEvent.
* Shared/NativeWebMouseEvent.h:

WebMouseEvent takes a force parameter.
* Shared/WebEvent.h:
(WebKit::WebMouseEvent::force):
* Shared/WebEventConversion.cpp:
(WebKit::WebKit2PlatformMouseEvent::WebKit2PlatformMouseEvent):
* Shared/WebMouseEvent.cpp:
(WebKit::WebMouseEvent::WebMouseEvent):
(WebKit::WebMouseEvent::encode):
(WebKit::WebMouseEvent::decode):
* Shared/mac/NativeWebMouseEventMac.mm:
(WebKit::NativeWebMouseEvent::NativeWebMouseEvent):
* Shared/mac/WebEventFactory.h:
* Shared/mac/WebEventFactory.mm:
(WebKit::WebEventFactory::createWebMouseEvent):

Cache the most recent pressureEvent in _data so that it can be sent along to the
NativeWebMouseEvent constructor.
* UIProcess/API/mac/WKView.mm:
(-[WKView pressureChangeWithEvent:]):
(-[WKView acceptsFirstMouse:]):
(-[WKView shouldDelayWindowOrderingForEvent:]):
(-[WKView _postFakeMouseMovedEventForFlagsChangedEvent:]):
(-[WKView initWithFrame:processPool:configuration:webView:]):

WebMouseEvent takes a force parameter.
* WebProcess/Plugins/PDF/PDFPlugin.mm:
(WebKit::PDFPlugin::showContextMenuAtPoint):
* WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::createWebEvent):

MouseEvent and PlatformMouseEvent both take force parameters too.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::navigateToURLWithSimulatedClick):
(WebKit::WebPage::contextMenuAtPointInWindow):
(WebKit::WebPage::dragEnded):
(WebKit::WebPage::simulateMouseDown):
(WebKit::WebPage::simulateMouseUp):
(WebKit::WebPage::simulateMouseMotion):

The functions that dispatch the force events no longer take a PlatformMouseEvent
as a parameter.
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::inputDeviceForceDidChange):
(WebKit::WebPage::immediateActionDidCancel):

LayoutTests:

* platform/mac-mavericks/js/dom/global-constructors-attributes-expected.txt:
* platform/mac/js/dom/global-constructors-attributes-expected.txt:
* platform/win/js/dom/global-constructors-attributes-expected.txt:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@182748 268f45cc-cd09-0410-ab3c-d52691b4dbfc
49 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/mac-mavericks/js/dom/global-constructors-attributes-expected.txt
LayoutTests/platform/mac/js/dom/global-constructors-attributes-expected.txt
LayoutTests/platform/win/js/dom/global-constructors-attributes-expected.txt
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/DerivedSources.cpp
Source/WebCore/DerivedSources.make
Source/WebCore/WebCore.vcxproj/WebCore.vcxproj
Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/dom/DOMAllInOne.cpp
Source/WebCore/dom/Element.cpp
Source/WebCore/dom/Element.h
Source/WebCore/dom/EventNames.in
Source/WebCore/dom/MouseEvent.cpp
Source/WebCore/dom/MouseEvent.h
Source/WebCore/dom/MouseEvent.idl
Source/WebCore/dom/WebKitMouseForceEvent.cpp [deleted file]
Source/WebCore/dom/WebKitMouseForceEvent.h [deleted file]
Source/WebCore/dom/WebKitMouseForceEvent.idl [deleted file]
Source/WebCore/dom/WheelEvent.cpp
Source/WebCore/page/ContextMenuController.cpp
Source/WebCore/page/DragController.cpp
Source/WebCore/page/EventHandler.cpp
Source/WebCore/page/EventHandler.h
Source/WebCore/platform/PlatformMouseEvent.h
Source/WebCore/replay/SerializationMethods.cpp
Source/WebKit/ios/ChangeLog
Source/WebKit/ios/WebView/WebPDFViewPlaceholder.mm
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebView/WebFrame.mm
Source/WebKit/mac/WebView/WebPDFView.mm
Source/WebKit/win/ChangeLog
Source/WebKit/win/WebDropSource.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/NativeWebMouseEvent.h
Source/WebKit2/Shared/WebEvent.h
Source/WebKit2/Shared/WebEventConversion.cpp
Source/WebKit2/Shared/WebMouseEvent.cpp
Source/WebKit2/Shared/mac/NativeWebMouseEventMac.mm
Source/WebKit2/Shared/mac/WebEventFactory.h
Source/WebKit2/Shared/mac/WebEventFactory.mm
Source/WebKit2/UIProcess/API/mac/WKView.mm
Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.mm
Source/WebKit2/WebProcess/Plugins/PluginView.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.cpp
Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm
Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm