Skip to content

Commit 97da297

Browse files
NavidZchromium-wpt-export-bot
authored andcommitted
Add time stamp to the constructor of the events
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}
1 parent 036f5a9 commit 97da297

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

pointerevents/extension/pointerevent_coalesced_events_attributes-manual.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,14 @@
7777
test (function() {
7878
for (var i=0; i<coalescedEvents.length; i++) {
7979
assert_equals(coalescedEvents[i].isTrusted, true, 'isTrusted flag should be true for coalesced events.');
80+
if (i > 0)
81+
assert_greater_than_equal(coalescedEvents[i].timeStamp, coalescedEvents[i-1].timeStamp, 'Time stamps of coalesced events must be ascending.');
8082
}
8183
}, expectedPointerType + ' pointermove coalesced events should all be marked as trusted.');
84+
test (function() {
85+
for (var i=1; i<coalescedEvents.length; i++)
86+
assert_greater_than_equal(coalescedEvents[i].timeStamp, coalescedEvents[i-1].timeStamp, 'Time stamps of coalesced events must be ascending.');
87+
}, expectedPointerType + ' time stamps of coalesced events must be ascending.');
8288
test (function() {
8389
for (var i=0; i<coalescedEvents.length; i++) {
8490
assert_equals(coalescedEvents[i].bubbles, false, 'Bubbles attribute should be false for coalesced events.');

pointerevents/pointerevent_suppress_compat_events_on_drag_mouse-manual.html

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,9 @@
4141
on_event(document.getElementById("done"), "click", end_of_interaction);
4242

4343
var target_list = ["target0", "target1"];
44-
var pointer_event_list = ["pointerdown"];
44+
var pointer_event_list = ["pointerdown" , "pointermove", "pointerup"];
4545
var mouse_event_list = ["mousedown", "mouseup", "mousemove"];
46+
var last_pointer_event = null;
4647

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

55-
test(function () {
56-
assert_true(event.isPrimary);
57-
}, "primary pointer " + label);
56+
if (event.type == "pointerdown") {
57+
test(function () {
58+
assert_true(event.isPrimary);
59+
}, "primary pointer " + label);
60+
}
5861

5962
if (label === "pointerdown@target0")
6063
event.preventDefault();
64+
65+
last_pointer_event = event;
6166
});
6267
});
6368

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

7176
include_next_mousemove = (event.type == "mousedown");
77+
test(function() {
78+
test(function () {
79+
assert_equals(event.timeStamp, last_pointer_event.timeStamp, "The time stamp of the compat mouse event should be the same as its pointerevent");
80+
});
81+
}, event.type + "'s time stamp should be the same as " + last_pointer_event.type + "'s time stamp.");
7282
});
7383
});
7484
});

0 commit comments

Comments
 (0)