diff --git a/third_party/WebKit/LayoutTests/virtual/pointerevent/fast/events/pointerevents/touch-capture-expected.txt b/third_party/WebKit/LayoutTests/virtual/pointerevent/fast/events/pointerevents/touch-capture-expected.txt index 90ccf681c4d10..d4f0a6bbe7a75 100644 --- a/third_party/WebKit/LayoutTests/virtual/pointerevent/fast/events/pointerevents/touch-capture-expected.txt +++ b/third_party/WebKit/LayoutTests/virtual/pointerevent/fast/events/pointerevents/touch-capture-expected.txt @@ -3,7 +3,7 @@ Verifies that pointer capture works for touch. On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". - ======= Touch and release ======= + ======= Touch and release ======= **** First touch on green box & jiggle **** green received pointerover 2 grey received pointerenter 2 @@ -26,7 +26,7 @@ grey received pointerleave 2 green received lostpointercapture 2 green received touchend - ======= Touch and cancel ======= + ======= Touch and cancel ======= **** First touch on green box & jiggle **** green received pointerover 3 grey received pointerenter 3 @@ -49,7 +49,7 @@ grey received pointerleave 3 green received lostpointercapture 3 green received touchcancel - ======= Multitouch and release ======= + ======= Multitouch and release ======= **** First touch on green & second touch on blue & jiggle **** green received pointerover 4 grey received pointerenter 4 @@ -88,7 +88,7 @@ blue received pointerleave 5 blue received lostpointercapture 5 blue received touchend - ======= Multitouch and cancel ======= + ======= Multitouch and cancel ======= **** First touch on green & second touch on blue & jiggle **** green received pointerover 6 grey received pointerenter 6 @@ -125,6 +125,290 @@ blue received pointercancel 7 blue received pointerout 7 blue received pointerleave 7 blue received lostpointercapture 7 +blue received touchcancel + + ======= Touch and release with capture release ======= + **** First touch on green box & jiggle **** +green received pointerover 8 +grey received pointerenter 8 +green received pointerenter 8 +green received pointerdown 8 +green received touchstart +green received gotpointercapture 8 +green received pointermove 8 +green received touchmove + **** Move to blue box & jiggle **** +green received pointermove 8 + &&& Releasing pointer capture for 8 &&& +green received touchmove +green received pointerout 8 +green received pointerleave 8 +grey received pointerleave 8 +green received lostpointercapture 8 +blue received pointerover 8 +blue received pointerenter 8 +blue received pointermove 8 +green received touchmove + **** Release touch **** +blue received pointerup 8 +blue received pointerout 8 +blue received pointerleave 8 +green received touchend + + ======= Touch and cancel with capture release ======= + **** First touch on green box & jiggle **** +green received pointerover 9 +grey received pointerenter 9 +green received pointerenter 9 +green received pointerdown 9 +green received touchstart +green received gotpointercapture 9 +green received pointermove 9 +green received touchmove + **** Move to blue box & jiggle **** +green received pointermove 9 + &&& Releasing pointer capture for 9 &&& +green received touchmove +green received pointerout 9 +green received pointerleave 9 +grey received pointerleave 9 +green received lostpointercapture 9 +blue received pointerover 9 +blue received pointerenter 9 +blue received pointermove 9 +green received touchmove + **** Cancel touch **** +blue received pointercancel 9 +blue received pointerout 9 +blue received pointerleave 9 +green received touchcancel + + ======= Multitouch and release with capture release ======= + **** First touch on green & second touch on blue & jiggle **** +green received pointerover 10 +grey received pointerenter 10 +green received pointerenter 10 +green received pointerdown 10 +green received touchstart +blue received pointerover 11 +blue received pointerenter 11 +blue received pointerdown 11 +blue received touchstart +green received gotpointercapture 10 +green received pointermove 10 +green received touchmove +blue received gotpointercapture 11 +blue received pointermove 11 + &&& Releasing pointer capture for 11 &&& +blue received touchmove + **** Move first touch to blue & second touch to green **** +green received pointermove 10 +green received touchmove +blue received pointerout 11 +blue received pointerleave 11 +blue received lostpointercapture 11 +green received pointerover 11 +grey received pointerenter 11 +green received pointerenter 11 +green received pointermove 11 +blue received touchmove + **** Release first touch **** +green received pointerup 10 +green received pointerout 10 +green received pointerleave 10 +grey received pointerleave 10 +green received lostpointercapture 10 +green received touchend + **** Jiggle second touch on green **** +green received pointermove 11 +blue received touchmove + **** Release second touch **** +green received pointerup 11 +green received pointerout 11 +green received pointerleave 11 +grey received pointerleave 11 +blue received touchend + + ======= Multitouch and cancel with capture release ======= + **** First touch on green & second touch on blue & jiggle **** +green received pointerover 12 +grey received pointerenter 12 +green received pointerenter 12 +green received pointerdown 12 +green received touchstart +blue received pointerover 13 +blue received pointerenter 13 +blue received pointerdown 13 +blue received touchstart +green received gotpointercapture 12 +green received pointermove 12 +green received touchmove +blue received gotpointercapture 13 +blue received pointermove 13 + &&& Releasing pointer capture for 13 &&& +blue received touchmove + **** Move first touch to blue & second touch to green **** +green received pointermove 12 +green received touchmove +blue received pointerout 13 +blue received pointerleave 13 +blue received lostpointercapture 13 +green received pointerover 13 +grey received pointerenter 13 +green received pointerenter 13 +green received pointermove 13 +blue received touchmove + **** Cancel first touch **** +green received pointercancel 12 +green received pointerout 12 +green received pointerleave 12 +grey received pointerleave 12 +green received lostpointercapture 12 +green received touchcancel + **** Jiggle second touch on green **** +green received pointermove 13 +blue received touchmove + **** Cancel second touch **** +green received pointercancel 13 +green received pointerout 13 +green received pointerleave 13 +grey received pointerleave 13 +blue received touchcancel + + ======= Touch and release with capture reset ======= + **** First touch on green box & jiggle **** +green received pointerover 14 +grey received pointerenter 14 +green received pointerenter 14 +green received pointerdown 14 + --- Set pointer capture to blue 14 --- +green received touchstart +green received pointerout 14 +green received pointerleave 14 +grey received pointerleave 14 +blue received gotpointercapture 14 +blue received pointerover 14 +blue received pointerenter 14 +blue received pointermove 14 +green received touchmove + **** Move to blue box & jiggle **** +blue received pointermove 14 +green received touchmove +blue received pointermove 14 +green received touchmove + **** Release touch **** +blue received pointerup 14 +blue received lostpointercapture 14 +green received touchend + + ======= Touch and cancel with capture reset ======= + **** First touch on green box & jiggle **** +green received pointerover 15 +grey received pointerenter 15 +green received pointerenter 15 +green received pointerdown 15 + --- Set pointer capture to blue 15 --- +green received touchstart +green received pointerout 15 +green received pointerleave 15 +grey received pointerleave 15 +blue received gotpointercapture 15 +blue received pointerover 15 +blue received pointerenter 15 +blue received pointermove 15 +green received touchmove + **** Move to blue box & jiggle **** +blue received pointermove 15 +green received touchmove +blue received pointermove 15 +green received touchmove + **** Cancel touch **** +blue received pointercancel 15 +blue received lostpointercapture 15 +green received touchcancel + + ======= Multitouch and release with capture reset ======= + **** First touch on green & second touch on blue & jiggle **** +green received pointerover 16 +grey received pointerenter 16 +green received pointerenter 16 +green received pointerdown 16 + --- Set pointer capture to blue 16 --- +green received touchstart +blue received pointerover 17 +blue received pointerenter 17 +blue received pointerdown 17 +blue received touchstart +green received pointerout 16 +green received pointerleave 16 +grey received pointerleave 16 +blue received gotpointercapture 16 +blue received pointerover 16 +blue received pointerenter 16 +blue received pointermove 16 +green received touchmove +blue received gotpointercapture 17 +blue received pointermove 17 +blue received touchmove + **** Move first touch to blue & second touch to green **** +blue received pointermove 16 +green received touchmove +blue received pointermove 17 +blue received touchmove + **** Release first touch **** +blue received pointerup 16 +blue received lostpointercapture 16 +green received touchend + **** Jiggle second touch on green **** +blue received pointermove 17 +blue received touchmove + **** Release second touch **** +blue received pointerup 17 +blue received pointerout 17 +blue received pointerleave 17 +blue received lostpointercapture 17 +blue received touchend + + ======= Multitouch and cancel with capture reset ======= + **** First touch on green & second touch on blue & jiggle **** +green received pointerover 18 +grey received pointerenter 18 +green received pointerenter 18 +green received pointerdown 18 + --- Set pointer capture to blue 18 --- +green received touchstart +blue received pointerover 19 +blue received pointerenter 19 +blue received pointerdown 19 +blue received touchstart +green received pointerout 18 +green received pointerleave 18 +grey received pointerleave 18 +blue received gotpointercapture 18 +blue received pointerover 18 +blue received pointerenter 18 +blue received pointermove 18 +green received touchmove +blue received gotpointercapture 19 +blue received pointermove 19 +blue received touchmove + **** Move first touch to blue & second touch to green **** +blue received pointermove 18 +green received touchmove +blue received pointermove 19 +blue received touchmove + **** Cancel first touch **** +blue received pointercancel 18 +blue received lostpointercapture 18 +green received touchcancel + **** Jiggle second touch on green **** +blue received pointermove 19 +blue received touchmove + **** Cancel second touch **** +blue received pointercancel 19 +blue received pointerout 19 +blue received pointerleave 19 +blue received lostpointercapture 19 blue received touchcancel PASS successfullyParsed is true diff --git a/third_party/WebKit/LayoutTests/virtual/pointerevent/fast/events/pointerevents/touch-capture-in-iframe-expected.txt b/third_party/WebKit/LayoutTests/virtual/pointerevent/fast/events/pointerevents/touch-capture-in-iframe-expected.txt index 28cf572b46be7..54561b4a19b14 100644 --- a/third_party/WebKit/LayoutTests/virtual/pointerevent/fast/events/pointerevents/touch-capture-in-iframe-expected.txt +++ b/third_party/WebKit/LayoutTests/virtual/pointerevent/fast/events/pointerevents/touch-capture-in-iframe-expected.txt @@ -155,4 +155,148 @@ touchend is recieved with changedTouches.length=2: Touch with id=0 with target = outerFrame Touch with id=1 with target = outerFrame +==== Finger1 in innerFrame and Finger2 in outerFrame with releaseTouchCapture ==== +*** Put first finger down in innerFrame and move *** +innerFrame recieved pointerdown with id=10 +touchstart is recieved with changedTouches.length=1: + Touch with id=0 with target = innerFrame +innerFrame recieved gotpointercapture with id=10 +innerFrame recieved pointermove with id=10 +touchmove is recieved with changedTouches.length=1: + Touch with id=0 with target = innerFrame + +*** Put second finger in outerFrame and move *** +--- Release pointer capture for 11 --- +outerFrame recieved pointerdown with id=11 +outerFrame recieved pointermove with id=11 + +*** Move first finger to outerFrame *** +innerFrame recieved pointermove with id=10 +touchmove is recieved with changedTouches.length=1: + Touch with id=0 with target = innerFrame + +*** Move second finger to innerFrame *** +innerFrame recieved pointermove with id=11 + +*** Releasing fingers *** +innerFrame recieved pointerup with id=10 +innerFrame recieved lostpointercapture with id=10 +innerFrame recieved pointerup with id=11 +touchend is recieved with changedTouches.length=1: + Touch with id=0 with target = innerFrame + +==== Finger1 in outerFrame and Finger2 in innerFrame with releaseTouchCapture ==== +*** Put first finger down in outerFrame and move *** +--- Release pointer capture for 12 --- +outerFrame recieved pointerdown with id=12 +touchstart is recieved with changedTouches.length=1: + Touch with id=0 with target = outerFrame +outerFrame recieved pointermove with id=12 +touchmove is recieved with changedTouches.length=1: + Touch with id=0 with target = outerFrame + +*** Put second finger in innerFrame and move *** +innerFrame recieved pointerdown with id=13 +touchstart is recieved with changedTouches.length=1: + Touch with id=1 with target = innerFrameElement +innerFrame recieved gotpointercapture with id=13 +innerFrame recieved pointermove with id=13 +touchmove is recieved with changedTouches.length=1: + Touch with id=1 with target = innerFrameElement + +*** Move first finger to innerFrame *** +innerFrame recieved pointermove with id=12 +touchmove is recieved with changedTouches.length=1: + Touch with id=0 with target = outerFrame + +*** Move second finger to outerFrame *** +innerFrame recieved pointermove with id=13 +touchmove is recieved with changedTouches.length=1: + Touch with id=1 with target = innerFrameElement + +*** Releasing fingers *** +innerFrame recieved pointerup with id=12 +innerFrame recieved pointerup with id=13 +innerFrame recieved lostpointercapture with id=13 +touchend is recieved with changedTouches.length=2: + Touch with id=0 with target = outerFrame + Touch with id=1 with target = innerFrameElement +touchend is recieved with changedTouches.length=2: + Touch with id=0 with target = outerFrame + Touch with id=1 with target = innerFrameElement + +==== Finger1 in innerFrame and Finger2 in innerFrame with releaseTouchCapture ==== +*** Put first finger down in innerFrame and move *** +innerFrame recieved pointerdown with id=14 +touchstart is recieved with changedTouches.length=1: + Touch with id=0 with target = innerFrame +innerFrame recieved gotpointercapture with id=14 +innerFrame recieved pointermove with id=14 +touchmove is recieved with changedTouches.length=1: + Touch with id=0 with target = innerFrame + +*** Put second finger in innerFrame and move *** +innerFrame recieved pointerdown with id=15 +touchstart is recieved with changedTouches.length=1: + Touch with id=1 with target = innerFrame +innerFrame recieved gotpointercapture with id=15 +innerFrame recieved pointermove with id=15 +touchmove is recieved with changedTouches.length=1: + Touch with id=1 with target = innerFrame + +*** Move first finger to outerFrame *** +innerFrame recieved pointermove with id=14 +touchmove is recieved with changedTouches.length=1: + Touch with id=0 with target = innerFrame + +*** Move second finger to outerFrame *** +innerFrame recieved pointermove with id=15 +touchmove is recieved with changedTouches.length=1: + Touch with id=1 with target = innerFrame + +*** Releasing fingers *** +innerFrame recieved pointerup with id=14 +innerFrame recieved lostpointercapture with id=14 +innerFrame recieved pointerup with id=15 +innerFrame recieved lostpointercapture with id=15 +touchend is recieved with changedTouches.length=2: + Touch with id=0 with target = innerFrame + Touch with id=1 with target = innerFrame + +==== Finger1 in outerFrame and Finger2 in outerFrame with releaseTouchCapture ==== +*** Put first finger down in outerFrame and move *** +--- Release pointer capture for 16 --- +outerFrame recieved pointerdown with id=16 +touchstart is recieved with changedTouches.length=1: + Touch with id=0 with target = outerFrame +outerFrame recieved pointermove with id=16 +touchmove is recieved with changedTouches.length=1: + Touch with id=0 with target = outerFrame + +*** Put second finger in outerFrame and move *** +--- Release pointer capture for 17 --- +outerFrame recieved pointerdown with id=17 +touchstart is recieved with changedTouches.length=1: + Touch with id=1 with target = outerFrame +outerFrame recieved pointermove with id=17 +touchmove is recieved with changedTouches.length=1: + Touch with id=1 with target = outerFrame + +*** Move first finger to innerFrame *** +innerFrame recieved pointermove with id=16 +touchmove is recieved with changedTouches.length=1: + Touch with id=0 with target = outerFrame + +*** Move second finger to innerFrame *** +innerFrame recieved pointermove with id=17 +touchmove is recieved with changedTouches.length=1: + Touch with id=1 with target = outerFrame + +*** Releasing fingers *** +innerFrame recieved pointerup with id=16 +innerFrame recieved pointerup with id=17 +touchend is recieved with changedTouches.length=2: + Touch with id=0 with target = outerFrame + Touch with id=1 with target = outerFrame + diff --git a/third_party/WebKit/LayoutTests/virtual/pointerevent/fast/events/pointerevents/touch-capture-in-iframe.html b/third_party/WebKit/LayoutTests/virtual/pointerevent/fast/events/pointerevents/touch-capture-in-iframe.html index 29bcac73ca639..6e0caaef2721f 100644 --- a/third_party/WebKit/LayoutTests/virtual/pointerevent/fast/events/pointerevents/touch-capture-in-iframe.html +++ b/third_party/WebKit/LayoutTests/virtual/pointerevent/fast/events/pointerevents/touch-capture-in-iframe.html @@ -21,8 +21,13 @@ @@ -38,21 +43,33 @@ var innerFrameX = 200; var innerFrameY = 200; +function logEvent(event) { + if (event.type.includes('pointer')) { + debug(event.target.id + ' recieved ' + event.type + ' with id=' + event.pointerId); + } else if (event.type.startsWith('touch')) { + debug(event.type + ' is recieved with changedTouches.length=' + event.changedTouches.length + ':'); + for(var i=0; i description("Verifies that pointer capture works for touch."); +var ACTION_NONE = 0; +var ACTION_RELEASE = 1; +var ACTION_RESET = 2; + +document.captureAction = ACTION_NONE; +document.movecount = 0; + var rect = document.getElementById("green").getBoundingClientRect(); var x1 = rect.left + 5; var y1 = rect.top + 5; @@ -47,9 +54,19 @@ eventList.forEach(function(eventName) { targetDiv.addEventListener(eventName, function(event) { if (event.eventPhase == Event.AT_TARGET) { - if (event.type.includes("pointer")) + if (event.type.includes("pointer")) { debug(id + " received " + event.type + " " + event.pointerId); - else + if (document.captureAction == ACTION_RESET && event.type == "pointerdown") { + debug(" --- Set pointer capture to blue " + event.pointerId + " ---"); + document.getElementById('blue').setPointerCapture(event.pointerId); + document.captureAction = ACTION_NONE; + } + if (document.captureAction == ACTION_RELEASE && event.type == "pointermove" && ++document.movecount > 1) { + debug(" &&& Releasing pointer capture for " + event.pointerId + " &&&"); + event.target.releasePointerCapture(event.pointerId); + document.captureAction = ACTION_NONE; + } + } else debug(id + " received " + event.type); } }); @@ -57,7 +74,15 @@ }); } -function singleTouchTestScenario(touchCancel) { +function singleTouchTestScenario(touchCancel, captureAction) { + var captureName = captureAction == ACTION_RELEASE ? " with capture release" : + captureAction == ACTION_RESET ? " with capture reset" : ""; + + debug(" ======= Touch and " + (touchCancel ? "cancel" : "release") + captureName + " ======="); + + document.captureAction = captureAction; + document.movecount = 0; + debug(" **** First touch on green box & jiggle ****"); eventSender.addTouchPoint(x1, y1) eventSender.touchStart(); @@ -84,7 +109,15 @@ } -function multiTouchTestScenario(touchCancel) { +function multiTouchTestScenario(touchCancel, captureAction) { + var captureName = captureAction == ACTION_RELEASE ? " with capture release" : + captureAction == ACTION_RESET ? " with capture reset" : ""; + + debug(" ======= Multitouch and " + (touchCancel ? "cancel" : "release") + captureName + " ======="); + + document.captureAction = captureAction; + document.movecount = 0; + debug(" **** First touch on green & second touch on blue & jiggle ****"); eventSender.addTouchPoint(x1, y1) eventSender.touchStart(); @@ -129,18 +162,12 @@ } function runTests() { - debug(" ======= Touch and release ======="); - singleTouchTestScenario(false); - - debug(" ======= Touch and cancel ======="); - singleTouchTestScenario(true); - - debug(" ======= Multitouch and release ======="); - multiTouchTestScenario(false); - - debug(" ======= Multitouch and cancel ======="); - multiTouchTestScenario(true); - + [ACTION_NONE, ACTION_RELEASE, ACTION_RESET].forEach(function(action) { + singleTouchTestScenario(false, action); + singleTouchTestScenario(true, action); + multiTouchTestScenario(false, action); + multiTouchTestScenario(true, action); + }); } init(); diff --git a/third_party/WebKit/Source/core/dom/Element.cpp b/third_party/WebKit/Source/core/dom/Element.cpp index 85e2bbf37d399..3a192319e2f9b 100644 --- a/third_party/WebKit/Source/core/dom/Element.cpp +++ b/third_party/WebKit/Source/core/dom/Element.cpp @@ -2670,10 +2670,6 @@ void Element::setPointerCapture(int pointerId, ExceptionState& exceptionState) exceptionState.throwDOMException(InvalidPointerId, "InvalidPointerId"); else if (!inShadowIncludingDocument()) exceptionState.throwDOMException(InvalidStateError, "InvalidStateError"); - // TODO(crbug.com/579553): This next "else if" is a hack to notify JS that we don't (yet) support - // explicit set/release of touch pointers (which are implicitly captured for performance reasons). - else if (document().frame()->eventHandler().getPointerEventType(pointerId) == WebPointerProperties::PointerType::Touch) - exceptionState.throwDOMException(InvalidPointerId, "InvalidPointerId"); else document().frame()->eventHandler().setPointerCapture(pointerId, this); } @@ -2684,10 +2680,6 @@ void Element::releasePointerCapture(int pointerId, ExceptionState& exceptionStat if (document().frame()) { if (!document().frame()->eventHandler().isPointerEventActive(pointerId)) exceptionState.throwDOMException(InvalidPointerId, "InvalidPointerId"); - // TODO(crbug.com/579553): This next "else if" is a hack to notify JS that we don't (yet) support - // explicit set/release of touch pointers (which are implicitly captured for performance reasons). - else if (document().frame()->eventHandler().getPointerEventType(pointerId) == WebPointerProperties::PointerType::Touch) - exceptionState.throwDOMException(InvalidPointerId, "InvalidPointerId"); else document().frame()->eventHandler().releasePointerCapture(pointerId, this); } diff --git a/third_party/WebKit/Source/core/events/PointerEventFactory.cpp b/third_party/WebKit/Source/core/events/PointerEventFactory.cpp index 56a5a16f79342..3a28a5324c0bf 100644 --- a/third_party/WebKit/Source/core/events/PointerEventFactory.cpp +++ b/third_party/WebKit/Source/core/events/PointerEventFactory.cpp @@ -358,16 +358,6 @@ bool PointerEventFactory::isPrimary(int mappedId) const return m_primaryId[p.pointerType()] == mappedId; } -WebPointerProperties::PointerType PointerEventFactory::getPointerType( - const int pointerId) const -{ - if (m_pointerIdMapping.contains(pointerId)) { - return static_cast( - m_pointerIdMapping.get(pointerId).incomingId.pointerType()); - } - return WebPointerProperties::PointerType::Unknown; -} - bool PointerEventFactory::isActive(const int pointerId) const { return m_pointerIdMapping.contains(pointerId); diff --git a/third_party/WebKit/Source/core/events/PointerEventFactory.h b/third_party/WebKit/Source/core/events/PointerEventFactory.h index feb668e89a3a3..b486c2d545027 100644 --- a/third_party/WebKit/Source/core/events/PointerEventFactory.h +++ b/third_party/WebKit/Source/core/events/PointerEventFactory.h @@ -68,9 +68,6 @@ class CORE_EXPORT PointerEventFactory { // Returns whether a pointer id exists and active. bool isActive(const int) const; - // Returns type of pointer id if exists, otherwise Unknown. - WebPointerProperties::PointerType getPointerType(const int) const; - // Returns whether a pointer id exists and has at least one pressed button. bool isActiveButtonsState(const int) const; diff --git a/third_party/WebKit/Source/core/input/EventHandler.cpp b/third_party/WebKit/Source/core/input/EventHandler.cpp index c9cf758f12f43..2991bbfa8b826 100644 --- a/third_party/WebKit/Source/core/input/EventHandler.cpp +++ b/third_party/WebKit/Source/core/input/EventHandler.cpp @@ -1743,11 +1743,6 @@ bool EventHandler::isPointerEventActive(int pointerId) return m_pointerEventManager.isActive(pointerId); } -WebPointerProperties::PointerType EventHandler::getPointerEventType(int pointerId) -{ - return m_pointerEventManager.getPointerEventType(pointerId); -} - void EventHandler::setPointerCapture(int pointerId, EventTarget* target) { // TODO(crbug.com/591387): This functionality should be per page not per frame. diff --git a/third_party/WebKit/Source/core/input/EventHandler.h b/third_party/WebKit/Source/core/input/EventHandler.h index c69fa8be7af77..586e21b72e6db 100644 --- a/third_party/WebKit/Source/core/input/EventHandler.h +++ b/third_party/WebKit/Source/core/input/EventHandler.h @@ -185,9 +185,6 @@ class CORE_EXPORT EventHandler final : public GarbageCollectedFinalizedpointerId()), - pointerEvent); - // Setting the implicit capture for touch if (pointerEvent->type() == EventTypeNames::pointerdown) setPointerCapture(pointerEvent->pointerId(), target); + WebInputEventResult result = dispatchPointerEvent( + getEffectiveTargetForPointerEvent(target, pointerEvent->pointerId()), + pointerEvent); + if (pointerEvent->type() == EventTypeNames::pointerup || pointerEvent->type() == EventTypeNames::pointercancel) { releasePointerCapture(pointerEvent->pointerId()); @@ -748,7 +747,14 @@ void PointerEventManager::setPointerCapture(int pointerId, EventTarget* target) void PointerEventManager::releasePointerCapture(int pointerId, EventTarget* target) { - if (m_pointerCaptureTarget.get(pointerId) == target) + // Only the element that is going to get the next pointer event can release + // the capture. Note that this might be different from + // |m_pointercaptureTarget|. |m_pointercaptureTarget| holds the element + // that had the capture until now and has been receiving the pointerevents + // but |m_pendingPointerCaptureTarget| indicated the element that gets the + // very next pointer event. They will be the same if there was no change in + // capturing of a particular |pointerId|. See crbug.com/614481. + if (m_pendingPointerCaptureTarget.get(pointerId) == target) releasePointerCapture(pointerId); } @@ -762,12 +768,6 @@ bool PointerEventManager::isActive(const int pointerId) const return m_pointerEventFactory.isActive(pointerId); } -WebPointerProperties::PointerType PointerEventManager::getPointerEventType( - const int pointerId) const -{ - return m_pointerEventFactory.getPointerType(pointerId); -} - bool PointerEventManager::isAnyTouchActive() const { return m_touchEventManager.isAnyTouchActive(); diff --git a/third_party/WebKit/Source/core/input/PointerEventManager.h b/third_party/WebKit/Source/core/input/PointerEventManager.h index 25426910387ac..28719781bebce 100644 --- a/third_party/WebKit/Source/core/input/PointerEventManager.h +++ b/third_party/WebKit/Source/core/input/PointerEventManager.h @@ -61,7 +61,6 @@ class CORE_EXPORT PointerEventManager { void setPointerCapture(int, EventTarget*); void releasePointerCapture(int, EventTarget*); bool isActive(const int) const; - WebPointerProperties::PointerType getPointerEventType(const int) const; // Returns whether there is any touch on the screen. bool isAnyTouchActive() const;