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

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

Issue 2408333004: Move persistent gesture state to Document, add DocumentUserGestureToken (Closed)
Patch Set: a Created 4 years, 2 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/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());

Powered by Google App Engine
This is Rietveld 408576698