diff options
Diffstat (limited to 'Source/WebCore/editing/EditorCommand.cpp')
-rw-r--r-- | Source/WebCore/editing/EditorCommand.cpp | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/Source/WebCore/editing/EditorCommand.cpp b/Source/WebCore/editing/EditorCommand.cpp index 6ea9954..8ea37bb 100644 --- a/Source/WebCore/editing/EditorCommand.cpp +++ b/Source/WebCore/editing/EditorCommand.cpp @@ -56,6 +56,7 @@ #include "Sound.h" #include "TypingCommand.h" #include "UnlinkCommand.h" +#include "UserTypingGestureIndicator.h" #include "htmlediting.h" #include "markup.h" #include <wtf/text/AtomicString.h> @@ -254,7 +255,7 @@ static int verticalScrollDistance(Frame* frame) RenderStyle* style = renderer->style(); if (!style) return 0; - if (!(style->overflowY() == OSCROLL || style->overflowY() == OAUTO || focusedNode->isContentEditable())) + if (!(style->overflowY() == OSCROLL || style->overflowY() == OAUTO || focusedNode->rendererIsEditable())) return 0; int height = std::min<int>(toRenderBox(renderer)->clientHeight(), frame->view()->visibleHeight()); @@ -294,19 +295,25 @@ static bool executeCreateLink(Frame* frame, Event*, EditorCommandSource, const S return true; } -static bool executeCut(Frame* frame, Event*, EditorCommandSource, const String&) +static bool executeCut(Frame* frame, Event*, EditorCommandSource source, const String&) { - frame->editor()->cut(); + if (source == CommandFromMenuOrKeyBinding) { + UserTypingGestureIndicator typingGestureIndicator(frame); + frame->editor()->cut(); + } else + frame->editor()->cut(); return true; } static bool executeDelete(Frame* frame, Event*, EditorCommandSource source, const String&) { switch (source) { - case CommandFromMenuOrKeyBinding: + case CommandFromMenuOrKeyBinding: { // Doesn't modify the text if the current selection isn't a range. + UserTypingGestureIndicator typingGestureIndicator(frame); frame->editor()->performDelete(); return true; + } case CommandFromDOM: case CommandFromDOMWithUserInterface: // If the current selection is a caret, delete the preceding character. IE performs forwardDelete, but we currently side with Firefox. @@ -883,21 +890,33 @@ static bool executeOutdent(Frame* frame, Event*, EditorCommandSource, const Stri return true; } -static bool executePaste(Frame* frame, Event*, EditorCommandSource, const String&) +static bool executePaste(Frame* frame, Event*, EditorCommandSource source, const String&) { - frame->editor()->paste(); + if (source == CommandFromMenuOrKeyBinding) { + UserTypingGestureIndicator typingGestureIndicator(frame); + frame->editor()->paste(); + } else + frame->editor()->paste(); return true; } -static bool executePasteAndMatchStyle(Frame* frame, Event*, EditorCommandSource, const String&) +static bool executePasteAndMatchStyle(Frame* frame, Event*, EditorCommandSource source, const String&) { - frame->editor()->pasteAsPlainText(); + if (source == CommandFromMenuOrKeyBinding) { + UserTypingGestureIndicator typingGestureIndicator(frame); + frame->editor()->pasteAsPlainText(); + } else + frame->editor()->pasteAsPlainText(); return true; } -static bool executePasteAsPlainText(Frame* frame, Event*, EditorCommandSource, const String&) +static bool executePasteAsPlainText(Frame* frame, Event*, EditorCommandSource source, const String&) { - frame->editor()->pasteAsPlainText(); + if (source == CommandFromMenuOrKeyBinding) { + UserTypingGestureIndicator typingGestureIndicator(frame); + frame->editor()->pasteAsPlainText(); + } else + frame->editor()->pasteAsPlainText(); return true; } @@ -1091,14 +1110,6 @@ static bool executeYankAndSelect(Frame* frame, Event*, EditorCommandSource, cons return true; } -#if SUPPORT_AUTOCORRECTION_PANEL -static bool executeCancelOperation(Frame* frame, Event*, EditorCommandSource, const String&) -{ - frame->editor()->handleCancelOperation(); - return true; -} -#endif - // Supported functions static bool supported(Frame*) @@ -1249,13 +1260,6 @@ static bool enabledUndo(Frame* frame, Event*, EditorCommandSource) return frame->editor()->canUndo(); } -#if SUPPORT_AUTOCORRECTION_PANEL -static bool enabledDismissCorrectionPanel(Frame* frame, Event*, EditorCommandSource) -{ - return frame->editor()->isShowingCorrectionPanel(); -} -#endif - // State functions static TriState stateNone(Frame*, Event*) @@ -1532,10 +1536,6 @@ static const CommandMap& createCommandMap() #if PLATFORM(MAC) { "TakeFindStringFromSelection", { executeTakeFindStringFromSelection, supportedFromMenuOrKeyBinding, enabledTakeFindStringFromSelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, #endif - -#if SUPPORT_AUTOCORRECTION_PANEL - { "CancelOperation", { executeCancelOperation, supportedFromMenuOrKeyBinding, enabledDismissCorrectionPanel, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, -#endif }; // These unsupported commands are listed here since they appear in the Microsoft |