Commit 2131ec3a authored by Ella Ge's avatar Ella Ge Committed by Commit Bot

Make touchevent timestamp update on every non Stationary touch points

Touch event's timestamp is set from the |first_touch_pointer_event|'s
timestamp. But in the case that this touch point is not changing but
the others changed, this timestamp is not the latest pointerevent's
timestamp.
This CL changes it to use the the latest timestamp of the pointerevents
in |touch_attribute_map|.

Bug: 973545
Change-Id: I08be3f58e886f40eca17d515b36ec3a6424a38ef
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1705051Reviewed-by: default avatarDavid Bokan <bokan@chromium.org>
Reviewed-by: default avatarNavid Zolghadr <nzolghadr@chromium.org>
Commit-Queue: Ella Ge <eirage@chromium.org>
Cr-Commit-Position: refs/heads/master@{#685612}
parent ecf9d223
......@@ -244,6 +244,10 @@ WebCoalescedInputEvent TouchEventManager::GenerateWebCoalescedInputEvent() {
event.touches[event.touches_length++] =
CreateWebTouchPointFromWebPointerEvent(touch_pointer_event,
touch_point_attribute->stale_);
if (!touch_point_attribute->stale_) {
event.SetTimeStamp(std::max(event.TimeStamp(),
touch_point_attribute->event_.TimeStamp()));
}
// Only change the touch event type from move. So if we have two pointers
// in up and down state we just set the touch event type to the first one
......
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<script src="../../../resources/testdriver.js"></script>
<script src="../../../resources/testdriver-vendor.js"></script>
<script src="../../../external/wpt/resources/testdriver-actions.js"></script>
<div id="target" style="position:absolute; left:0px; right:0px; width:100%; height:100%; background:green">Target</div>
<script>
var last_event = null;
function handleTouchEvents(e) {
if (last_event) {
t.step(function () {
assert_greater_than(e.timeStamp, last_event.timeStamp)
});
}
last_event = e;
}
function endTest(e) {
if (!e.touches.length) {
t.done();
}
}
let t = async_test("Test touch event timestamp with multiple finger.");
target.addEventListener("touchstart", handleTouchEvents);
target.addEventListener("touchmove", handleTouchEvents);
target.addEventListener("touchend", endTest);
new test_driver.Actions()
.addPointer("pointer1", "touch")
.addPointer("pointer2", "touch")
.pointerMove(0, 0, {origin: target, sourceName: "pointer1"})
.pointerDown({sourceName: "pointer1"})
.pointerMove(10, 10, {origin: target, sourceName: "pointer1"})
.pointerMove(10, 10, {origin: target, sourceName: "pointer2"})
.pointerDown({sourceName: "pointer2"})
.addTick()
.pointerMove(20, 20, {origin: target, sourceName: "pointer2"})
.addTick()
.pointerMove(30, 30, {origin: target, sourceName: "pointer1"})
.addTick()
.pointerMove(40, 40, {origin: target, sourceName: "pointer2"})
.addTick()
.pointerUp({sourceName: "pointer2"})
.pointerUp({sourceName: "pointer1"})
.send();
</script>
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