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

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

Issue 1752933002: [InputEvent] Fire 'beforeinput' during typing, pressing hot keys and IME composition (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Yosi's review Created 4 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 046db31e9322c09c370e34c9c4fd41a2c656c8f1..87fa6593e8a495d39eaf7e293378780df3f6dbb5 100644
--- a/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp
+++ b/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp
@@ -72,6 +72,7 @@ using namespace HTMLNames;
class EditorInternalCommand {
public:
+ const char* commandName;
int idForUserMetrics;
bool (*execute)(LocalFrame&, Event*, EditorCommandSource, const String&);
bool (*isSupportedFromDOM)(LocalFrame*);
@@ -79,6 +80,7 @@ public:
TriState (*state)(LocalFrame&, Event*);
String (*value)(LocalFrame&, Event*);
bool isTextInsertion;
+ bool shouldFireInputEvent;
// TODO(yosin) We should have |canExecute()|, which checks clipboard
// accessibility to simplify |Editor::Command::execute()|.
bool allowExecutionWhenDisabled;
@@ -89,6 +91,9 @@ typedef HashMap<String, const EditorInternalCommand*, CaseFoldingHash> CommandMa
static const bool notTextInsertion = false;
static const bool isTextInsertion = true;
+static const bool doNotFireInputEvent = false;
+static const bool shouldFireInputEvent = true;
+
static const bool allowExecutionWhenDisabled = true;
static const bool doNotAllowExecutionWhenDisabled = false;
@@ -1479,155 +1484,150 @@ static String valueFormatBlock(LocalFrame& frame, Event*)
// Map of functions
-struct CommandEntry {
- const char* name;
- EditorInternalCommand command;
-};
-
static const CommandMap& createCommandMap()
{
// If you add new commands, you should assign new Id to each idForUserMetrics and update MappedEditingCommands
// in chrome/trunk/src/tools/metrics/histograms/histograms.xml.
- static const CommandEntry commands[] = {
- { "AlignCenter", {139, executeJustifyCenter, supportedFromMenuOrKeyBinding, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "AlignJustified", {1, executeJustifyFull, supportedFromMenuOrKeyBinding, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "AlignLeft", {2, executeJustifyLeft, supportedFromMenuOrKeyBinding, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "AlignRight", {3, executeJustifyRight, supportedFromMenuOrKeyBinding, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "BackColor", {4, executeBackColor, supported, enabledInRichlyEditableText, stateNone, valueBackColor, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "BackwardDelete", {5, executeDeleteBackward, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, // FIXME: remove BackwardDelete when Safari for Windows stops using it.
- { "Bold", {6, executeToggleBold, supported, enabledInRichlyEditableText, stateBold, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "Copy", {7, executeCopy, supported, enabledCopy, stateNone, valueNull, notTextInsertion, allowExecutionWhenDisabled } },
- { "CreateLink", {8, executeCreateLink, supported, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "Cut", {9, executeCut, supported, enabledCut, stateNone, valueNull, notTextInsertion, allowExecutionWhenDisabled } },
- { "DefaultParagraphSeparator", {10, executeDefaultParagraphSeparator, supported, enabled, stateNone, valueDefaultParagraphSeparator, notTextInsertion, doNotAllowExecutionWhenDisabled} },
- { "Delete", {11, executeDelete, supported, enabledDelete, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "DeleteBackward", {12, executeDeleteBackward, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "DeleteBackwardByDecomposingPreviousCharacter", {13, executeDeleteBackwardByDecomposingPreviousCharacter, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "DeleteForward", {14, executeDeleteForward, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "DeleteToBeginningOfLine", {15, executeDeleteToBeginningOfLine, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "DeleteToBeginningOfParagraph", {16, executeDeleteToBeginningOfParagraph, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "DeleteToEndOfLine", {17, executeDeleteToEndOfLine, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "DeleteToEndOfParagraph", {18, executeDeleteToEndOfParagraph, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "DeleteToMark", {19, executeDeleteToMark, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "DeleteWordBackward", {20, executeDeleteWordBackward, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "DeleteWordForward", {21, executeDeleteWordForward, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "FindString", {22, executeFindString, supported, enabled, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "FontName", {23, executeFontName, supported, enabledInEditableText, stateNone, valueFontName, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "FontSize", {24, executeFontSize, supported, enabledInEditableText, stateNone, valueFontSize, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "FontSizeDelta", {25, executeFontSizeDelta, supported, enabledInEditableText, stateNone, valueFontSizeDelta, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "ForeColor", {26, executeForeColor, supported, enabledInRichlyEditableText, stateNone, valueForeColor, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "FormatBlock", {27, executeFormatBlock, supported, enabledInRichlyEditableText, stateNone, valueFormatBlock, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "ForwardDelete", {28, executeForwardDelete, supported, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "HiliteColor", {29, executeBackColor, supported, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "IgnoreSpelling", {30, executeIgnoreSpelling, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "Indent", {31, executeIndent, supported, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "InsertBacktab", {32, executeInsertBacktab, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, isTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "InsertHTML", {33, executeInsertHTML, supported, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "InsertHorizontalRule", {34, executeInsertHorizontalRule, supported, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "InsertImage", {35, executeInsertImage, supported, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "InsertLineBreak", {36, executeInsertLineBreak, supported, enabledInEditableText, stateNone, valueNull, isTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "InsertNewline", {37, executeInsertNewline, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, isTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "InsertNewlineInQuotedContent", {38, executeInsertNewlineInQuotedContent, supported, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "InsertOrderedList", {39, executeInsertOrderedList, supported, enabledInRichlyEditableText, stateOrderedList, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "InsertParagraph", {40, executeInsertParagraph, supported, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "InsertTab", {41, executeInsertTab, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, isTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "InsertText", {42, executeInsertText, supported, enabledInEditableText, stateNone, valueNull, isTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "InsertUnorderedList", {43, executeInsertUnorderedList, supported, enabledInRichlyEditableText, stateUnorderedList, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "Italic", {44, executeToggleItalic, supported, enabledInRichlyEditableText, stateItalic, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "JustifyCenter", {45, executeJustifyCenter, supported, enabledInRichlyEditableText, stateJustifyCenter, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "JustifyFull", {46, executeJustifyFull, supported, enabledInRichlyEditableText, stateJustifyFull, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "JustifyLeft", {47, executeJustifyLeft, supported, enabledInRichlyEditableText, stateJustifyLeft, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "JustifyNone", {48, executeJustifyLeft, supported, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "JustifyRight", {49, executeJustifyRight, supported, enabledInRichlyEditableText, stateJustifyRight, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "MakeTextWritingDirectionLeftToRight", {50, executeMakeTextWritingDirectionLeftToRight, supportedFromMenuOrKeyBinding, enabledInRichlyEditableText, stateTextWritingDirectionLeftToRight, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "MakeTextWritingDirectionNatural", {51, executeMakeTextWritingDirectionNatural, supportedFromMenuOrKeyBinding, enabledInRichlyEditableText, stateTextWritingDirectionNatural, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "MakeTextWritingDirectionRightToLeft", {52, executeMakeTextWritingDirectionRightToLeft, supportedFromMenuOrKeyBinding, enabledInRichlyEditableText, stateTextWritingDirectionRightToLeft, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "MoveBackward", {53, executeMoveBackward, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "MoveBackwardAndModifySelection", {54, executeMoveBackwardAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "MoveDown", {55, executeMoveDown, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "MoveDownAndModifySelection", {56, executeMoveDownAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "MoveForward", {57, executeMoveForward, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "MoveForwardAndModifySelection", {58, executeMoveForwardAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "MoveLeft", {59, executeMoveLeft, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "MoveLeftAndModifySelection", {60, executeMoveLeftAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "MovePageDown", {61, executeMovePageDown, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "MovePageDownAndModifySelection", {62, executeMovePageDownAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "MovePageUp", {63, executeMovePageUp, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "MovePageUpAndModifySelection", {64, executeMovePageUpAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "MoveParagraphBackward", {65, executeMoveParagraphBackward, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "MoveParagraphBackwardAndModifySelection", {66, executeMoveParagraphBackwardAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "MoveParagraphForward", {67, executeMoveParagraphForward, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "MoveParagraphForwardAndModifySelection", {68, executeMoveParagraphForwardAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "MoveRight", {69, executeMoveRight, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "MoveRightAndModifySelection", {70, executeMoveRightAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "MoveToBeginningOfDocument", {71, executeMoveToBeginningOfDocument, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "MoveToBeginningOfDocumentAndModifySelection", {72, executeMoveToBeginningOfDocumentAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "MoveToBeginningOfLine", {73, executeMoveToBeginningOfLine, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "MoveToBeginningOfLineAndModifySelection", {74, executeMoveToBeginningOfLineAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "MoveToBeginningOfParagraph", {75, executeMoveToBeginningOfParagraph, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "MoveToBeginningOfParagraphAndModifySelection", {76, executeMoveToBeginningOfParagraphAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "MoveToBeginningOfSentence", {77, executeMoveToBeginningOfSentence, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "MoveToBeginningOfSentenceAndModifySelection", {78, executeMoveToBeginningOfSentenceAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "MoveToEndOfDocument", {79, executeMoveToEndOfDocument, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "MoveToEndOfDocumentAndModifySelection", {80, executeMoveToEndOfDocumentAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "MoveToEndOfLine", {81, executeMoveToEndOfLine, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "MoveToEndOfLineAndModifySelection", {82, executeMoveToEndOfLineAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "MoveToEndOfParagraph", {83, executeMoveToEndOfParagraph, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "MoveToEndOfParagraphAndModifySelection", {84, executeMoveToEndOfParagraphAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "MoveToEndOfSentence", {85, executeMoveToEndOfSentence, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "MoveToEndOfSentenceAndModifySelection", {86, executeMoveToEndOfSentenceAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "MoveToLeftEndOfLine", {87, executeMoveToLeftEndOfLine, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "MoveToLeftEndOfLineAndModifySelection", {88, executeMoveToLeftEndOfLineAndModifySelection, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "MoveToRightEndOfLine", {89, executeMoveToRightEndOfLine, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "MoveToRightEndOfLineAndModifySelection", {90, executeMoveToRightEndOfLineAndModifySelection, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "MoveUp", {91, executeMoveUp, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "MoveUpAndModifySelection", {92, executeMoveUpAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "MoveWordBackward", {93, executeMoveWordBackward, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "MoveWordBackwardAndModifySelection", {94, executeMoveWordBackwardAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "MoveWordForward", {95, executeMoveWordForward, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "MoveWordForwardAndModifySelection", {96, executeMoveWordForwardAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "MoveWordLeft", {97, executeMoveWordLeft, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "MoveWordLeftAndModifySelection", {98, executeMoveWordLeftAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "MoveWordRight", {99, executeMoveWordRight, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "MoveWordRightAndModifySelection", {100, executeMoveWordRightAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "Outdent", {101, executeOutdent, supported, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "OverWrite", {102, executeToggleOverwrite, supportedFromMenuOrKeyBinding, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "Paste", {103, executePaste, supported, enabledPaste, stateNone, valueNull, notTextInsertion, allowExecutionWhenDisabled } },
- { "PasteAndMatchStyle", {104, executePasteAndMatchStyle, supported, enabledPaste, stateNone, valueNull, notTextInsertion, allowExecutionWhenDisabled } },
- { "PasteGlobalSelection", {105, executePasteGlobalSelection, supportedFromMenuOrKeyBinding, enabledPaste, stateNone, valueNull, notTextInsertion, allowExecutionWhenDisabled } },
- { "Print", {106, executePrint, supported, enabled, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "Redo", {107, executeRedo, supported, enabledRedo, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "RemoveFormat", {108, executeRemoveFormat, supported, enabledRangeInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "ScrollPageBackward", {109, executeScrollPageBackward, supportedFromMenuOrKeyBinding, enabled, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "ScrollPageForward", {110, executeScrollPageForward, supportedFromMenuOrKeyBinding, enabled, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "ScrollLineUp", {111, executeScrollLineUp, supportedFromMenuOrKeyBinding, enabled, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "ScrollLineDown", {112, executeScrollLineDown, supportedFromMenuOrKeyBinding, enabled, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "ScrollToBeginningOfDocument", {113, executeScrollToBeginningOfDocument, supportedFromMenuOrKeyBinding, enabled, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "ScrollToEndOfDocument", {114, executeScrollToEndOfDocument, supportedFromMenuOrKeyBinding, enabled, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "SelectAll", {115, executeSelectAll, supported, enabled, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "SelectLine", {116, executeSelectLine, supportedFromMenuOrKeyBinding, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "SelectParagraph", {117, executeSelectParagraph, supportedFromMenuOrKeyBinding, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "SelectSentence", {118, executeSelectSentence, supportedFromMenuOrKeyBinding, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "SelectToMark", {119, executeSelectToMark, supportedFromMenuOrKeyBinding, enabledVisibleSelectionAndMark, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "SelectWord", {120, executeSelectWord, supportedFromMenuOrKeyBinding, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "SetMark", {121, executeSetMark, supportedFromMenuOrKeyBinding, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "Strikethrough", {122, executeStrikethrough, supported, enabledInRichlyEditableText, stateStrikethrough, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "StyleWithCSS", {123, executeStyleWithCSS, supported, enabled, stateStyleWithCSS, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "Subscript", {124, executeSubscript, supported, enabledInRichlyEditableText, stateSubscript, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "Superscript", {125, executeSuperscript, supported, enabledInRichlyEditableText, stateSuperscript, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "SwapWithMark", {126, executeSwapWithMark, supportedFromMenuOrKeyBinding, enabledVisibleSelectionAndMark, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "ToggleBold", {127, executeToggleBold, supportedFromMenuOrKeyBinding, enabledInRichlyEditableText, stateBold, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "ToggleItalic", {128, executeToggleItalic, supportedFromMenuOrKeyBinding, enabledInRichlyEditableText, stateItalic, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "ToggleUnderline", {129, executeUnderline, supportedFromMenuOrKeyBinding, enabledInRichlyEditableText, stateUnderline, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "Transpose", {130, executeTranspose, supported, enableCaretInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "Underline", {131, executeUnderline, supported, enabledInRichlyEditableText, stateUnderline, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "Undo", {132, executeUndo, supported, enabledUndo, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "Unlink", {133, executeUnlink, supported, enabledRangeInRichlyEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "Unscript", {134, executeUnscript, supportedFromMenuOrKeyBinding, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "Unselect", {135, executeUnselect, supported, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "UseCSS", {136, executeUseCSS, supported, enabled, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "Yank", {137, executeYank, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "YankAndSelect", {138, executeYankAndSelect, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
+ static const EditorInternalCommand commands[] = {
+ { "AlignCenter", 139, executeJustifyCenter, supportedFromMenuOrKeyBinding, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "AlignJustified", 1, executeJustifyFull, supportedFromMenuOrKeyBinding, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "AlignLeft", 2, executeJustifyLeft, supportedFromMenuOrKeyBinding, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "AlignRight", 3, executeJustifyRight, supportedFromMenuOrKeyBinding, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "BackColor", 4, executeBackColor, supported, enabledInRichlyEditableText, stateNone, valueBackColor, notTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "BackwardDelete", 5, executeDeleteBackward, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled }, // FIXME: remove BackwardDelete when Safari for Windows stops using it.
+ { "Bold", 6, executeToggleBold, supported, enabledInRichlyEditableText, stateBold, valueNull, notTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "Copy", 7, executeCopy, supported, enabledCopy, stateNone, valueNull, notTextInsertion, shouldFireInputEvent, allowExecutionWhenDisabled },
+ { "CreateLink", 8, executeCreateLink, supported, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "Cut", 9, executeCut, supported, enabledCut, stateNone, valueNull, notTextInsertion, shouldFireInputEvent, allowExecutionWhenDisabled },
+ { "DefaultParagraphSeparator", 10, executeDefaultParagraphSeparator, supported, enabled, stateNone, valueDefaultParagraphSeparator, notTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "Delete", 11, executeDelete, supported, enabledDelete, stateNone, valueNull, notTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "DeleteBackward", 12, executeDeleteBackward, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "DeleteBackwardByDecomposingPreviousCharacter", 13, executeDeleteBackwardByDecomposingPreviousCharacter, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "DeleteForward", 14, executeDeleteForward, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "DeleteToBeginningOfLine", 15, executeDeleteToBeginningOfLine, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "DeleteToBeginningOfParagraph", 16, executeDeleteToBeginningOfParagraph, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "DeleteToEndOfLine", 17, executeDeleteToEndOfLine, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "DeleteToEndOfParagraph", 18, executeDeleteToEndOfParagraph, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "DeleteToMark", 19, executeDeleteToMark, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "DeleteWordBackward", 20, executeDeleteWordBackward, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "DeleteWordForward", 21, executeDeleteWordForward, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "FindString", 22, executeFindString, supported, enabled, stateNone, valueNull, notTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "FontName", 23, executeFontName, supported, enabledInEditableText, stateNone, valueFontName, notTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "FontSize", 24, executeFontSize, supported, enabledInEditableText, stateNone, valueFontSize, notTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "FontSizeDelta", 25, executeFontSizeDelta, supported, enabledInEditableText, stateNone, valueFontSizeDelta, notTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "ForeColor", 26, executeForeColor, supported, enabledInRichlyEditableText, stateNone, valueForeColor, notTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "FormatBlock", 27, executeFormatBlock, supported, enabledInRichlyEditableText, stateNone, valueFormatBlock, notTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "ForwardDelete", 28, executeForwardDelete, supported, enabledInEditableText, stateNone, valueNull, notTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "HiliteColor", 29, executeBackColor, supported, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "IgnoreSpelling", 30, executeIgnoreSpelling, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "Indent", 31, executeIndent, supported, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "InsertBacktab", 32, executeInsertBacktab, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, isTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "InsertHTML", 33, executeInsertHTML, supported, enabledInEditableText, stateNone, valueNull, notTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "InsertHorizontalRule", 34, executeInsertHorizontalRule, supported, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "InsertImage", 35, executeInsertImage, supported, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "InsertLineBreak", 36, executeInsertLineBreak, supported, enabledInEditableText, stateNone, valueNull, isTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "InsertNewline", 37, executeInsertNewline, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, isTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "InsertNewlineInQuotedContent", 38, executeInsertNewlineInQuotedContent, supported, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "InsertOrderedList", 39, executeInsertOrderedList, supported, enabledInRichlyEditableText, stateOrderedList, valueNull, notTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "InsertParagraph", 40, executeInsertParagraph, supported, enabledInEditableText, stateNone, valueNull, notTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "InsertTab", 41, executeInsertTab, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, isTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "InsertText", 42, executeInsertText, supported, enabledInEditableText, stateNone, valueNull, isTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "InsertUnorderedList", 43, executeInsertUnorderedList, supported, enabledInRichlyEditableText, stateUnorderedList, valueNull, notTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "Italic", 44, executeToggleItalic, supported, enabledInRichlyEditableText, stateItalic, valueNull, notTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "JustifyCenter", 45, executeJustifyCenter, supported, enabledInRichlyEditableText, stateJustifyCenter, valueNull, notTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "JustifyFull", 46, executeJustifyFull, supported, enabledInRichlyEditableText, stateJustifyFull, valueNull, notTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "JustifyLeft", 47, executeJustifyLeft, supported, enabledInRichlyEditableText, stateJustifyLeft, valueNull, notTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "JustifyNone", 48, executeJustifyLeft, supported, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "JustifyRight", 49, executeJustifyRight, supported, enabledInRichlyEditableText, stateJustifyRight, valueNull, notTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "MakeTextWritingDirectionLeftToRight", 50, executeMakeTextWritingDirectionLeftToRight, supportedFromMenuOrKeyBinding, enabledInRichlyEditableText, stateTextWritingDirectionLeftToRight, valueNull, notTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "MakeTextWritingDirectionNatural", 51, executeMakeTextWritingDirectionNatural, supportedFromMenuOrKeyBinding, enabledInRichlyEditableText, stateTextWritingDirectionNatural, valueNull, notTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "MakeTextWritingDirectionRightToLeft", 52, executeMakeTextWritingDirectionRightToLeft, supportedFromMenuOrKeyBinding, enabledInRichlyEditableText, stateTextWritingDirectionRightToLeft, valueNull, notTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "MoveBackward", 53, executeMoveBackward, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotFireInputEvent, doNotAllowExecutionWhenDisabled },
chongz 2016/03/15 19:19:10 Currently set |doNotFireInputEvent| to commands "M
yosin_UTC9 2016/03/16 01:46:51 Entries having |shouldFireInputEvent| should have
chongz 2016/03/16 21:51:44 I'm not so sure if it's necessary, I guess we can
yosin_UTC9 2016/03/17 01:52:23 Yes. We can check Editor::Command::m_source in exe
+ { "MoveBackwardAndModifySelection", 54, executeMoveBackwardAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "MoveDown", 55, executeMoveDown, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "MoveDownAndModifySelection", 56, executeMoveDownAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "MoveForward", 57, executeMoveForward, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "MoveForwardAndModifySelection", 58, executeMoveForwardAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "MoveLeft", 59, executeMoveLeft, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "MoveLeftAndModifySelection", 60, executeMoveLeftAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "MovePageDown", 61, executeMovePageDown, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "MovePageDownAndModifySelection", 62, executeMovePageDownAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "MovePageUp", 63, executeMovePageUp, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "MovePageUpAndModifySelection", 64, executeMovePageUpAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "MoveParagraphBackward", 65, executeMoveParagraphBackward, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "MoveParagraphBackwardAndModifySelection", 66, executeMoveParagraphBackwardAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "MoveParagraphForward", 67, executeMoveParagraphForward, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "MoveParagraphForwardAndModifySelection", 68, executeMoveParagraphForwardAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "MoveRight", 69, executeMoveRight, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "MoveRightAndModifySelection", 70, executeMoveRightAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "MoveToBeginningOfDocument", 71, executeMoveToBeginningOfDocument, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "MoveToBeginningOfDocumentAndModifySelection", 72, executeMoveToBeginningOfDocumentAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "MoveToBeginningOfLine", 73, executeMoveToBeginningOfLine, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "MoveToBeginningOfLineAndModifySelection", 74, executeMoveToBeginningOfLineAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "MoveToBeginningOfParagraph", 75, executeMoveToBeginningOfParagraph, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "MoveToBeginningOfParagraphAndModifySelection", 76, executeMoveToBeginningOfParagraphAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "MoveToBeginningOfSentence", 77, executeMoveToBeginningOfSentence, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "MoveToBeginningOfSentenceAndModifySelection", 78, executeMoveToBeginningOfSentenceAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "MoveToEndOfDocument", 79, executeMoveToEndOfDocument, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "MoveToEndOfDocumentAndModifySelection", 80, executeMoveToEndOfDocumentAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "MoveToEndOfLine", 81, executeMoveToEndOfLine, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "MoveToEndOfLineAndModifySelection", 82, executeMoveToEndOfLineAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "MoveToEndOfParagraph", 83, executeMoveToEndOfParagraph, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "MoveToEndOfParagraphAndModifySelection", 84, executeMoveToEndOfParagraphAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "MoveToEndOfSentence", 85, executeMoveToEndOfSentence, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "MoveToEndOfSentenceAndModifySelection", 86, executeMoveToEndOfSentenceAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "MoveToLeftEndOfLine", 87, executeMoveToLeftEndOfLine, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "MoveToLeftEndOfLineAndModifySelection", 88, executeMoveToLeftEndOfLineAndModifySelection, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "MoveToRightEndOfLine", 89, executeMoveToRightEndOfLine, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "MoveToRightEndOfLineAndModifySelection", 90, executeMoveToRightEndOfLineAndModifySelection, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "MoveUp", 91, executeMoveUp, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "MoveUpAndModifySelection", 92, executeMoveUpAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "MoveWordBackward", 93, executeMoveWordBackward, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "MoveWordBackwardAndModifySelection", 94, executeMoveWordBackwardAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "MoveWordForward", 95, executeMoveWordForward, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "MoveWordForwardAndModifySelection", 96, executeMoveWordForwardAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "MoveWordLeft", 97, executeMoveWordLeft, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "MoveWordLeftAndModifySelection", 98, executeMoveWordLeftAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "MoveWordRight", 99, executeMoveWordRight, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "MoveWordRightAndModifySelection", 100, executeMoveWordRightAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "Outdent", 101, executeOutdent, supported, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "OverWrite", 102, executeToggleOverwrite, supportedFromMenuOrKeyBinding, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "Paste", 103, executePaste, supported, enabledPaste, stateNone, valueNull, notTextInsertion, shouldFireInputEvent, allowExecutionWhenDisabled },
+ { "PasteAndMatchStyle", 104, executePasteAndMatchStyle, supported, enabledPaste, stateNone, valueNull, notTextInsertion, shouldFireInputEvent, allowExecutionWhenDisabled },
+ { "PasteGlobalSelection", 105, executePasteGlobalSelection, supportedFromMenuOrKeyBinding, enabledPaste, stateNone, valueNull, notTextInsertion, shouldFireInputEvent, allowExecutionWhenDisabled },
+ { "Print", 106, executePrint, supported, enabled, stateNone, valueNull, notTextInsertion, doNotFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "Redo", 107, executeRedo, supported, enabledRedo, stateNone, valueNull, notTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "RemoveFormat", 108, executeRemoveFormat, supported, enabledRangeInEditableText, stateNone, valueNull, notTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "ScrollPageBackward", 109, executeScrollPageBackward, supportedFromMenuOrKeyBinding, enabled, stateNone, valueNull, notTextInsertion, doNotFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "ScrollPageForward", 110, executeScrollPageForward, supportedFromMenuOrKeyBinding, enabled, stateNone, valueNull, notTextInsertion, doNotFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "ScrollLineUp", 111, executeScrollLineUp, supportedFromMenuOrKeyBinding, enabled, stateNone, valueNull, notTextInsertion, doNotFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "ScrollLineDown", 112, executeScrollLineDown, supportedFromMenuOrKeyBinding, enabled, stateNone, valueNull, notTextInsertion, doNotFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "ScrollToBeginningOfDocument", 113, executeScrollToBeginningOfDocument, supportedFromMenuOrKeyBinding, enabled, stateNone, valueNull, notTextInsertion, doNotFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "ScrollToEndOfDocument", 114, executeScrollToEndOfDocument, supportedFromMenuOrKeyBinding, enabled, stateNone, valueNull, notTextInsertion, doNotFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "SelectAll", 115, executeSelectAll, supported, enabled, stateNone, valueNull, notTextInsertion, doNotFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "SelectLine", 116, executeSelectLine, supportedFromMenuOrKeyBinding, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "SelectParagraph", 117, executeSelectParagraph, supportedFromMenuOrKeyBinding, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "SelectSentence", 118, executeSelectSentence, supportedFromMenuOrKeyBinding, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "SelectToMark", 119, executeSelectToMark, supportedFromMenuOrKeyBinding, enabledVisibleSelectionAndMark, stateNone, valueNull, notTextInsertion, doNotFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "SelectWord", 120, executeSelectWord, supportedFromMenuOrKeyBinding, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "SetMark", 121, executeSetMark, supportedFromMenuOrKeyBinding, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "Strikethrough", 122, executeStrikethrough, supported, enabledInRichlyEditableText, stateStrikethrough, valueNull, notTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "StyleWithCSS", 123, executeStyleWithCSS, supported, enabled, stateStyleWithCSS, valueNull, notTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "Subscript", 124, executeSubscript, supported, enabledInRichlyEditableText, stateSubscript, valueNull, notTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "Superscript", 125, executeSuperscript, supported, enabledInRichlyEditableText, stateSuperscript, valueNull, notTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "SwapWithMark", 126, executeSwapWithMark, supportedFromMenuOrKeyBinding, enabledVisibleSelectionAndMark, stateNone, valueNull, notTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "ToggleBold", 127, executeToggleBold, supportedFromMenuOrKeyBinding, enabledInRichlyEditableText, stateBold, valueNull, notTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "ToggleItalic", 128, executeToggleItalic, supportedFromMenuOrKeyBinding, enabledInRichlyEditableText, stateItalic, valueNull, notTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "ToggleUnderline", 129, executeUnderline, supportedFromMenuOrKeyBinding, enabledInRichlyEditableText, stateUnderline, valueNull, notTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "Transpose", 130, executeTranspose, supported, enableCaretInEditableText, stateNone, valueNull, notTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "Underline", 131, executeUnderline, supported, enabledInRichlyEditableText, stateUnderline, valueNull, notTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "Undo", 132, executeUndo, supported, enabledUndo, stateNone, valueNull, notTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "Unlink", 133, executeUnlink, supported, enabledRangeInRichlyEditableText, stateNone, valueNull, notTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "Unscript", 134, executeUnscript, supportedFromMenuOrKeyBinding, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "Unselect", 135, executeUnselect, supported, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "UseCSS", 136, executeUseCSS, supported, enabled, stateNone, valueNull, notTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "Yank", 137, executeYank, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
+ { "YankAndSelect", 138, executeYankAndSelect, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, shouldFireInputEvent, doNotAllowExecutionWhenDisabled },
};
// These unsupported commands are listed here since they appear in the Microsoft
@@ -1681,12 +1681,12 @@ static const CommandMap& createCommandMap()
HashSet<int> idSet;
#endif
for (size_t i = 0; i < WTF_ARRAY_LENGTH(commands); ++i) {
- const CommandEntry& command = commands[i];
- ASSERT(!commandMap.get(command.name));
- commandMap.set(String(command.name), &command.command);
+ const EditorInternalCommand& command = commands[i];
+ ASSERT(!commandMap.get(command.commandName));
+ commandMap.set(String(command.commandName), &command);
#if ENABLE(ASSERT)
- ASSERT(!idSet.contains(command.command.idForUserMetrics));
- idSet.add(command.command.idForUserMetrics);
+ ASSERT(!idSet.contains(command.idForUserMetrics));
+ idSet.add(command.idForUserMetrics);
#endif
}
@@ -1779,6 +1779,16 @@ bool Editor::Command::execute(const String& parameter, Event* triggeringEvent) c
if (!isSupported() || !m_frame || !m_command->allowExecutionWhenDisabled)
return false;
}
+
+ if (m_command->shouldFireInputEvent) {
yosin_UTC9 2016/03/16 01:46:51 We should check this command is invoked by user ac
chongz 2016/03/16 21:51:44 Acknowledged.
chongz 2016/04/13 00:34:28 Done.
+ if (dispatchBeforeInputEditorCommand(eventTargetNodeForDocument(m_frame->document()), m_command->commandName) != DispatchEventResult::NotCanceled)
+ return true;
+ }
+
+ // 'beforeinput' event handler may destroy |frame()|.
+ if (!m_frame || !frame().document())
+ return false;
+
frame().document()->updateLayoutIgnorePendingStylesheets();
DEFINE_STATIC_LOCAL(SparseHistogram, commandHistogram, ("WebCore.Editing.Commands"));
commandHistogram.sample(m_command->idForUserMetrics);

Powered by Google App Engine
This is Rietveld 408576698