| 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 570f5228c838720a7c154fe9e0aa0375ffeb7fb3..d6fc782b72f5a838edbb895664ccd3f5d72ad20d 100644
|
| --- a/third_party/WebKit/Source/core/input/EventHandler.cpp
|
| +++ b/third_party/WebKit/Source/core/input/EventHandler.cpp
|
| @@ -50,11 +50,13 @@
|
| #include "core/events/TouchEvent.h"
|
| #include "core/events/WheelEvent.h"
|
| #include "core/fetch/ImageResource.h"
|
| +#include "core/frame/Deprecation.h"
|
| #include "core/frame/EventHandlerRegistry.h"
|
| #include "core/frame/FrameHost.h"
|
| #include "core/frame/FrameView.h"
|
| #include "core/frame/LocalFrame.h"
|
| #include "core/frame/Settings.h"
|
| +#include "core/frame/UseCounter.h"
|
| #include "core/frame/VisualViewport.h"
|
| #include "core/html/HTMLDialogElement.h"
|
| #include "core/html/HTMLFrameElementBase.h"
|
| @@ -978,7 +980,7 @@ WebInputEventResult EventHandler::handleMousePressEvent(const PlatformMouseEvent
|
| RefPtrWillBeRawPtr<FrameView> protector(m_frame->view());
|
|
|
| UserGestureIndicator gestureIndicator(DefinitelyProcessingUserGesture);
|
| - m_frame->localFrameRoot()->eventHandler().m_lastMouseDownUserGestureToken = gestureIndicator.currentToken();
|
| + m_frame->localFrameRoot()->eventHandler().m_lastMouseDownUserGestureToken = UserGestureIndicator::currentToken();
|
|
|
| cancelFakeMouseMoveEvent();
|
| if (m_eventHandlerWillResetCapturingMouseEventsNode)
|
| @@ -3733,15 +3735,6 @@ WebInputEventResult EventHandler::handleTouchEvent(const PlatformTouchEvent& eve
|
| m_touchSequenceUserGestureToken.clear();
|
| }
|
|
|
| - OwnPtr<UserGestureIndicator> gestureIndicator;
|
| -
|
| - if (m_touchSequenceUserGestureToken)
|
| - gestureIndicator = adoptPtr(new UserGestureIndicator(m_touchSequenceUserGestureToken.release()));
|
| - else
|
| - gestureIndicator = adoptPtr(new UserGestureIndicator(DefinitelyProcessingUserGesture));
|
| -
|
| - m_touchSequenceUserGestureToken = gestureIndicator->currentToken();
|
| -
|
| ASSERT(m_frame->view());
|
| if (m_touchSequenceDocument && (!m_touchSequenceDocument->frame() || !m_touchSequenceDocument->frame()->view())) {
|
| // If the active touch document has no frame or view, it's probably being destroyed
|
| @@ -3812,6 +3805,25 @@ WebInputEventResult EventHandler::handleTouchEvent(const PlatformTouchEvent& eve
|
| return WebInputEventResult::NotHandled;
|
| }
|
|
|
| + // Whether a touch should be considered a "user gesture" or not is a tricky question.
|
| + // XXX - link to doc,
|
| + // TODO(rbyers): Disable user gesture in some cases but retain logging for now (crbug.com/582140).
|
| + OwnPtr<UserGestureIndicator> gestureIndicator;
|
| + if (event.touchPoints().size() == 1
|
| + && event.touchPoints()[0].state() == PlatformTouchPoint::TouchReleased
|
| + && !event.causesScrollingIfUncanceled()) {
|
| + // This is a touchend corresponding to a tap, definitely a user gesture.
|
| + gestureIndicator = adoptPtr(new UserGestureIndicator(DefinitelyProcessingUserGesture));
|
| + } else {
|
| + // This is some other touch event that perhaps shouldn't be considered a user gesture.
|
| + if (m_touchSequenceUserGestureToken)
|
| + gestureIndicator = adoptPtr(new UserGestureIndicator(m_touchSequenceUserGestureToken.release(), &m_touchSequenceDocument->frame()->eventHandler()));
|
| + else
|
| + gestureIndicator = adoptPtr(new UserGestureIndicator(DefinitelyProcessingUserGesture, &m_touchSequenceDocument->frame()->eventHandler()));
|
| + m_touchSequenceUserGestureToken = UserGestureIndicator::currentToken();
|
| + }
|
| +
|
| +
|
| // Compute and store the common info used by both PointerEvent and TouchEvent.
|
| WillBeHeapVector<TouchInfo> touchInfos(points.size());
|
|
|
| @@ -3905,6 +3917,14 @@ WebInputEventResult EventHandler::handleTouchEvent(const PlatformTouchEvent& eve
|
| return eventResult;
|
| }
|
|
|
| +void EventHandler::userGestureUsed()
|
| +{
|
| + // This is invoked UserGestureIndicators created in handleTouchEvent which perhaps represent
|
| + // touch actions which shouldn't be considered a user-gesture.
|
| + UseCounter::count(m_frame, UseCounter::TouchDragUserGestureUsed);
|
| + Deprecation::countDeprecationCrossOriginIframe(m_frame, UseCounter::TouchDragUserGestureUsedCrossOrigin);
|
| +}
|
| +
|
| void EventHandler::setLastKnownMousePosition(const PlatformMouseEvent& event)
|
| {
|
| m_mousePositionIsUnknown = false;
|
|
|