Commit 04a79336 authored by Navid Zolghadr's avatar Navid Zolghadr Committed by Commit Bot

Send boundary events rightaway after pointerup

If pointerup implicitly releases the pointer
capture this change sends the boundary events
rightaway after that without waiting for the
next event.

Bug: 834824
Change-Id: I538e0b35d1420574f964666aac394c0bde00f4fb
Reviewed-on: https://chromium-review.googlesource.com/1019347
Commit-Queue: Navid Zolghadr <nzolghadr@chromium.org>
Reviewed-by: default avatarDave Tapuska <dtapuska@chromium.org>
Reviewed-by: default avatarMustaq Ahmed <mustaq@chromium.org>
Reviewed-by: default avatarElla Ge <eirage@chromium.org>
Cr-Commit-Position: refs/heads/master@{#557184}
parent 0d9a0b71
<!doctype html>
<html>
<head>
<title>Pointer Event: Boundary event sequence at implicit capture release</title>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/>
<link rel="author" title="Google" href="http://www.google.com "/>
<meta name="assert" content="When a captured pointer is implicitly released after a click, the boundary events should follow the lostpointercapture event."/>
<link rel="stylesheet" type="text/css" href="pointerevent_styles.css">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script type="text/javascript" src="pointerevent_support.js"></script>
<script type="text/javascript">
var detected_pointertypes = {};
var event_log = [];
var start_logging = false;
function resetTestState() {
detected_eventTypes = {};
event_log = [];
start_logging = false;
}
function run() {
var test_pointer_event = setup_pointerevent_test("Event sequence at implicit release on click", ["mouse"]);
var target = document.getElementById("target");
var capture_target = document.getElementById("capture-target");
All_Pointer_Events.forEach(function(eventName) {
on_event(target, eventName, function (event) {
detected_pointertypes[event.pointerType] = true;
if (event.type == "pointerdown") {
capture_target.setPointerCapture(event.pointerId);
start_logging = true;
} else if (start_logging) {
event_log.push(event.type + '@' + event.target.id);
}
});
on_event(capture_target, eventName, function (event) {
detected_pointertypes[event.pointerType] = true;
event_log.push(event.type + '@' + event.target.id);
if (event.type == 'lostpointercapture') {
setTimeout(function() {
test_pointer_event.step(function () {
var expected_events = "pointerup, lostpointercapture, pointerout, pointerleave";
assert_equals(event_log.join(", "), "pointerout@target, pointerleave@target, pointerover@capture-target, pointerenter@capture-target, gotpointercapture@capture-target, pointerup@capture-target, lostpointercapture@capture-target, pointerout@capture-target, pointerleave@capture-target, pointerover@target, pointerenter@target");
});
test_pointer_event.done();
}, 200);
}
});
});
}
</script>
<style>
#target {
margin: 20px;
background-color: black;
}
</style>
</head>
<body onload="run()">
<h1>Pointer Event: Boundary event sequence at implicit capture release</h1>
<h2 id="pointerTypeDescription"></h2>
<h4>
When a captured pointer is implicitly released after a click, the boundary events should follow the lostpointercapture event.
</h4>
<ol>
<li>Click on the black box with mouse and do not move the mouse after or during the click.</li>
</ol>
<div id="capture-target"></div>
<div id="target"></div>
<div id="complete-notice">
<p>The following pointer types were detected: <span id="pointertype-log"></span>.</p>
<p>The following events were logged: <span id="event-log"></span>.</p>
</div>
<div id="log"></div>
</body>
</html>
importAutomationScript('/pointerevents/pointerevent_common_input.js');
function inject_input() {
return mouseClickInTarget('#target');
}
......@@ -41,7 +41,6 @@ green received pointerup
green received mouseup
green received lostpointercapture
Capture pointer event attributes are correct!
**** Jiggle in blue box *****
green received pointerout
green received pointerleave
grey received pointerleave
......@@ -52,6 +51,7 @@ green received mouseleave
grey received mouseleave
blue received mouseover
blue received mouseenter
**** Jiggle in blue box *****
blue received pointermove
blue received mousemove
**** Move to (0,0) *****
......
......@@ -617,8 +617,21 @@ WebInputEventResult PointerEventManager::SendMousePointerEvent(
if (pointer_event->type() == EventTypeNames::pointerup ||
pointer_event->type() == EventTypeNames::pointercancel) {
ReleasePointerCapture(pointer_event->pointerId());
// Send got/lostpointercapture rightaway if necessary.
ProcessPendingPointerCapture(pointer_event);
if (pointer_event->type() == EventTypeNames::pointerup) {
// If pointerup releases the capture we also send boundary events
// rightaway when the pointer that supports hover. The following function
// does nothing when there was no capture to begin with in the first
// place.
ProcessCaptureAndPositionOfPointerEvent(pointer_event, target,
canvas_region_id, &mouse_event);
} else {
// Don't send out/leave events in this case as it is a little tricky.
// This case happens for the drag operation and currently we don't
// let the page know that the pointer left the page while dragging.
ProcessPendingPointerCapture(pointer_event);
}
if (pointer_event->isPrimary()) {
prevent_mouse_event_for_pointer_type_[ToPointerTypeIndex(
......
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