Commit 04e776d7 authored by Pavel Feldman's avatar Pavel Feldman Committed by Commit Bot

DevTools: use floating point to pass input coordinates in CSS space.

Bug: 
Change-Id: Id828c8df4eed5d104b4ce311bf7aa1f4bcd6411c
Reviewed-on: https://chromium-review.googlesource.com/568701
Commit-Queue: Pavel Feldman <pfeldman@chromium.org>
Reviewed-by: default avatarDmitry Gozman <dgozman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#486161}
parent 631445be
...@@ -27,11 +27,13 @@ namespace protocol { ...@@ -27,11 +27,13 @@ namespace protocol {
namespace { namespace {
gfx::PointF CssPixelsToPointF(int x, int y, float page_scale_factor) { gfx::PointF CssPixelsToPointF(double x, double y, float page_scale_factor) {
return gfx::PointF(x * page_scale_factor, y * page_scale_factor); return gfx::PointF(x * page_scale_factor, y * page_scale_factor);
} }
gfx::Vector2dF CssPixelsToVector2dF(int x, int y, float page_scale_factor) { gfx::Vector2dF CssPixelsToVector2dF(double x,
double y,
float page_scale_factor) {
return gfx::Vector2dF(x * page_scale_factor, y * page_scale_factor); return gfx::Vector2dF(x * page_scale_factor, y * page_scale_factor);
} }
...@@ -344,8 +346,8 @@ void InputHandler::DispatchKeyEvent( ...@@ -344,8 +346,8 @@ void InputHandler::DispatchKeyEvent(
void InputHandler::DispatchMouseEvent( void InputHandler::DispatchMouseEvent(
const std::string& type, const std::string& type,
int x, double x,
int y, double y,
Maybe<int> modifiers, Maybe<int> modifiers,
Maybe<double> timestamp, Maybe<double> timestamp,
Maybe<std::string> button, Maybe<std::string> button,
...@@ -476,8 +478,8 @@ Response InputHandler::SetIgnoreInputEvents(bool ignore) { ...@@ -476,8 +478,8 @@ Response InputHandler::SetIgnoreInputEvents(bool ignore) {
} }
void InputHandler::SynthesizePinchGesture( void InputHandler::SynthesizePinchGesture(
int x, double x,
int y, double y,
double scale_factor, double scale_factor,
Maybe<int> relative_speed, Maybe<int> relative_speed,
Maybe<std::string> gesture_source_type, Maybe<std::string> gesture_source_type,
...@@ -515,12 +517,12 @@ void InputHandler::SynthesizePinchGesture( ...@@ -515,12 +517,12 @@ void InputHandler::SynthesizePinchGesture(
} }
void InputHandler::SynthesizeScrollGesture( void InputHandler::SynthesizeScrollGesture(
int x, double x,
int y, double y,
Maybe<int> x_distance, Maybe<double> x_distance,
Maybe<int> y_distance, Maybe<double> y_distance,
Maybe<int> x_overscroll, Maybe<double> x_overscroll,
Maybe<int> y_overscroll, Maybe<double> y_overscroll,
Maybe<bool> prevent_fling, Maybe<bool> prevent_fling,
Maybe<int> speed, Maybe<int> speed,
Maybe<std::string> gesture_source_type, Maybe<std::string> gesture_source_type,
...@@ -621,8 +623,8 @@ void InputHandler::OnScrollFinished( ...@@ -621,8 +623,8 @@ void InputHandler::OnScrollFinished(
} }
void InputHandler::SynthesizeTapGesture( void InputHandler::SynthesizeTapGesture(
int x, double x,
int y, double y,
Maybe<int> duration, Maybe<int> duration,
Maybe<int> tap_count, Maybe<int> tap_count,
Maybe<std::string> gesture_source_type, Maybe<std::string> gesture_source_type,
......
...@@ -57,8 +57,8 @@ class InputHandler : public DevToolsDomainHandler, ...@@ -57,8 +57,8 @@ class InputHandler : public DevToolsDomainHandler,
void DispatchMouseEvent( void DispatchMouseEvent(
const std::string& type, const std::string& type,
int x, double x,
int y, double y,
Maybe<int> modifiers, Maybe<int> modifiers,
Maybe<double> timestamp, Maybe<double> timestamp,
Maybe<std::string> button, Maybe<std::string> button,
...@@ -78,20 +78,20 @@ class InputHandler : public DevToolsDomainHandler, ...@@ -78,20 +78,20 @@ class InputHandler : public DevToolsDomainHandler,
Response SetIgnoreInputEvents(bool ignore) override; Response SetIgnoreInputEvents(bool ignore) override;
void SynthesizePinchGesture( void SynthesizePinchGesture(
int x, double x,
int y, double y,
double scale_factor, double scale_factor,
Maybe<int> relative_speed, Maybe<int> relative_speed,
Maybe<std::string> gesture_source_type, Maybe<std::string> gesture_source_type,
std::unique_ptr<SynthesizePinchGestureCallback> callback) override; std::unique_ptr<SynthesizePinchGestureCallback> callback) override;
void SynthesizeScrollGesture( void SynthesizeScrollGesture(
int x, double x,
int y, double y,
Maybe<int> x_distance, Maybe<double> x_distance,
Maybe<int> y_distance, Maybe<double> y_distance,
Maybe<int> x_overscroll, Maybe<double> x_overscroll,
Maybe<int> y_overscroll, Maybe<double> y_overscroll,
Maybe<bool> prevent_fling, Maybe<bool> prevent_fling,
Maybe<int> speed, Maybe<int> speed,
Maybe<std::string> gesture_source_type, Maybe<std::string> gesture_source_type,
...@@ -101,8 +101,8 @@ class InputHandler : public DevToolsDomainHandler, ...@@ -101,8 +101,8 @@ class InputHandler : public DevToolsDomainHandler,
std::unique_ptr<SynthesizeScrollGestureCallback> callback) override; std::unique_ptr<SynthesizeScrollGestureCallback> callback) override;
void SynthesizeTapGesture( void SynthesizeTapGesture(
int x, double x,
int y, double y,
Maybe<int> duration, Maybe<int> duration,
Maybe<int> tap_count, Maybe<int> tap_count,
Maybe<std::string> gesture_source_type, Maybe<std::string> gesture_source_type,
......
...@@ -3571,8 +3571,8 @@ ...@@ -3571,8 +3571,8 @@
"name": "dispatchMouseEvent", "name": "dispatchMouseEvent",
"parameters": [ "parameters": [
{ "name": "type", "type": "string", "enum": ["mousePressed", "mouseReleased", "mouseMoved"], "description": "Type of the mouse event." }, { "name": "type", "type": "string", "enum": ["mousePressed", "mouseReleased", "mouseMoved"], "description": "Type of the mouse event." },
{ "name": "x", "type": "integer", "description": "X coordinate of the event relative to the main frame's viewport."}, { "name": "x", "type": "number", "description": "X coordinate of the event relative to the main frame's viewport."},
{ "name": "y", "type": "integer", "description": "Y coordinate of the event relative to the main frame's viewport. 0 refers to the top of the viewport and Y increases as it proceeds towards the bottom of the viewport."}, { "name": "y", "type": "number", "description": "Y coordinate of the event relative to the main frame's viewport. 0 refers to the top of the viewport and Y increases as it proceeds towards the bottom of the viewport."},
{ "name": "modifiers", "type": "integer", "optional": true, "description": "Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8 (default: 0)." }, { "name": "modifiers", "type": "integer", "optional": true, "description": "Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8 (default: 0)." },
{ "name": "timestamp", "type": "number", "optional": true, "description": "Time at which the event occurred. Measured in UTC time in seconds since January 1, 1970 (default: current time)." }, { "name": "timestamp", "type": "number", "optional": true, "description": "Time at which the event occurred. Measured in UTC time in seconds since January 1, 1970 (default: current time)." },
{ "name": "button", "type": "string", "enum": ["none", "left", "middle", "right"], "optional": true, "description": "Mouse button (default: \"none\")." }, { "name": "button", "type": "string", "enum": ["none", "left", "middle", "right"], "optional": true, "description": "Mouse button (default: \"none\")." },
...@@ -3613,8 +3613,8 @@ ...@@ -3613,8 +3613,8 @@
"name": "synthesizePinchGesture", "name": "synthesizePinchGesture",
"async": true, "async": true,
"parameters": [ "parameters": [
{ "name": "x", "type": "integer", "description": "X coordinate of the start of the gesture in CSS pixels." }, { "name": "x", "type": "number", "description": "X coordinate of the start of the gesture in CSS pixels." },
{ "name": "y", "type": "integer", "description": "Y coordinate of the start of the gesture in CSS pixels." }, { "name": "y", "type": "number", "description": "Y coordinate of the start of the gesture in CSS pixels." },
{ "name": "scaleFactor", "type": "number", "description": "Relative scale factor after zooming (>1.0 zooms in, <1.0 zooms out)." }, { "name": "scaleFactor", "type": "number", "description": "Relative scale factor after zooming (>1.0 zooms in, <1.0 zooms out)." },
{ "name": "relativeSpeed", "type": "integer", "optional": true, "description": "Relative pointer speed in pixels per second (default: 800)." }, { "name": "relativeSpeed", "type": "integer", "optional": true, "description": "Relative pointer speed in pixels per second (default: 800)." },
{ "name": "gestureSourceType", "$ref": "GestureSourceType", "optional": true, "description": "Which type of input events to be generated (default: 'default', which queries the platform for the preferred input type)." } { "name": "gestureSourceType", "$ref": "GestureSourceType", "optional": true, "description": "Which type of input events to be generated (default: 'default', which queries the platform for the preferred input type)." }
...@@ -3627,12 +3627,12 @@ ...@@ -3627,12 +3627,12 @@
"name": "synthesizeScrollGesture", "name": "synthesizeScrollGesture",
"async": true, "async": true,
"parameters": [ "parameters": [
{ "name": "x", "type": "integer", "description": "X coordinate of the start of the gesture in CSS pixels." }, { "name": "x", "type": "number", "description": "X coordinate of the start of the gesture in CSS pixels." },
{ "name": "y", "type": "integer", "description": "Y coordinate of the start of the gesture in CSS pixels." }, { "name": "y", "type": "number", "description": "Y coordinate of the start of the gesture in CSS pixels." },
{ "name": "xDistance", "type": "integer", "optional": true, "description": "The distance to scroll along the X axis (positive to scroll left)." }, { "name": "xDistance", "type": "number", "optional": true, "description": "The distance to scroll along the X axis (positive to scroll left)." },
{ "name": "yDistance", "type": "integer", "optional": true, "description": "The distance to scroll along the Y axis (positive to scroll up)." }, { "name": "yDistance", "type": "number", "optional": true, "description": "The distance to scroll along the Y axis (positive to scroll up)." },
{ "name": "xOverscroll", "type": "integer", "optional": true, "description": "The number of additional pixels to scroll back along the X axis, in addition to the given distance." }, { "name": "xOverscroll", "type": "number", "optional": true, "description": "The number of additional pixels to scroll back along the X axis, in addition to the given distance." },
{ "name": "yOverscroll", "type": "integer", "optional": true, "description": "The number of additional pixels to scroll back along the Y axis, in addition to the given distance." }, { "name": "yOverscroll", "type": "number", "optional": true, "description": "The number of additional pixels to scroll back along the Y axis, in addition to the given distance." },
{ "name": "preventFling", "type": "boolean", "optional": true, "description": "Prevent fling (default: true)." }, { "name": "preventFling", "type": "boolean", "optional": true, "description": "Prevent fling (default: true)." },
{ "name": "speed", "type": "integer", "optional": true, "description": "Swipe speed in pixels per second (default: 800)." }, { "name": "speed", "type": "integer", "optional": true, "description": "Swipe speed in pixels per second (default: 800)." },
{ "name": "gestureSourceType", "$ref": "GestureSourceType", "optional": true, "description": "Which type of input events to be generated (default: 'default', which queries the platform for the preferred input type)." }, { "name": "gestureSourceType", "$ref": "GestureSourceType", "optional": true, "description": "Which type of input events to be generated (default: 'default', which queries the platform for the preferred input type)." },
...@@ -3648,8 +3648,8 @@ ...@@ -3648,8 +3648,8 @@
"name": "synthesizeTapGesture", "name": "synthesizeTapGesture",
"async": true, "async": true,
"parameters": [ "parameters": [
{ "name": "x", "type": "integer", "description": "X coordinate of the start of the gesture in CSS pixels." }, { "name": "x", "type": "number", "description": "X coordinate of the start of the gesture in CSS pixels." },
{ "name": "y", "type": "integer", "description": "Y coordinate of the start of the gesture in CSS pixels." }, { "name": "y", "type": "number", "description": "Y coordinate of the start of the gesture in CSS pixels." },
{ "name": "duration", "type": "integer", "optional": true, "description": "Duration between touchdown and touchup events in ms (default: 50)." }, { "name": "duration", "type": "integer", "optional": true, "description": "Duration between touchdown and touchup events in ms (default: 50)." },
{ "name": "tapCount", "type": "integer", "optional": true, "description": "Number of times to perform the tap (e.g. 2 for double tap, default: 1)." }, { "name": "tapCount", "type": "integer", "optional": true, "description": "Number of times to perform the tap (e.g. 2 for double tap, default: 1)." },
{ "name": "gestureSourceType", "$ref": "GestureSourceType", "optional": true, "description": "Which type of input events to be generated (default: 'default', which queries the platform for the preferred input type)." } { "name": "gestureSourceType", "$ref": "GestureSourceType", "optional": true, "description": "Which type of input events to be generated (default: 'default', which queries the platform for the preferred input type)." }
......
...@@ -3982,8 +3982,8 @@ ...@@ -3982,8 +3982,8 @@
"name": "dispatchMouseEvent", "name": "dispatchMouseEvent",
"parameters": [ "parameters": [
{ "name": "type", "type": "string", "enum": ["mousePressed", "mouseReleased", "mouseMoved"], "description": "Type of the mouse event." }, { "name": "type", "type": "string", "enum": ["mousePressed", "mouseReleased", "mouseMoved"], "description": "Type of the mouse event." },
{ "name": "x", "type": "integer", "description": "X coordinate of the event relative to the main frame's viewport."}, { "name": "x", "type": "number", "description": "X coordinate of the event relative to the main frame's viewport in CSS pixels."},
{ "name": "y", "type": "integer", "description": "Y coordinate of the event relative to the main frame's viewport. 0 refers to the top of the viewport and Y increases as it proceeds towards the bottom of the viewport."}, { "name": "y", "type": "number", "description": "Y coordinate of the event relative to the main frame's viewport in CSS pixels. 0 refers to the top of the viewport and Y increases as it proceeds towards the bottom of the viewport."},
{ "name": "modifiers", "type": "integer", "optional": true, "description": "Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8 (default: 0)." }, { "name": "modifiers", "type": "integer", "optional": true, "description": "Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8 (default: 0)." },
{ "name": "timestamp", "$ref": "TimeSinceEpoch", "optional": true, "description": "Time at which the event occurred." }, { "name": "timestamp", "$ref": "TimeSinceEpoch", "optional": true, "description": "Time at which the event occurred." },
{ "name": "button", "type": "string", "enum": ["none", "left", "middle", "right"], "optional": true, "description": "Mouse button (default: \"none\")." }, { "name": "button", "type": "string", "enum": ["none", "left", "middle", "right"], "optional": true, "description": "Mouse button (default: \"none\")." },
...@@ -4021,8 +4021,8 @@ ...@@ -4021,8 +4021,8 @@
{ {
"name": "synthesizePinchGesture", "name": "synthesizePinchGesture",
"parameters": [ "parameters": [
{ "name": "x", "type": "integer", "description": "X coordinate of the start of the gesture in CSS pixels." }, { "name": "x", "type": "number", "description": "X coordinate of the start of the gesture in CSS pixels." },
{ "name": "y", "type": "integer", "description": "Y coordinate of the start of the gesture in CSS pixels." }, { "name": "y", "type": "number", "description": "Y coordinate of the start of the gesture in CSS pixels." },
{ "name": "scaleFactor", "type": "number", "description": "Relative scale factor after zooming (>1.0 zooms in, <1.0 zooms out)." }, { "name": "scaleFactor", "type": "number", "description": "Relative scale factor after zooming (>1.0 zooms in, <1.0 zooms out)." },
{ "name": "relativeSpeed", "type": "integer", "optional": true, "description": "Relative pointer speed in pixels per second (default: 800)." }, { "name": "relativeSpeed", "type": "integer", "optional": true, "description": "Relative pointer speed in pixels per second (default: 800)." },
{ "name": "gestureSourceType", "$ref": "GestureSourceType", "optional": true, "description": "Which type of input events to be generated (default: 'default', which queries the platform for the preferred input type)." } { "name": "gestureSourceType", "$ref": "GestureSourceType", "optional": true, "description": "Which type of input events to be generated (default: 'default', which queries the platform for the preferred input type)." }
...@@ -4033,12 +4033,12 @@ ...@@ -4033,12 +4033,12 @@
{ {
"name": "synthesizeScrollGesture", "name": "synthesizeScrollGesture",
"parameters": [ "parameters": [
{ "name": "x", "type": "integer", "description": "X coordinate of the start of the gesture in CSS pixels." }, { "name": "x", "type": "number", "description": "X coordinate of the start of the gesture in CSS pixels." },
{ "name": "y", "type": "integer", "description": "Y coordinate of the start of the gesture in CSS pixels." }, { "name": "y", "type": "number", "description": "Y coordinate of the start of the gesture in CSS pixels." },
{ "name": "xDistance", "type": "integer", "optional": true, "description": "The distance to scroll along the X axis (positive to scroll left)." }, { "name": "xDistance", "type": "number", "optional": true, "description": "The distance to scroll along the X axis (positive to scroll left)." },
{ "name": "yDistance", "type": "integer", "optional": true, "description": "The distance to scroll along the Y axis (positive to scroll up)." }, { "name": "yDistance", "type": "number", "optional": true, "description": "The distance to scroll along the Y axis (positive to scroll up)." },
{ "name": "xOverscroll", "type": "integer", "optional": true, "description": "The number of additional pixels to scroll back along the X axis, in addition to the given distance." }, { "name": "xOverscroll", "type": "number", "optional": true, "description": "The number of additional pixels to scroll back along the X axis, in addition to the given distance." },
{ "name": "yOverscroll", "type": "integer", "optional": true, "description": "The number of additional pixels to scroll back along the Y axis, in addition to the given distance." }, { "name": "yOverscroll", "type": "number", "optional": true, "description": "The number of additional pixels to scroll back along the Y axis, in addition to the given distance." },
{ "name": "preventFling", "type": "boolean", "optional": true, "description": "Prevent fling (default: true)." }, { "name": "preventFling", "type": "boolean", "optional": true, "description": "Prevent fling (default: true)." },
{ "name": "speed", "type": "integer", "optional": true, "description": "Swipe speed in pixels per second (default: 800)." }, { "name": "speed", "type": "integer", "optional": true, "description": "Swipe speed in pixels per second (default: 800)." },
{ "name": "gestureSourceType", "$ref": "GestureSourceType", "optional": true, "description": "Which type of input events to be generated (default: 'default', which queries the platform for the preferred input type)." }, { "name": "gestureSourceType", "$ref": "GestureSourceType", "optional": true, "description": "Which type of input events to be generated (default: 'default', which queries the platform for the preferred input type)." },
...@@ -4052,8 +4052,8 @@ ...@@ -4052,8 +4052,8 @@
{ {
"name": "synthesizeTapGesture", "name": "synthesizeTapGesture",
"parameters": [ "parameters": [
{ "name": "x", "type": "integer", "description": "X coordinate of the start of the gesture in CSS pixels." }, { "name": "x", "type": "number", "description": "X coordinate of the start of the gesture in CSS pixels." },
{ "name": "y", "type": "integer", "description": "Y coordinate of the start of the gesture in CSS pixels." }, { "name": "y", "type": "number", "description": "Y coordinate of the start of the gesture in CSS pixels." },
{ "name": "duration", "type": "integer", "optional": true, "description": "Duration between touchdown and touchup events in ms (default: 50)." }, { "name": "duration", "type": "integer", "optional": true, "description": "Duration between touchdown and touchup events in ms (default: 50)." },
{ "name": "tapCount", "type": "integer", "optional": true, "description": "Number of times to perform the tap (e.g. 2 for double tap, default: 1)." }, { "name": "tapCount", "type": "integer", "optional": true, "description": "Number of times to perform the tap (e.g. 2 for double tap, default: 1)." },
{ "name": "gestureSourceType", "$ref": "GestureSourceType", "optional": true, "description": "Which type of input events to be generated (default: 'default', which queries the platform for the preferred input type)." } { "name": "gestureSourceType", "$ref": "GestureSourceType", "optional": true, "description": "Which type of input events to be generated (default: 'default', which queries the platform for the preferred input type)." }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment