Commit 9f42ee75 authored by thakis@chromium.org's avatar thakis@chromium.org

Revert of Touch emulator: overwrite timestamps from mouse event with current...

Revert of Touch emulator: overwrite timestamps from mouse event with current time. (https://codereview.chromium.org/250923005/)

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:
> Touch emulator: overwrite timestamps from mouse event with current time.
> 
> On some platfroms, mouse events come with a bad timestamp, which leads to
> awkward time-dependent gestures. For example, fling animation may be almost
> instant.
> Using base::TimeTicks::Now() is good enough for emulation purposes, because
> emulator spawns new events itself.
> 
> BUG=367156
> 
> Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=266548

TBR=jdduke@chromium.org,dgozman@chromium.org
NOTREECHECKS=true
NOTRY=true
BUG=367156

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@266610 0039d316-1c4b-4281-b951-d872f2087c98
parent cdf8eb5f
......@@ -316,7 +316,7 @@ void TouchEmulator::PinchEnd(const WebGestureEvent& event) {
client_->ForwardGestureEvent(pinch_event_);
}
void TouchEmulator::FillPinchEvent(const WebGestureEvent& event) {
void TouchEmulator::FillPinchEvent(const WebInputEvent& event) {
pinch_event_.timeStampSeconds = event.timeStampSeconds;
pinch_event_.modifiers = event.modifiers;
pinch_event_.sourceDevice = blink::WebGestureEvent::Touchscreen;
......@@ -361,16 +361,6 @@ bool TouchEmulator::FillTouchEventAndPoint(const WebMouseEvent& mouse_event) {
WebTouchEventTraits::ResetTypeAndTouchStates(
eventType, mouse_event.timeStampSeconds, &touch_event_);
// On some platforms mouse event's timestamp does not necessarily relate to
// the system time at all, so use base::TimeTicks::HighResNow() if possible,
// or base::TimeTicks::Now() otherwise.
base::TimeTicks now;
if (base::TimeTicks::IsHighResNowFastAndReliable())
now = base::TimeTicks::HighResNow();
else
now = base::TimeTicks::Now();
touch_event_.timeStampSeconds = (now - base::TimeTicks()).InSecondsF();
WebTouchPoint& point = touch_event_.touches[0];
point.id = 0;
point.radiusX = point.radiusY = 1.f;
......
......@@ -48,7 +48,7 @@ class CONTENT_EXPORT TouchEmulator : public ui::GestureProviderClient {
bool InPinchGestureMode() const;
bool FillTouchEventAndPoint(const blink::WebMouseEvent& mouse_event);
void FillPinchEvent(const blink::WebGestureEvent& event);
void FillPinchEvent(const blink::WebInputEvent& event);
// The following methods generate and pass gesture events to the renderer.
void PinchBegin(const blink::WebGestureEvent& event);
......
......@@ -202,7 +202,7 @@ TEST_F(TouchEmulatorTest, Touch) {
MouseUp(200, 200);
EXPECT_EQ(
"TouchMove GestureTapCancel GestureScrollBegin GestureScrollUpdate"
" TouchEnd GestureFlingStart",
" TouchEnd GestureScrollEnd",
ExpectedEvents());
}
......@@ -214,13 +214,13 @@ TEST_F(TouchEmulatorTest, MultipleTouches) {
MouseUp(200, 200);
EXPECT_EQ(
"TouchMove GestureTapCancel GestureScrollBegin GestureScrollUpdate"
" TouchEnd GestureFlingStart",
" TouchEnd GestureScrollEnd",
ExpectedEvents());
MouseMove(300, 200);
MouseMove(200, 200);
EXPECT_EQ("", ExpectedEvents());
MouseDown(300, 200);
EXPECT_EQ("TouchStart GestureFlingCancel GestureTapDown", ExpectedEvents());
EXPECT_EQ("TouchStart GestureTapDown", ExpectedEvents());
MouseDrag(300, 300);
EXPECT_EQ(
"TouchMove GestureTapCancel GestureScrollBegin GestureScrollUpdate",
......
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