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 9a25c2fe9e6fd714872059c463c62dbec30b83fd..e72c3ff1d58c46672a6df9b7d33e9ad24941196e 100644 |
| --- a/third_party/WebKit/Source/core/input/EventHandler.cpp |
| +++ b/third_party/WebKit/Source/core/input/EventHandler.cpp |
| @@ -34,6 +34,7 @@ |
| #include "core/clipboard/DataTransfer.h" |
| #include "core/dom/DOMNodeIds.h" |
| #include "core/dom/Document.h" |
| +#include "core/dom/DocumentUserGestureToken.h" |
| #include "core/dom/TouchList.h" |
| #include "core/dom/shadow/FlatTreeTraversal.h" |
| #include "core/dom/shadow/ShadowRoot.h" |
| @@ -572,10 +573,6 @@ WebInputEventResult EventHandler::handleMousePressEvent( |
| WebPointerProperties::Button::NoButton) |
| return WebInputEventResult::HandledSuppressed; |
| - UserGestureIndicator gestureIndicator(UserGestureToken::create()); |
| - m_frame->localFrameRoot()->eventHandler().m_lastMouseDownUserGestureToken = |
| - UserGestureIndicator::currentToken(); |
| - |
| if (m_eventHandlerWillResetCapturingMouseEventsNode) |
| m_capturingMouseEventsNode = nullptr; |
| m_mouseEventManager->handleMousePressEventUpdateStates(mouseEvent); |
| @@ -619,6 +616,11 @@ WebInputEventResult EventHandler::handleMousePressEvent( |
| return result; |
| } |
| + UserGestureIndicator gestureIndicator( |
| + DocumentUserGestureToken::create(m_frame->document())); |
| + m_frame->localFrameRoot()->eventHandler().m_lastMouseDownUserGestureToken = |
| + UserGestureIndicator::currentToken(); |
| + |
| if (RuntimeEnabledFeatures::middleClickAutoscrollEnabled()) { |
| // We store whether middle click autoscroll is in progress before calling |
| // stopAutoscroll() because it will set m_autoscrollType to NoAutoscroll on |
| @@ -897,20 +899,6 @@ WebInputEventResult EventHandler::handleMouseReleaseEvent( |
| if (!mouseEvent.fromTouch()) |
| m_frame->selection().setCaretBlinkingSuspended(false); |
| - std::unique_ptr<UserGestureIndicator> gestureIndicator; |
| - |
| - if (m_frame->localFrameRoot() |
| - ->eventHandler() |
| - .m_lastMouseDownUserGestureToken) { |
| - gestureIndicator = wrapUnique(new UserGestureIndicator( |
| - m_frame->localFrameRoot() |
| - ->eventHandler() |
| - .m_lastMouseDownUserGestureToken.release())); |
| - } else { |
| - gestureIndicator = |
| - wrapUnique(new UserGestureIndicator(UserGestureToken::create())); |
| - } |
| - |
| if (RuntimeEnabledFeatures::middleClickAutoscrollEnabled()) { |
| if (Page* page = m_frame->page()) |
| page->autoscrollController().handleMouseReleaseForMiddleClickAutoscroll( |
| @@ -951,6 +939,19 @@ WebInputEventResult EventHandler::handleMouseReleaseEvent( |
| if (subframe) |
| return passMouseReleaseEventToSubframe(mev, subframe); |
| + std::unique_ptr<UserGestureIndicator> gestureIndicator; |
|
Rick Byers
2016/10/17 17:02:46
So the effect of the mouse changes is that it's th
Nate Chapin
2016/10/18 23:26:33
Done, and explicitly noted that this behavior may
|
| + if (m_frame->localFrameRoot() |
| + ->eventHandler() |
| + .m_lastMouseDownUserGestureToken) { |
| + gestureIndicator = wrapUnique(new UserGestureIndicator( |
| + m_frame->localFrameRoot() |
| + ->eventHandler() |
| + .m_lastMouseDownUserGestureToken.release())); |
| + } else { |
| + gestureIndicator = wrapUnique(new UserGestureIndicator( |
| + DocumentUserGestureToken::create(m_frame->document()))); |
| + } |
| + |
| WebInputEventResult eventResult = updatePointerTargetAndDispatchEvents( |
| EventTypeNames::mouseup, mev.innerNode(), mev.event()); |