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

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

Issue 2616623002: Do not send redundant selectionchange-events (decouple focus) (Closed)
Patch Set: Move isSelectionInDocument() and selectionHasFocus() to EditingUtilities Created 3 years, 9 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/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 2f2478ea8995c980aba97a71120a36575bfe5239..ffa4dca90b9e8a19fa325857f07412c44d8e39ab 100644
--- a/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp
+++ b/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp
@@ -1888,6 +1888,16 @@ static bool enabledInEditableText(LocalFrame& frame,
return frame.editor().selectionForCommand(event).rootEditableElement();
}
+static bool enabledInFocusedEditableText(LocalFrame& frame,
+ Event* event,
+ EditorCommandSource dummy) {
+ if (!enabledInEditableText(frame, event, dummy))
+ return false;
+
+ // We only move carret when the carret's selection has focus.
+ return selectionHasFocus(frame);
+}
+
static bool enabledDelete(LocalFrame& frame,
Event* event,
EditorCommandSource source) {
@@ -2262,7 +2272,7 @@ static const EditorInternalCommand* internalCommand(const String& commandName) {
enabledVisibleSelection, stateNone, valueNull, notTextInsertion,
doNotAllowExecutionWhenDisabled},
{WebEditingCommandType::MoveDown, executeMoveDown,
yosin_UTC9 2017/03/21 06:49:59 Should we change of Move{Paragraph,Word,...}{Back,
hugoh_UTC2 2017/03/22 02:54:47 I introduced these changes to make LayoutTests/fas
- supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone,
+ supportedFromMenuOrKeyBinding, enabledInFocusedEditableText, stateNone,
valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled},
{WebEditingCommandType::MoveDownAndModifySelection,
executeMoveDownAndModifySelection, supportedFromMenuOrKeyBinding,
@@ -2276,7 +2286,7 @@ static const EditorInternalCommand* internalCommand(const String& commandName) {
enabledVisibleSelection, stateNone, valueNull, notTextInsertion,
doNotAllowExecutionWhenDisabled},
{WebEditingCommandType::MoveLeft, executeMoveLeft,
- supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone,
+ supportedFromMenuOrKeyBinding, enabledInFocusedEditableText, stateNone,
valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled},
{WebEditingCommandType::MoveLeftAndModifySelection,
executeMoveLeftAndModifySelection, supportedFromMenuOrKeyBinding,
@@ -2312,7 +2322,7 @@ static const EditorInternalCommand* internalCommand(const String& commandName) {
supportedFromMenuOrKeyBinding, enabledVisibleSelection, stateNone,
valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled},
{WebEditingCommandType::MoveRight, executeMoveRight,
- supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone,
+ supportedFromMenuOrKeyBinding, enabledInFocusedEditableText, stateNone,
valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled},
{WebEditingCommandType::MoveRightAndModifySelection,
executeMoveRightAndModifySelection, supportedFromMenuOrKeyBinding,
@@ -2393,7 +2403,7 @@ static const EditorInternalCommand* internalCommand(const String& commandName) {
supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone,
valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled},
{WebEditingCommandType::MoveUp, executeMoveUp,
- supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone,
+ supportedFromMenuOrKeyBinding, enabledInFocusedEditableText, stateNone,
valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled},
{WebEditingCommandType::MoveUpAndModifySelection,
executeMoveUpAndModifySelection, supportedFromMenuOrKeyBinding,

Powered by Google App Engine
This is Rietveld 408576698