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

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

Issue 2874263002: Don't count modifiers-changed events as being user gestures. (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « content/child/blink_platform_impl.cc ('k') | third_party/WebKit/public/platform/Platform.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/input/KeyboardEventManager.cpp
diff --git a/third_party/WebKit/Source/core/input/KeyboardEventManager.cpp b/third_party/WebKit/Source/core/input/KeyboardEventManager.cpp
index d055843cb452c15fab7e0ac75eefee288fad1909..396bbd6c25fc38d84f0b3c7c1791767964d97652 100644
--- a/third_party/WebKit/Source/core/input/KeyboardEventManager.cpp
+++ b/third_party/WebKit/Source/core/input/KeyboardEventManager.cpp
@@ -4,6 +4,8 @@
#include "KeyboardEventManager.h"
+#include <memory>
+
#include "core/dom/DocumentUserGestureToken.h"
#include "core/dom/Element.h"
#include "core/editing/Editor.h"
@@ -23,6 +25,7 @@
#include "platform/KeyboardCodes.h"
#include "platform/UserGestureIndicator.h"
#include "platform/WindowsKeyboardCodes.h"
+#include "public/platform/Platform.h"
#include "public/platform/WebInputEvent.h"
#if OS(WIN)
@@ -187,8 +190,17 @@ WebInputEventResult KeyboardEventManager::KeyEvent(
if (!node)
return WebInputEventResult::kNotHandled;
- UserGestureIndicator gesture_indicator(
- DocumentUserGestureToken::Create(frame_->GetDocument()));
+ // To be meaningful enough to indicate user intention, a keyboard event needs
+ // - not to be a modifier event
+ // https://crbug.com/709765
+ bool is_modifier =
+ Platform::Current()->IsDomKeyForModifier(initial_key_event.dom_key);
+
+ std::unique_ptr<UserGestureIndicator> gesture_indicator;
+ if (!is_modifier) {
+ gesture_indicator.reset(new UserGestureIndicator(
+ DocumentUserGestureToken::Create(frame_->GetDocument())));
+ }
// In IE, access keys are special, they are handled after default keydown
// processing, but cannot be canceled - this is hard to match. On Mac OS X,
« no previous file with comments | « content/child/blink_platform_impl.cc ('k') | third_party/WebKit/public/platform/Platform.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698