| 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 75d6b411101fce61600b66355c55b3ac5ae57eb1..a40a5bc065dff8cd721b95a119fcf4bc36e0dad3 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,24 @@ WebInputEventResult EventHandler::handleMouseReleaseEvent(
|
| if (subframe)
|
| return passMouseReleaseEventToSubframe(mev, subframe);
|
|
|
| + // Mouse events will be associated with the Document where mousedown
|
| + // occurred. If, e.g., there is a mousedown, then a drag to a different
|
| + // Document and mouseup there, the mouseup's gesture will be associated with
|
| + // the mousedown's Document. It's not absolutely certain that this is the
|
| + // correct behavior.
|
| + 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(
|
| + DocumentUserGestureToken::create(m_frame->document())));
|
| + }
|
| +
|
| WebInputEventResult eventResult = updatePointerTargetAndDispatchEvents(
|
| EventTypeNames::mouseup, mev.innerNode(), mev.event());
|
|
|
|
|