Commit c0079495 authored by lanwei's avatar lanwei Committed by Commit bot

Make sure PointerEvents's isPrimary set correctly for stylus

When a pen enters and leaves a tablet's proximity and enters again, the
PointerEvents' isPrimary should always be true.

Testing page: https://patrickhlauke.github.io/touch/tracker/multi-touch-tracker-pointer-hud.html

Webplatform test pointerevent_pointerleave_pen-manual.html does not work
right now because of no support of PointerLeave events when pen leaves
the range of the tablet in PointerActionSequence API. I will add it soon.

BUG=713745

Review-Url: https://codereview.chromium.org/2831933002
Cr-Commit-Position: refs/heads/master@{#467997}
parent 50cd18bc
......@@ -21,20 +21,32 @@
function run() {
var target0 = document.getElementById("target0");
var count = 0;
on_event(target0, "pointerenter", function (event) {
test_pointerEvent.step(function () {
assert_equals(event.pointerType, "pen", "Test should be run using a pen as input");
assert_equals(event.type, "pointerenter", "The " + event.type + " event was received");
assert_equals(event.isPrimary, true, "The " + event.type + ".isPrimary is true");
});
});
on_event(target0, "pointerleave", function (event) {
detected_pointertypes[event.pointerType] = true;
check_PointerEvent(event);
count++;
test_pointerEvent.step(function () {
assert_equals(event.pointerType, "pen", "Test should be run using a pen as input");
assert_equals(event.type, "pointerleave", "The " + event.type + " event was received");
assert_equals(event.isPrimary, true, "The " + event.type + ".isPrimary is true");
assert_true((event.clientX > target0.getBoundingClientRect().left)&&
(event.clientX < target0.getBoundingClientRect().right)&&
(event.clientY > target0.getBoundingClientRect().top)&&
(event.clientY < target0.getBoundingClientRect().bottom),
"pointerleave should be received inside of target bounds");
});
test_pointerEvent.done(); // complete test
if (count >= 2)
test_pointerEvent.done(); // complete test
});
}
</script>
......@@ -43,7 +55,7 @@
<h1>Pointer Event: Dispatch pointerleave (pen)</h1>
<h4>
Test Description:
When a pointing device that supports hover (pen stylus) leaves the range of the digitizer while over an element, the pointerleave event must be dispatched.
When a pointing device that supports hover (pen stylus) leaves the range of the digitizer while over an element, the pointerleave event must be dispatched. In addition, all the pointer events' isPrimary should always be true when the pointing device leaves and enters the range of the digitizer again.
</h4>
<br />
<div id="target0">
......
......@@ -3,6 +3,9 @@ importAutomationScript('/pointerevents/pointerevent_common_input.js');
function inject_input() {
return penMoveIntoTarget('#target0').then(function() {
penMoveToDocument();
}).then(function() {
return penMoveIntoTarget('#target0');
}).then(function() {
return penMoveToDocument();
});
}
}
\ No newline at end of file
......@@ -520,6 +520,10 @@ WebInputEventResult PointerEventManager::SendMousePointerEvent(
}
}
if (mouse_event.GetType() == WebInputEvent::kMouseLeave &&
mouse_event.pointer_type == WebPointerProperties::PointerType::kPen) {
pointer_event_factory_.Remove(pointer_event->pointerId());
}
return result;
}
......
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