Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(401)

Unified Diff: third_party/WebKit/Source/core/inspector/InspectorInputAgent.cpp

Issue 2646163002: Remove PlatformTouchEvent/Point and use WebTouchEvent/Point instead (Closed)
Patch Set: Fix nit Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 6d0cb045935a9705ff12030cf12f74d9432ed20b..2bf479a072a93791897613e8fb58dd480a99df71 100644
--- a/third_party/WebKit/Source/core/inspector/InspectorInputAgent.cpp
+++ b/third_party/WebKit/Source/core/inspector/InspectorInputAgent.cpp
@@ -36,12 +36,11 @@
#include "core/page/ChromeClient.h"
#include "core/page/Page.h"
#include "platform/PlatformEvent.h"
-#include "platform/PlatformTouchEvent.h"
-#include "platform/PlatformTouchPoint.h"
#include "platform/geometry/FloatSize.h"
#include "platform/geometry/IntPoint.h"
#include "platform/geometry/IntRect.h"
#include "platform/geometry/IntSize.h"
+#include "public/platform/WebTouchEvent.h"
#include "wtf/CurrentTime.h"
#include "wtf/Time.h"
@@ -84,38 +83,42 @@ TimeTicks GetEventTimeStamp(const blink::protocol::Maybe<double>& timestamp) {
return TimeTicks::Now();
}
-class SyntheticInspectorTouchPoint : public blink::PlatformTouchPoint {
+class SyntheticInspectorTouchPoint : public blink::WebTouchPoint {
public:
- SyntheticInspectorTouchPoint(int id,
- TouchState state,
+ SyntheticInspectorTouchPoint(int idParam,
+ State stateParam,
const blink::IntPoint& screenPos,
const blink::IntPoint& pos,
- int radiusX,
- int radiusY,
- double rotationAngle,
- double force) {
- m_pointerProperties.id = id;
- m_screenPos = screenPos;
- m_pos = pos;
- m_state = state;
- m_radius = blink::FloatSize(radiusX, radiusY);
- m_rotationAngle = rotationAngle;
- m_pointerProperties.force = force;
+ int radiusXParam,
+ int radiusYParam,
+ double rotationAngleParam,
+ double forceParam) {
+ id = idParam;
+ screenPosition = screenPos;
+ position = pos;
+ state = stateParam;
+ radiusX = radiusXParam;
+ radiusY = radiusYParam;
+ rotationAngle = rotationAngleParam;
+ force = forceParam;
}
};
-class SyntheticInspectorTouchEvent : public blink::PlatformTouchEvent {
+class SyntheticInspectorTouchEvent : public blink::WebTouchEvent {
public:
- SyntheticInspectorTouchEvent(const blink::PlatformEvent::EventType type,
+ SyntheticInspectorTouchEvent(const blink::WebInputEvent::Type type,
unsigned modifiers,
TimeTicks timestamp) {
m_type = type;
m_modifiers = modifiers;
- m_timestamp = timestamp;
+ m_timeStampSeconds = timestamp.InSeconds();
}
- void append(const blink::PlatformTouchPoint& point) {
- m_touchPoints.push_back(point);
+ void append(const blink::WebTouchPoint& point) {
+ if (touchesLength < kTouchesLengthCap) {
+ touches[touchesLength] = point;
+ touchesLength++;
+ }
}
};
@@ -146,13 +149,13 @@ Response InspectorInputAgent::dispatchTouchEvent(
std::unique_ptr<protocol::Array<protocol::Input::TouchPoint>> touchPoints,
protocol::Maybe<int> modifiers,
protocol::Maybe<double> timestamp) {
- PlatformEvent::EventType convertedType;
+ WebInputEvent::Type convertedType;
if (type == "touchStart")
- convertedType = PlatformEvent::TouchStart;
+ convertedType = WebInputEvent::TouchStart;
else if (type == "touchEnd")
- convertedType = PlatformEvent::TouchEnd;
+ convertedType = WebInputEvent::TouchEnd;
else if (type == "touchMove")
- convertedType = PlatformEvent::TouchMove;
+ convertedType = WebInputEvent::TouchMove;
else
return Response::Error(String("Unrecognized type: " + type));
@@ -184,18 +187,18 @@ Response InspectorInputAgent::dispatchTouchEvent(
"integer ids.");
}
- PlatformTouchPoint::TouchState convertedState;
+ WebTouchPoint::State convertedState;
String state = point->getState();
if (state == "touchPressed")
- convertedState = PlatformTouchPoint::TouchPressed;
+ convertedState = WebTouchPoint::StatePressed;
else if (state == "touchReleased")
- convertedState = PlatformTouchPoint::TouchReleased;
+ convertedState = WebTouchPoint::StateReleased;
else if (state == "touchMoved")
- convertedState = PlatformTouchPoint::TouchMoved;
+ convertedState = WebTouchPoint::StateMoved;
else if (state == "touchStationary")
- convertedState = PlatformTouchPoint::TouchStationary;
+ convertedState = WebTouchPoint::StateStationary;
else if (state == "touchCancelled")
- convertedState = PlatformTouchPoint::TouchCancelled;
+ convertedState = WebTouchPoint::StateCancelled;
else
return Response::Error(String("Unrecognized state: " + state));
@@ -212,9 +215,14 @@ Response InspectorInputAgent::dispatchTouchEvent(
event.append(touchPoint);
}
+ // The generated touchpoints are in root frame co-ordinates
+ // so set the scale to 1 and the the translation to zero.
+ event.setFrameScale(1);
+ event.setFrameTranslate(WebFloatPoint());
+
// TODO: We need to add the support for generating coalesced events in
// the devtools.
- Vector<PlatformTouchEvent> coalescedEvents;
+ Vector<WebTouchEvent> coalescedEvents;
m_inspectedFrames->root()->eventHandler().handleTouchEvent(event,
coalescedEvents);
« no previous file with comments | « third_party/WebKit/Source/core/inspector/InspectorDOMAgent.cpp ('k') | third_party/WebKit/Source/platform/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698