Index: third_party/WebKit/LayoutTests/virtual/pointerevent/fast/events/pointerevents/mouse-pointer-capture.html |
diff --git a/third_party/WebKit/LayoutTests/virtual/pointerevent/fast/events/pointerevents/mouse-pointer-capture.html b/third_party/WebKit/LayoutTests/virtual/pointerevent/fast/events/pointerevents/mouse-pointer-capture.html |
index dfaecf2475173c29d0eb614ae1ab93915f8513cf..4e1f99a97607d1ada352bda20bd0087ed46025b2 100644 |
--- a/third_party/WebKit/LayoutTests/virtual/pointerevent/fast/events/pointerevents/mouse-pointer-capture.html |
+++ b/third_party/WebKit/LayoutTests/virtual/pointerevent/fast/events/pointerevents/mouse-pointer-capture.html |
@@ -6,6 +6,10 @@ div.box { |
padding: 20px; |
float: left; |
} |
+#grey { |
+ width: 50px; |
+ height: 50px; |
+} |
</style> |
<div id="grey" class="box" style="background-color:grey"> |
@@ -21,6 +25,7 @@ div.box { |
description("Verifies that pointer capture works for mouse."); |
var implicitRelease = false; |
+var removeElement = false; |
var pointerMoveCount = 0; |
var rect = document.getElementById("green").getBoundingClientRect(); |
@@ -37,8 +42,14 @@ var y3 = rect.top + 5; |
function init() { |
var eventList = ["mouseenter", "mouseleave", "mouseover", "mouseout", "mousemove", "mousedown", "mouseup", |
- "pointerenter", "pointerleave", "pointerover", "pointerout", "pointermove", "pointerdown", "pointerup"]; |
+ "pointerenter", "pointerleave", "pointerover", "pointerout", "pointermove", "pointerdown", "pointerup", |
+ "gotpointercapture", "lostpointercapture"]; |
+ document.addEventListener("lostpointercapture", function(event) { |
+ if (event.eventPhase == Event.AT_TARGET) { |
+ debug("document received " + event.type); |
+ } |
+ }); |
["grey", "green", "blue"].forEach(function(id) { |
var targetDiv = document.getElementById(id); |
eventList.forEach(function(eventName) { |
@@ -49,17 +60,21 @@ function init() { |
debug(" **** Set Pointer Capture ***** "); |
targetDiv.setPointerCapture(event.pointerId); |
} |
- if (implicitRelease && id == "green" && event.type == "pointermove") { |
- if (pointerMoveCount++ > 3) { |
+ if (id == "green" && event.type == "pointermove") { |
+ if (implicitRelease && pointerMoveCount++ > 3) { |
mustaq
2016/03/10 19:28:19
Didn't notice it before: the var should be called
Navid Zolghadr
2016/03/10 20:27:35
Done.
|
debug(" **** Release Pointer Capture ***** "); |
targetDiv.releasePointerCapture(event.pointerId); |
implicitRelease = false; |
} |
+ if (removeElement && pointerMoveCount++ > 3) { |
+ debug(" **** Remove Element ***** "); |
+ targetDiv.parentNode.removeChild(targetDiv); |
+ removeElement = false; |
+ } |
} |
} |
}); |
}); |
- |
}); |
} |
@@ -77,7 +92,7 @@ function testScenario() { |
eventSender.mouseMoveTo(x3, y3); |
eventSender.mouseMoveTo(x3+1, y3+1); |
eventSender.mouseMoveTo(x3, y3); |
- |
+ |
debug(" **** Move back to green & again to blue & mouse release ***** "); |
eventSender.mouseMoveTo(x1, y1); |
eventSender.mouseMoveTo(x3, y3); |
@@ -91,14 +106,23 @@ function testScenario() { |
} |
function runTests() { |
- debug(" ======= Set pointer capture and release implicitly ======= "); |
+ debug(" ======= Set pointer capture and release implicitly ======="); |
testScenario(); |
implicitRelease = true; |
+ pointerMoveCount = 0; |
debug(""); |
- debug(" ======= Set pointer capture and release explicitly ======= "); |
+ debug(" ======= Set pointer capture and release explicitly ======="); |
testScenario(); |
- } |
+ implicitRelease = false; |
+ |
+ removeElement = true; |
+ pointerMoveCount = 0; |
+ debug(""); |
+ debug(" ======= Set pointer capture and remove element ======="); |
+ testScenario(); |
+ removeElement = false; |
+} |
init(); |
if (window.eventSender) |