Chromium Code Reviews| Index: third_party/WebKit/Source/core/input/EventHandler.cpp |
| diff --git a/third_party/WebKit/Source/core/input/EventHandler.cpp b/third_party/WebKit/Source/core/input/EventHandler.cpp |
| index 0de628c3c4316a86eb5838de97713e79fee58ca7..d3f41b54e3bafa9d59f0bf852f235a75aacb1a53 100644 |
| --- a/third_party/WebKit/Source/core/input/EventHandler.cpp |
| +++ b/third_party/WebKit/Source/core/input/EventHandler.cpp |
| @@ -270,7 +270,6 @@ EventHandler::EventHandler(LocalFrame* frame) |
| , m_mousePositionIsUnknown(true) |
| , m_mouseDownTimestamp(0) |
| , m_touchPressed(false) |
| - , m_inPointerCanceledState(false) |
| , m_scrollGestureHandlingNode(nullptr) |
| , m_lastGestureScrollOverWidget(false) |
| , m_longTapShouldInvokeContextMenu(false) |
| @@ -345,7 +344,6 @@ void EventHandler::clear() |
| m_scrollbarHandlingScrollGesture = nullptr; |
| m_touchPressed = false; |
| m_pointerEventManager.clear(); |
| - m_inPointerCanceledState = false; |
| m_mouseDownMayStartDrag = false; |
| m_lastShowPressTimestamp = 0; |
| m_lastDeferredTapElement = nullptr; |
| @@ -3596,26 +3594,6 @@ void EventHandler::dispatchPointerEvents(const PlatformTouchEvent& event, |
| } |
| } |
| -void EventHandler::sendPointerCancels(HeapVector<TouchInfo>& touchInfos) |
| -{ |
| - if (!RuntimeEnabledFeatures::pointerEventEnabled()) |
| - return; |
| - |
| - for (unsigned i = 0; i < touchInfos.size(); ++i) { |
| - TouchInfo& touchInfo = touchInfos[i]; |
| - const PlatformTouchPoint& point = touchInfo.point; |
| - const PlatformTouchPoint::TouchState pointState = point.state(); |
| - |
| - if (pointState == PlatformTouchPoint::TouchReleased |
| - || pointState == PlatformTouchPoint::TouchCancelled) |
| - continue; |
| - |
| - m_pointerEventManager.sendTouchCancelPointerEvent( |
| - touchInfo.touchTarget, |
| - point); |
| - } |
| -} |
| - |
| namespace { |
| // Defining this class type local to dispatchTouchEvents() and annotating |
| @@ -3739,19 +3717,24 @@ WebInputEventResult EventHandler::handleTouchEvent(const PlatformTouchEvent& eve |
| { |
| TRACE_EVENT0("blink", "EventHandler::handleTouchEvent"); |
| + if (event.type() == PlatformEvent::TouchScrollStarted) { |
| + m_pointerEventManager.blockTouchPointers(); |
| + return WebInputEventResult::HandledSystem; |
| + } |
| + |
| const Vector<PlatformTouchPoint>& points = event.touchPoints(); |
| - bool freshTouchEvents = true; |
| + bool newTouchSequence = true; |
|
bokan
2016/04/12 22:42:46
Please also update the param name in dispatchTouch
Navid Zolghadr
2016/04/13 14:33:06
I couldn't find any use for this variable in that
mustaq
2016/04/13 14:56:27
Removed.
|
| bool allTouchReleased = true; |
| for (unsigned i = 0; i < points.size(); ++i) { |
| const PlatformTouchPoint& point = points[i]; |
| if (point.state() != PlatformTouchPoint::TouchPressed) |
| - freshTouchEvents = false; |
| + newTouchSequence = false; |
| if (point.state() != PlatformTouchPoint::TouchReleased && point.state() != PlatformTouchPoint::TouchCancelled) |
| allTouchReleased = false; |
| } |
| - if (freshTouchEvents) { |
| + if (newTouchSequence) { |
| // Ideally we'd ASSERT !m_touchSequenceDocument here since we should |
| // have cleared the active document when we saw the last release. But we |
| // have some tests that violate this, ClusterFuzz could trigger it, and |
| @@ -3926,33 +3909,19 @@ WebInputEventResult EventHandler::handleTouchEvent(const PlatformTouchEvent& eve |
| touchInfo.region = regionID; |
| } |
| - if (!m_inPointerCanceledState) { |
| - dispatchPointerEvents(event, touchInfos); |
| - // Note that the disposition of any pointer events affects only the generation of touch |
| - // events. If all pointer events were handled (and hence no touch events were fired), that |
| - // is still equivalent to the touch events going unhandled because pointer event handler |
| - // don't block scroll gesture generation. |
| - } |
| + if (newTouchSequence) |
| + m_pointerEventManager.unblockTouchPointers(); |
|
bokan
2016/04/12 22:42:46
Does this have to be way down here or can it be mo
mustaq
2016/04/13 14:56:27
I kept it here because the code above is fairly un
|
| + dispatchPointerEvents(event, touchInfos); |
| + // Note that the disposition of any pointer events affects only the generation of touch |
| + // events. If all pointer events were handled (and hence no touch events were fired), that |
| + // is still equivalent to the touch events going unhandled because pointer event handler |
| + // don't block scroll gesture generation. |
| // TODO(crbug.com/507408): If PE handlers always call preventDefault, we won't see TEs until after |
| // scrolling starts because the scrolling would suppress upcoming PEs. This sudden "break" in TE |
| // suppression can make the visible TEs inconsistent (e.g. touchmove without a touchstart). |
| - WebInputEventResult eventResult = dispatchTouchEvents(event, touchInfos, freshTouchEvents, |
| - allTouchReleased); |
| - |
| - if (!m_inPointerCanceledState) { |
| - // Check if we need to stop firing pointer events because of a touch action. |
| - // See: www.w3.org/TR/pointerevents/#declaring-candidate-regions-for-default-touch-behaviors |
| - if (event.causesScrollingIfUncanceled() && eventResult == WebInputEventResult::NotHandled) { |
| - m_inPointerCanceledState = true; |
| - sendPointerCancels(touchInfos); |
| - } |
| - } else if (allTouchReleased) { |
| - m_inPointerCanceledState = false; |
| - } |
| - |
| - return eventResult; |
| + return dispatchTouchEvents(event, touchInfos, newTouchSequence, allTouchReleased); |
|
bokan
2016/04/12 22:42:46
Question: How are touch events canceled and blocke
mustaq
2016/04/13 14:56:27
Any PE that was canceled above effectively "hides"
bokan
2016/04/13 22:59:48
Got it, thanks.
|
| } |
| void EventHandler::userGestureUtilized() |