We'd like to be able to dispatch mouse events via the remote debugging protocol. I plan on adding a hidden Input.dispatchMouseEvent command, which just calls the EventHandler handleMouse*Event methods.
Created attachment 178092 [details] Patch
Comment on attachment 178092 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=178092&action=review > Source/WebCore/inspector/Inspector.json:3291 > + { "name": "button", "type": "string", "enum": ["none", "left", "middle", "right"], "optional": true, "description": "Mouse button (default: \"none\")." }, What would be a reason for sending button=none or clickCount=0? Does it make any sense? > Source/WebCore/inspector/Inspector.json:3293 > + { "name": "x", "type": "integer", "description": "X coordinate of the event relative to the frame's viewport."}, It is always relative to the _main_ frame, the description should reflect this. Alternatively we may pass frame id to specify in which frame the event should be dispatched. > Source/WebCore/inspector/InspectorInputAgent.cpp:101 > + else if (type == "mouseReleased") I think we should teach CodeGeneratorInspector.py to generate string values for enum elements to avoid using constant values like this. But this is not directly related to this change and should be addressed separately.
Created attachment 178584 [details] Patch
(In reply to comment #2) > (From update of attachment 178092 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=178092&action=review > > > Source/WebCore/inspector/Inspector.json:3291 > > + { "name": "button", "type": "string", "enum": ["none", "left", "middle", "right"], "optional": true, "description": "Mouse button (default: \"none\")." }, > > What would be a reason for sending button=none or clickCount=0? Does it make any sense? > button=none and clickCount=0 make sense for mouse moves where the user isn't holding a button down. > > Source/WebCore/inspector/Inspector.json:3293 > > + { "name": "x", "type": "integer", "description": "X coordinate of the event relative to the frame's viewport."}, > > It is always relative to the _main_ frame, the description should reflect this. Alternatively we may pass frame id to specify in which frame the event should be dispatched. I think its best to always use the main frame. Clarified this for the x and y parameters. > > > Source/WebCore/inspector/InspectorInputAgent.cpp:101 > > + else if (type == "mouseReleased") > > I think we should teach CodeGeneratorInspector.py to generate string values for enum elements to avoid using constant values like this. But this is not directly related to this change and should be addressed separately.
Comment on attachment 178584 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=178584&action=review > Source/WebCore/inspector/InspectorInputAgent.cpp:134 > + modifiers ? *modifiers & PlatformEvent::ShiftKey : false, you could do int convertedModifiers = modifiers ? *modifiers : 0; to improve the readability here. > LayoutTests/inspector-protocol/input/dispatchMouseEvent.html:57 > + InspectorTest.sendCommand("Input.dispatchMouseEvent", events.shift(), continueTest); As with keyboard, these will be naturally serialized, so you don't need to wait for previous command to finish in order to start the new one. You only need to wait for the last one to complete before calling completeTest()
Created attachment 178611 [details] Patch
(In reply to comment #5) > (From update of attachment 178584 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=178584&action=review > > > Source/WebCore/inspector/InspectorInputAgent.cpp:134 > > + modifiers ? *modifiers & PlatformEvent::ShiftKey : false, > > you could do int convertedModifiers = modifiers ? *modifiers : 0; to improve the readability here. done > > > LayoutTests/inspector-protocol/input/dispatchMouseEvent.html:57 > > + InspectorTest.sendCommand("Input.dispatchMouseEvent", events.shift(), continueTest); > > As with keyboard, these will be naturally serialized, so you don't need to wait for previous command to finish in order to start the new one. You only need to wait for the last one to complete before calling completeTest() done
Comment on attachment 178611 [details] Patch Clearing flags on attachment: 178611 Committed r137291: <http://trac.webkit.org/changeset/137291>
All reviewed patches have been landed. Closing bug.
This patch introduced the following closure compiler error: yurys@yurys-lin:/sources/WebKit (master)$ Source/WebCore/inspector/compile-front-end.py .... ^ Source/WebCore/inspector/front-end/protocol-externs.js:2939: WARNING - optional arguments must be at the end InputAgent.dispatchMouseEvent = function(type, opt_modifiers, opt_timestamp, opt_button, opt_clickCount, x, y, opt_callback) {} ^ ... We should reorder parameters to pass required ones first.