Commit cdf8eb5f authored by thakis@chromium.org's avatar thakis@chromium.org

Revert of Revert of Remove smiluate-touch-screen-with-mouse content flag....

Revert of Revert of Remove smiluate-touch-screen-with-mouse content flag. (https://codereview.chromium.org/260123003/)

Reason for revert:
I meant to revert https://codereview.chromium.org/250923005/ , not this one.

Original issue's description:
> Revert of Remove smiluate-touch-screen-with-mouse content flag. (https://codereview.chromium.org/258503003/)
> 
> Reason for revert:
> Somewhat speculative; looks like this caused TouchEmulatorTest failures on valgrind:
> 
> http://build.chromium.org/p/chromium.memory.fyi/builders/Linux%20Tests%20%28tsan%29%283%29/builds/11052
> 
> TouchEmulatorTest.Pinch:
> ../../content/browser/renderer_host/input/touch_emulator_unittest.cc:254: Failure
> Value of: ExpectedEvents()
> Actual: "TouchEnd GestureFlingStart"
> Expected: "TouchEnd GestureScrollEnd"
> 
> etc
> 
> Original issue's description:
> > Remove smiluate-touch-screen-with-mouse content flag.
> > 
> > This is duplicated functionality now, as one can use DevTools touch emulation instead.
> > 
> > BUG=337142
> > 
> > Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=266549
> 
> TBR=aelias@chromium.org,jochen@chromium.org,dgozman@chromium.org
> NOTREECHECKS=true
> NOTRY=true
> BUG=337142
> 
> Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=266608

TBR=aelias@chromium.org,jochen@chromium.org,dgozman@chromium.org
NOTREECHECKS=true
NOTRY=true
BUG=337142

Review URL: https://codereview.chromium.org/256203003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@266609 0039d316-1c4b-4281-b951-d872f2087c98
parent aa00a1a1
......@@ -99,24 +99,6 @@ TouchEventQueue::TouchScrollingMode GetTouchScrollingMode() {
return TouchEventQueue::TOUCH_SCROLLING_MODE_DEFAULT;
}
GestureEventWithLatencyInfo MakeGestureEvent(WebInputEvent::Type type,
double timestamp_seconds,
int x,
int y,
int modifiers,
const ui::LatencyInfo& latency) {
WebGestureEvent result;
result.type = type;
result.x = x;
result.y = y;
result.sourceDevice = WebGestureEvent::Touchscreen;
result.timeStampSeconds = timestamp_seconds;
result.modifiers = modifiers;
return GestureEventWithLatencyInfo(result, latency);
}
const char* GetEventAckName(InputEventAckState ack_result) {
switch(ack_result) {
case INPUT_EVENT_ACK_STATE_UNKNOWN: return "UNKNOWN";
......@@ -184,14 +166,6 @@ bool InputRouterImpl::SendInput(scoped_ptr<IPC::Message> message) {
void InputRouterImpl::SendMouseEvent(
const MouseEventWithLatencyInfo& mouse_event) {
// Order is important here; we need to convert all MouseEvents before they
// propagate further, e.g., to the tap suppression controller.
if (CommandLine::ForCurrentProcess()->HasSwitch(
switches::kSimulateTouchScreenWithMouse)) {
SimulateTouchGestureWithMouse(mouse_event);
return;
}
if (mouse_event.event.type == WebInputEvent::MouseDown &&
gesture_event_queue_.GetTouchpadTapSuppressionController()->
ShouldDeferMouseDown(mouse_event))
......@@ -728,86 +702,6 @@ void InputRouterImpl::ProcessAckForOverscroll(const WebInputEvent& event,
event, (INPUT_EVENT_ACK_STATE_CONSUMED == ack_result));
}
void InputRouterImpl::SimulateTouchGestureWithMouse(
const MouseEventWithLatencyInfo& event) {
const WebMouseEvent& mouse_event = event.event;
int x = mouse_event.x, y = mouse_event.y;
float dx = mouse_event.movementX, dy = mouse_event.movementY;
static int startX = 0, startY = 0;
switch (mouse_event.button) {
case WebMouseEvent::ButtonLeft:
if (mouse_event.type == WebInputEvent::MouseDown) {
startX = x;
startY = y;
SendGestureEvent(MakeGestureEvent(
WebInputEvent::GestureScrollBegin, mouse_event.timeStampSeconds,
x, y, 0, event.latency));
}
if (dx != 0 || dy != 0) {
GestureEventWithLatencyInfo gesture_event = MakeGestureEvent(
WebInputEvent::GestureScrollUpdate, mouse_event.timeStampSeconds,
x, y, 0, event.latency);
gesture_event.event.data.scrollUpdate.deltaX = dx;
gesture_event.event.data.scrollUpdate.deltaY = dy;
SendGestureEvent(gesture_event);
}
if (mouse_event.type == WebInputEvent::MouseUp) {
SendGestureEvent(MakeGestureEvent(
WebInputEvent::GestureScrollEnd, mouse_event.timeStampSeconds,
x, y, 0, event.latency));
}
break;
case WebMouseEvent::ButtonMiddle:
if (mouse_event.type == WebInputEvent::MouseDown) {
startX = x;
startY = y;
SendGestureEvent(MakeGestureEvent(
WebInputEvent::GestureShowPress, mouse_event.timeStampSeconds,
x, y, 0, event.latency));
SendGestureEvent(MakeGestureEvent(
WebInputEvent::GestureTapDown, mouse_event.timeStampSeconds,
x, y, 0, event.latency));
}
if (mouse_event.type == WebInputEvent::MouseUp) {
SendGestureEvent(MakeGestureEvent(
WebInputEvent::GestureTap, mouse_event.timeStampSeconds,
x, y, 0, event.latency));
}
break;
case WebMouseEvent::ButtonRight:
if (mouse_event.type == WebInputEvent::MouseDown) {
startX = x;
startY = y;
SendGestureEvent(MakeGestureEvent(
WebInputEvent::GestureScrollBegin, mouse_event.timeStampSeconds,
x, y, 0, event.latency));
SendGestureEvent(MakeGestureEvent(
WebInputEvent::GesturePinchBegin, mouse_event.timeStampSeconds,
x, y, 0, event.latency));
}
if (dx != 0 || dy != 0) {
dx = pow(dy < 0 ? 0.998f : 1.002f, fabs(dy));
GestureEventWithLatencyInfo gesture_event = MakeGestureEvent(
WebInputEvent::GesturePinchUpdate, mouse_event.timeStampSeconds,
startX, startY, 0, event.latency);
gesture_event.event.data.pinchUpdate.scale = dx;
SendGestureEvent(gesture_event);
}
if (mouse_event.type == WebInputEvent::MouseUp) {
SendGestureEvent(MakeGestureEvent(
WebInputEvent::GesturePinchEnd, mouse_event.timeStampSeconds,
x, y, 0, event.latency));
SendGestureEvent(MakeGestureEvent(
WebInputEvent::GestureScrollEnd, mouse_event.timeStampSeconds,
x, y, 0, event.latency));
}
break;
case WebMouseEvent::ButtonNone:
break;
}
}
void InputRouterImpl::UpdateTouchAckTimeoutEnabled() {
if (!touch_ack_timeout_supported_) {
touch_event_queue_.SetAckTimeoutEnabled(false, base::TimeDelta());
......
......@@ -171,9 +171,6 @@ private:
void ProcessAckForOverscroll(const blink::WebInputEvent& event,
InputEventAckState ack_result);
void SimulateTouchGestureWithMouse(
const MouseEventWithLatencyInfo& mouse_event);
// Called when a touch timeout-affecting bit has changed, in turn toggling the
// touch ack timeout feature of the |touch_event_queue_| as appropriate. Input
// to that determination includes current view properties, the allowed touch
......
......@@ -790,11 +790,6 @@ const char kScrollEndEffect[] = "scroll-end-effect";
// and study painting behavior.
const char kShowPaintRects[] = "show-paint-rects";
// Map mouse input events into touch gesture events. Useful for debugging touch
// gestures without needing a touchscreen.
const char kSimulateTouchScreenWithMouse[] =
"simulate-touch-screen-with-mouse";
// Runs the renderer and plugins in the same process as the browser
const char kSingleProcess[] = "single-process";
......
......@@ -226,7 +226,6 @@ CONTENT_EXPORT extern const char kRendererStartupDialog[];
extern const char kSandboxIPCProcess[];
CONTENT_EXPORT extern const char kScrollEndEffect[];
extern const char kShowPaintRects[];
CONTENT_EXPORT extern const char kSimulateTouchScreenWithMouse[];
CONTENT_EXPORT extern const char kSingleProcess[];
CONTENT_EXPORT extern const char kSitePerProcess[];
CONTENT_EXPORT extern const char kSkipGpuDataLoading[];
......
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