Web Replay: capture and replay mouse events
authorbburg@apple.com <bburg@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 20 Mar 2014 22:14:41 +0000 (22:14 +0000)
committerbburg@apple.com <bburg@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 20 Mar 2014 22:14:41 +0000 (22:14 +0000)
commit1f854f6d66d4b39651f79690bf2e0eb4dd914409
treecd68a9b0700dc9e75e0b7a6305d1aeb8b37d4135
parenta92125622b8dbec1c7100ed68b2bec023fba4247
Web Replay: capture and replay mouse events
https://bugs.webkit.org/show_bug.cgi?id=129395

Reviewed by Joseph Pecoraro.

.:

Create a manual test for capture/replay of mouse events.
Copy over the crypto-md5.js library from SunSpider.

* ManualTests/inspector/replay-mouse-events.html: Added.
* ManualTests/inspector/resources/crypto-md5.js: Added.

Source/WebCore:

Add support for capturing and replaying mouse inputs that come from WebKit2.
Hook up the UserInputBridge to session state changes in the ReplayController so
that the bridge knows when to capture or deny mouse inputs.

Test: ManualTests/inspector/replay-mouse-events.html

* platform/PlatformEvent.h: Give explicit storage types to Modifiers and Type enums
so they can be forward-declared.
* platform/PlatformMouseEvent.h: Give an explicit storage type to enum MouseButton.
Add operator== and operator!= for MouseButton to work around an MSVC bug.

* replay/ReplayController.cpp: Perform session state changes in a helper function, and
at the same time change the state of the page's user input bridge.
(WebCore::ReplayController::setSessionState):
(WebCore::ReplayController::startCapturing):
(WebCore::ReplayController::stopCapturing):
(WebCore::ReplayController::startPlayback):
(WebCore::ReplayController::cancelPlayback):

* replay/ReplayInputDispatchMethods.cpp: Add dispatch methods for new inputs.
(WebCore::HandleMouseMove::dispatch):
(WebCore::HandleMousePress::dispatch):
(WebCore::HandleMouseRelease::dispatch):

* replay/SerializationMethods.cpp: Add helper macros so that encode/decode methods look
symmetric with one data member per line. This helps reduce unintentional inconsistencies.
(JSC::EncodingTraits<PlatformMouseEvent>::encodeValue): Added.
(JSC::EncodingTraits<PlatformMouseEvent>::decodeValue): Added.
* replay/SerializationMethods.h:

* replay/UserInputBridge.cpp: Fill in the bridge method implementations for mouse
events, adding helpers and macros as necessary to reduce boilerplate.
(WebCore::UserInputBridge::activeCursor): Added.
(WebCore::UserInputBridge::handleMousePressEvent):
(WebCore::UserInputBridge::handleMouseReleaseEvent):
(WebCore::UserInputBridge::handleMouseMoveEvent):
(WebCore::UserInputBridge::handleMouseMoveOnScrollbarEvent):

* replay/UserInputBridge.h: Add a bridge state enum along with getters and setters.
The enum value controls whether the bridge should capture commands, deny non-synthetic
commands (from the user), or allow anything to pass (the default).
(WebCore::UserInputBridge::setState): Added.
(WebCore::UserInputBridge::state): Added.

* replay/WebInputs.json: Add inputs HandleMouseMove, HandleMousePress, HandleMouseRelease.
Add enum definitions for PlatformEvent::Type, PlatformEvent::Modifiers, and PlatformMouseEvent::MouseButton.
Alphabetize the existing data type definitions.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@166006 268f45cc-cd09-0410-ab3c-d52691b4dbfc
15 files changed:
ChangeLog
ManualTests/inspector/replay-mouse-events.html [new file with mode: 0644]
ManualTests/inspector/resources/crypto-md5.js [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/platform/PlatformEvent.h
Source/WebCore/platform/PlatformMouseEvent.h
Source/WebCore/platform/win/PlatformMouseEventWin.cpp
Source/WebCore/replay/ReplayController.cpp
Source/WebCore/replay/ReplayController.h
Source/WebCore/replay/ReplayInputDispatchMethods.cpp
Source/WebCore/replay/SerializationMethods.cpp
Source/WebCore/replay/SerializationMethods.h
Source/WebCore/replay/UserInputBridge.cpp
Source/WebCore/replay/UserInputBridge.h
Source/WebCore/replay/WebInputs.json