Skip to content

Commit

Permalink
Add time stamp to the constructor of the events
Browse files Browse the repository at this point in the history
To match the pointerevent and its corresponding
mouse and touch events time stamps we need to
have the time stamp in the constructor parameter.

Note that having the time stamp in the EventInit
dictionary is being debated as part of this issue:
whatwg/dom#76

BUG=710442

Review-Url: https://codereview.chromium.org/2834183002
Cr-Commit-Position: refs/heads/master@{#466690}
  • Loading branch information
NavidZ authored and Unknown committed Apr 24, 2017
1 parent 036f5a9 commit 9e202ab
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,14 @@
test (function() {
for (var i=0; i<coalescedEvents.length; i++) {
assert_equals(coalescedEvents[i].isTrusted, true, 'isTrusted flag should be true for coalesced events.');
if (i > 0)
assert_greater_than_equal(coalescedEvents[i].timeStamp, coalescedEvents[i-1].timeStamp, 'Time stamps of coalesced events must be ascending.');
}
}, expectedPointerType + ' pointermove coalesced events should all be marked as trusted.');
test (function() {
for (var i=1; i<coalescedEvents.length; i++)
assert_greater_than_equal(coalescedEvents[i].timeStamp, coalescedEvents[i-1].timeStamp, 'Time stamps of coalesced events must be ascending.');
}, expectedPointerType + ' time stamps of coalesced events must be ascending.');
test (function() {
for (var i=0; i<coalescedEvents.length; i++) {
assert_equals(coalescedEvents[i].bubbles, false, 'Bubbles attribute should be false for coalesced events.');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@
on_event(document.getElementById("done"), "click", end_of_interaction);

var target_list = ["target0", "target1"];
var pointer_event_list = ["pointerdown"];
var pointer_event_list = ["pointerdown" , "pointermove", "pointerup"];
var mouse_event_list = ["mousedown", "mouseup", "mousemove"];
var last_pointer_event = null;

target_list.forEach(function(targetId) {
var target = document.getElementById(targetId);
Expand All @@ -52,12 +53,16 @@
detected_pointertypes[event.pointerType] = true;
var label = event.type + "@" + targetId;

test(function () {
assert_true(event.isPrimary);
}, "primary pointer " + label);
if (event.type == "pointerdown") {
test(function () {
assert_true(event.isPrimary);
}, "primary pointer " + label);
}

if (label === "pointerdown@target0")
event.preventDefault();

last_pointer_event = event;
});
});

Expand All @@ -69,6 +74,11 @@
event_log.push(event.type + "@" + targetId);

include_next_mousemove = (event.type == "mousedown");
test(function() {
test(function () {
assert_equals(event.timeStamp, last_pointer_event.timeStamp, "The time stamp of the compat mouse event should be the same as its pointerevent");
});
}, event.type + "'s time stamp should be the same as " + last_pointer_event.type + "'s time stamp.");
});
});
});
Expand Down

0 comments on commit 9e202ab

Please sign in to comment.