| Index: third_party/WebKit/Source/core/inspector/InspectorInputAgent.cpp
|
| diff --git a/third_party/WebKit/Source/core/inspector/InspectorInputAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorInputAgent.cpp
|
| index e44182dc9424e88033cdd6ebea2146d43798732d..b709a77d52e9db8b31fa603b807c905b1fbbed9f 100644
|
| --- a/third_party/WebKit/Source/core/inspector/InspectorInputAgent.cpp
|
| +++ b/third_party/WebKit/Source/core/inspector/InspectorInputAgent.cpp
|
| @@ -55,18 +55,16 @@ enum Modifiers {
|
| ShiftKey = 1 << 3
|
| };
|
|
|
| -unsigned GetEventModifiers(const int* modifiers)
|
| +unsigned GetEventModifiers(int modifiers)
|
| {
|
| - if (!modifiers)
|
| - return 0;
|
| unsigned platformModifiers = 0;
|
| - if (*modifiers & AltKey)
|
| + if (modifiers & AltKey)
|
| platformModifiers |= blink::PlatformEvent::AltKey;
|
| - if (*modifiers & CtrlKey)
|
| + if (modifiers & CtrlKey)
|
| platformModifiers |= blink::PlatformEvent::CtrlKey;
|
| - if (*modifiers & MetaKey)
|
| + if (modifiers & MetaKey)
|
| platformModifiers |= blink::PlatformEvent::MetaKey;
|
| - if (*modifiers & ShiftKey)
|
| + if (modifiers & ShiftKey)
|
| platformModifiers |= blink::PlatformEvent::ShiftKey;
|
| return platformModifiers;
|
| }
|
| @@ -120,7 +118,7 @@ InspectorInputAgent::~InspectorInputAgent()
|
| {
|
| }
|
|
|
| -void InspectorInputAgent::dispatchTouchEvent(ErrorString* error, const String& type, const RefPtr<JSONArray>& touchPoints, const int* modifiers, const double* timestamp)
|
| +void InspectorInputAgent::dispatchTouchEvent(ErrorString* error, const String& type, PassOwnPtr<protocol::Array<protocol::Input::TouchPoint>> touchPoints, const protocol::OptionalValue<int>& modifiers, const protocol::OptionalValue<double>& timestamp)
|
| {
|
| PlatformEvent::Type convertedType;
|
| if (type == "touchStart") {
|
| @@ -134,40 +132,35 @@ void InspectorInputAgent::dispatchTouchEvent(ErrorString* error, const String& t
|
| return;
|
| }
|
|
|
| - unsigned convertedModifiers = GetEventModifiers(modifiers);
|
| + unsigned convertedModifiers = GetEventModifiers(modifiers.get(0));
|
|
|
| - SyntheticInspectorTouchEvent event(convertedType, convertedModifiers, timestamp ? *timestamp : currentTime());
|
| + SyntheticInspectorTouchEvent event(convertedType, convertedModifiers, timestamp.get(currentTime()));
|
|
|
| int autoId = 0;
|
| - for (auto& touchPoint : *touchPoints) {
|
| - RefPtr<JSONObject> pointObj;
|
| - String state;
|
| - int x, y, radiusX, radiusY, id;
|
| - double rotationAngle, force;
|
| - touchPoint->asObject(&pointObj);
|
| - if (!pointObj->getString("state", &state)) {
|
| + for (size_t i = 0; i < touchPoints->length(); ++i) {
|
| + OwnPtr<protocol::Input::TouchPoint> point = touchPoints->get(i);
|
| + if (!point->hasState()) {
|
| *error = "TouchPoint missing 'state'";
|
| return;
|
| }
|
| - if (!pointObj->getNumber("x", &x)) {
|
| + if (!point->hasX()) {
|
| *error = "TouchPoint missing 'x' coordinate";
|
| return;
|
| }
|
| - if (!pointObj->getNumber("y", &y)) {
|
| + if (!point->hasY()) {
|
| *error = "TouchPoint missing 'y' coordinate";
|
| return;
|
| }
|
| - if (!pointObj->getNumber("radiusX", &radiusX))
|
| - radiusX = 1;
|
| - if (!pointObj->getNumber("radiusY", &radiusY))
|
| - radiusY = 1;
|
| - if (!pointObj->getNumber("rotationAngle", &rotationAngle))
|
| - rotationAngle = 0.0f;
|
| - if (!pointObj->getNumber("force", &force))
|
| - force = 1.0f;
|
| - if (pointObj->getNumber("id", &id)) {
|
| + int radiusX = point->getRadiusX(1);
|
| + int radiusY = point->getRadiusY(1);
|
| + double rotationAngle = point->getRotationAngle(0.0);
|
| + double force = point->getForce(1.0);
|
| + int id;
|
| + if (point->hasId()) {
|
| if (autoId > 0)
|
| id = -1;
|
| + else
|
| + id = point->getId(0);
|
| autoId = -1;
|
| } else {
|
| id = autoId++;
|
| @@ -178,6 +171,7 @@ void InspectorInputAgent::dispatchTouchEvent(ErrorString* error, const String& t
|
| }
|
|
|
| PlatformTouchPoint::State convertedState;
|
| + String state = point->getState();
|
| if (state == "touchPressed") {
|
| convertedState = PlatformTouchPoint::TouchPressed;
|
| } else if (state == "touchReleased") {
|
| @@ -196,10 +190,10 @@ void InspectorInputAgent::dispatchTouchEvent(ErrorString* error, const String& t
|
| // Some platforms may have flipped coordinate systems, but the given coordinates
|
| // assume the origin is in the top-left of the window. Convert.
|
| IntPoint convertedPoint, globalPoint;
|
| - ConvertInspectorPoint(m_inspectedFrames->root(), IntPoint(x, y), &convertedPoint, &globalPoint);
|
| + ConvertInspectorPoint(m_inspectedFrames->root(), IntPoint(point->getX(), point->getY()), &convertedPoint, &globalPoint);
|
|
|
| - SyntheticInspectorTouchPoint point(id++, convertedState, globalPoint, convertedPoint, radiusX, radiusY, rotationAngle, force);
|
| - event.append(point);
|
| + SyntheticInspectorTouchPoint touchPoint(id++, convertedState, globalPoint, convertedPoint, radiusX, radiusY, rotationAngle, force);
|
| + event.append(touchPoint);
|
| }
|
|
|
| m_inspectedFrames->root()->eventHandler().handleTouchEvent(event);
|
|
|