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

Unified Diff: third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp

Issue 2886983002: Make EnabledVisibleSelection return false for user-triggered command and unfocused selection (Closed)
Patch Set: Tue May 16 19:43:47 PDT 2017 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 | « third_party/WebKit/LayoutTests/editing/selection/modify_extend/extend_with_unfocused_selection.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp
diff --git a/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp b/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp
index 0997b9633bc2789c5d7012f2c59a019564189db5..c1ca33153dbdef0641c9de722ec421cf18bfc496 100644
--- a/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp
+++ b/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp
@@ -2004,9 +2004,13 @@ static bool Enabled(LocalFrame&, Event*, EditorCommandSource) {
static bool EnabledVisibleSelection(LocalFrame& frame,
Event* event,
- EditorCommandSource) {
+ EditorCommandSource source) {
frame.GetDocument()->UpdateStyleAndLayoutIgnorePendingStylesheets();
+ if (source == kCommandFromMenuOrKeyBinding &&
+ !frame.Selection().SelectionHasFocus())
+ return false;
+
// The term "visible" here includes a caret in editable text or a range in any
// text.
const VisibleSelection& selection =
« no previous file with comments | « third_party/WebKit/LayoutTests/editing/selection/modify_extend/extend_with_unfocused_selection.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698