Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(460)

Unified Diff: third_party/WebKit/Source/core/input/PointerEventManager.cpp

Issue 1800143002: Notify Blink about start of gesture scroll through a queued event. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added a few checks. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/input/PointerEventManager.cpp
diff --git a/third_party/WebKit/Source/core/input/PointerEventManager.cpp b/third_party/WebKit/Source/core/input/PointerEventManager.cpp
index f784bbcc17891a48cdfd2f466996e4e401ae6b86..54a41d4529855a7ea636ad869b2513a7acc612ad 100644
--- a/third_party/WebKit/Source/core/input/PointerEventManager.cpp
+++ b/third_party/WebKit/Source/core/input/PointerEventManager.cpp
@@ -283,26 +283,46 @@ void PointerEventManager::setNodeUnderPointer(
}
}
-void PointerEventManager::sendTouchCancelPointerEvent(EventTarget* target, const PlatformTouchPoint& point)
+void PointerEventManager::blockTouchPointers()
{
- PointerEvent* pointerEvent = m_pointerEventFactory.createPointerCancelEvent(point);
+ if (m_inCanceledStateForPointerTypeTouch)
+ return;
+ m_inCanceledStateForPointerTypeTouch = true;
+ HeapVector<int> touchPointerIds
+ = m_pointerEventFactory.getPointerIdsOfType(WebPointerProperties::PointerType::Touch);
- processCaptureAndPositionOfPointerEvent(pointerEvent, target);
+ for (int pointerId : touchPointerIds) {
+ PointerEvent* pointerEvent
+ = m_pointerEventFactory.createPointerCancelEvent(
+ pointerId, WebPointerProperties::PointerType::Touch);
- // TODO(nzolghadr): crbug.com/579553 dealing with implicit touch capturing vs pointer event capturing
- dispatchPointerEvent(
- getEffectiveTargetForPointerEvent(target, pointerEvent->pointerId()),
- pointerEvent);
+ ASSERT(m_nodeUnderPointer.contains(pointerId));
+ EventTarget* target = m_nodeUnderPointer.get(pointerId).target;
- releasePointerCapture(pointerEvent->pointerId());
+ processCaptureAndPositionOfPointerEvent(pointerEvent, target);
+
+ // TODO(nzolghadr): This event follows implicit TE capture. The actual target
+ // would depend on PE capturing. Perhaps need to split TE/PE event path upstream?
+ // crbug.com/579553.
+ dispatchPointerEvent(
+ getEffectiveTargetForPointerEvent(target, pointerEvent->pointerId()),
+ pointerEvent);
+
+ releasePointerCapture(pointerEvent->pointerId());
+
+ // Sending the leave/out events and lostpointercapture
+ // because the next touch event will have a different id. So delayed
+ // sending of lostpointercapture won't work here.
+ processCaptureAndPositionOfPointerEvent(pointerEvent, nullptr);
- // Sending the leave/out events and lostpointercapture
- // because the next touch event will have a different id. So delayed
- // sending of lostpointercapture won't work here.
- processCaptureAndPositionOfPointerEvent(pointerEvent, nullptr);
+ removePointer(pointerEvent);
+ }
+}
- removePointer(pointerEvent);
+void PointerEventManager::unblockTouchPointers()
+{
+ m_inCanceledStateForPointerTypeTouch = false;
}
WebInputEventResult PointerEventManager::sendTouchPointerEvent(
@@ -311,6 +331,9 @@ WebInputEventResult PointerEventManager::sendTouchPointerEvent(
const double width, const double height,
const double clientX, const double clientY)
{
+ if (m_inCanceledStateForPointerTypeTouch)
+ return WebInputEventResult::NotHandled;
+
PointerEvent* pointerEvent =
m_pointerEventFactory.create(
pointerEventNameForTouchPointState(touchPoint.state()),
@@ -398,6 +421,7 @@ PointerEventManager::~PointerEventManager()
void PointerEventManager::clear()
{
m_preventMouseEventForPointerTypeMouse = false;
+ m_inCanceledStateForPointerTypeTouch = false;
m_pointerEventFactory.clear();
m_nodeUnderPointer.clear();
m_pointerCaptureTarget.clear();
@@ -527,8 +551,8 @@ EventTarget* PointerEventManager::getCapturingNode(int pointerId)
void PointerEventManager::removePointer(
PointerEvent* pointerEvent)
{
- if (m_pointerEventFactory.remove(pointerEvent)) {
- int pointerId = pointerEvent->pointerId();
+ int pointerId = pointerEvent->pointerId();
+ if (m_pointerEventFactory.remove(pointerId)) {
m_pendingPointerCaptureTarget.remove(pointerId);
m_pointerCaptureTarget.remove(pointerId);
m_nodeUnderPointer.remove(pointerId);

Powered by Google App Engine
This is Rietveld 408576698