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

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

Issue 2887213003: Make EnableCaretInEditableText return false for user-triggered command and unfocused selection (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 | « third_party/WebKit/LayoutTests/editing/execCommand/transpose_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 03772a7b444d0c8704633a5c36e56cc5c05b2ec2..66a9a55b8e74cfe059d63f33ad99451066c4b8c7 100644
--- a/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp
+++ b/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp
@@ -2033,9 +2033,12 @@ static bool EnabledVisibleSelectionAndMark(LocalFrame& frame,
static bool EnableCaretInEditableText(LocalFrame& frame,
Event* event,
- EditorCommandSource) {
+ EditorCommandSource source) {
frame.GetDocument()->UpdateStyleAndLayoutIgnorePendingStylesheets();
+ if (source == kCommandFromMenuOrKeyBinding &&
+ !frame.Selection().SelectionHasFocus())
+ return false;
const VisibleSelection& selection =
frame.GetEditor().SelectionForCommand(event);
return selection.IsCaret() && selection.IsContentEditable();
« no previous file with comments | « third_party/WebKit/LayoutTests/editing/execCommand/transpose_with_unfocused_selection.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698