Set click count correctly to dispatch "dblclick" event
In order to dispatch the "dblclick" event to DOM by sending synthetic
mouse events, we have to check the most recent two mouse press events.
If their dispatched times and locations are close enough, we will set
the mouse event's click count to 2, which will generate the "dblclick"
event.
Bug: 606367
Change-Id: I049d6463c6bf1393c9e8b496662359eeeef7682b
Reviewed-on: https://chromium-review.googlesource.com/c/1413362
Commit-Queue: Lan Wei <[email protected]>
Reviewed-by: Navid Zolghadr <[email protected]>
Cr-Commit-Position: refs/heads/master@{#630933}
diff --git a/content/browser/renderer_host/input/synthetic_touch_driver.h b/content/browser/renderer_host/input/synthetic_touch_driver.h
index 687a619b..fb28bc8 100644
--- a/content/browser/renderer_host/input/synthetic_touch_driver.h
+++ b/content/browser/renderer_host/input/synthetic_touch_driver.h
@@ -22,16 +22,18 @@
void DispatchEvent(SyntheticGestureTarget* target,
const base::TimeTicks& timestamp) override;
- void Press(float x,
- float y,
- int index,
- SyntheticPointerActionParams::Button button =
- SyntheticPointerActionParams::Button::LEFT,
- int key_modifiers = 0,
- float width = 40.f,
- float height = 40.f,
- float rotation_angle = 0.f,
- float force = 1.f) override;
+ void Press(
+ float x,
+ float y,
+ int index,
+ SyntheticPointerActionParams::Button button =
+ SyntheticPointerActionParams::Button::LEFT,
+ int key_modifiers = 0,
+ float width = 40.f,
+ float height = 40.f,
+ float rotation_angle = 0.f,
+ float force = 1.f,
+ const base::TimeTicks& timestamp = base::TimeTicks::Now()) override;
void Move(float x,
float y,
int index,