Chromium Code Reviews| 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 ede33f9f49e3b2e225b25d770ae9b9d2124324cc..e282b2f60b08943897b205838509c23bb351b460 100644 |
| --- a/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp |
| +++ b/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp |
| @@ -64,15 +64,191 @@ |
| #include "platform/UserGestureIndicator.h" |
| #include "platform/scroll/Scrollbar.h" |
| #include "public/platform/Platform.h" |
| +#include "public/platform/WebEditingCommandType.h" |
| +#include "wtf/StringExtras.h" |
| #include "wtf/text/AtomicString.h" |
| namespace blink { |
| using namespace HTMLNames; |
| +namespace { |
| + |
| +const struct CommandNameEntry { |
| + const char* name; |
| + WebEditingCommandType type; |
| +} kCommandNameEntries[] = { |
| + // Must be ordered by |name| (case-folding) for binary search. |
| + // Covered by unit tests in EditingCommandTest.cpp (not able to use static_assert) |
| + { "AlignCenter", WebEditingCommandType::AlignCenter }, |
| + { "AlignJustified", WebEditingCommandType::AlignJustified }, |
| + { "AlignLeft", WebEditingCommandType::AlignLeft }, |
| + { "AlignRight", WebEditingCommandType::AlignRight }, |
| + { "BackColor", WebEditingCommandType::BackColor }, |
| + { "BackwardDelete", WebEditingCommandType::BackwardDelete }, |
| + { "Bold", WebEditingCommandType::Bold }, |
| + { "Copy", WebEditingCommandType::Copy }, |
| + { "CreateLink", WebEditingCommandType::CreateLink }, |
| + { "Cut", WebEditingCommandType::Cut }, |
| + { "DefaultParagraphSeparator", WebEditingCommandType::DefaultParagraphSeparator }, |
| + { "Delete", WebEditingCommandType::Delete }, |
| + { "DeleteBackward", WebEditingCommandType::DeleteBackward }, |
| + { "DeleteBackwardByDecomposingPreviousCharacter", WebEditingCommandType::DeleteBackwardByDecomposingPreviousCharacter }, |
| + { "DeleteForward", WebEditingCommandType::DeleteForward }, |
| + { "DeleteToBeginningOfLine", WebEditingCommandType::DeleteToBeginningOfLine }, |
| + { "DeleteToBeginningOfParagraph", WebEditingCommandType::DeleteToBeginningOfParagraph }, |
| + { "DeleteToEndOfLine", WebEditingCommandType::DeleteToEndOfLine }, |
| + { "DeleteToEndOfParagraph", WebEditingCommandType::DeleteToEndOfParagraph }, |
| + { "DeleteToMark", WebEditingCommandType::DeleteToMark }, |
| + { "DeleteWordBackward", WebEditingCommandType::DeleteWordBackward }, |
| + { "DeleteWordForward", WebEditingCommandType::DeleteWordForward }, |
| + { "FindString", WebEditingCommandType::FindString }, |
| + { "FontName", WebEditingCommandType::FontName }, |
| + { "FontSize", WebEditingCommandType::FontSize }, |
| + { "FontSizeDelta", WebEditingCommandType::FontSizeDelta }, |
| + { "ForeColor", WebEditingCommandType::ForeColor }, |
| + { "FormatBlock", WebEditingCommandType::FormatBlock }, |
| + { "ForwardDelete", WebEditingCommandType::ForwardDelete }, |
| + { "HiliteColor", WebEditingCommandType::HiliteColor }, |
| + { "IgnoreSpelling", WebEditingCommandType::IgnoreSpelling }, |
| + { "Indent", WebEditingCommandType::Indent }, |
| + { "InsertBacktab", WebEditingCommandType::InsertBacktab }, |
| + { "InsertHorizontalRule", WebEditingCommandType::InsertHorizontalRule }, |
| + { "InsertHTML", WebEditingCommandType::InsertHTML }, |
| + { "InsertImage", WebEditingCommandType::InsertImage }, |
| + { "InsertLineBreak", WebEditingCommandType::InsertLineBreak }, |
| + { "InsertNewline", WebEditingCommandType::InsertNewline }, |
| + { "InsertNewlineInQuotedContent", WebEditingCommandType::InsertNewlineInQuotedContent }, |
| + { "InsertOrderedList", WebEditingCommandType::InsertOrderedList }, |
| + { "InsertParagraph", WebEditingCommandType::InsertParagraph }, |
| + { "InsertTab", WebEditingCommandType::InsertTab }, |
| + { "InsertText", WebEditingCommandType::InsertText }, |
| + { "InsertUnorderedList", WebEditingCommandType::InsertUnorderedList }, |
| + { "Italic", WebEditingCommandType::Italic }, |
| + { "JustifyCenter", WebEditingCommandType::JustifyCenter }, |
| + { "JustifyFull", WebEditingCommandType::JustifyFull }, |
| + { "JustifyLeft", WebEditingCommandType::JustifyLeft }, |
| + { "JustifyNone", WebEditingCommandType::JustifyNone }, |
| + { "JustifyRight", WebEditingCommandType::JustifyRight }, |
| + { "MakeTextWritingDirectionLeftToRight", WebEditingCommandType::MakeTextWritingDirectionLeftToRight }, |
| + { "MakeTextWritingDirectionNatural", WebEditingCommandType::MakeTextWritingDirectionNatural }, |
| + { "MakeTextWritingDirectionRightToLeft", WebEditingCommandType::MakeTextWritingDirectionRightToLeft }, |
| + { "MoveBackward", WebEditingCommandType::MoveBackward }, |
| + { "MoveBackwardAndModifySelection", WebEditingCommandType::MoveBackwardAndModifySelection }, |
| + { "MoveDown", WebEditingCommandType::MoveDown }, |
| + { "MoveDownAndModifySelection", WebEditingCommandType::MoveDownAndModifySelection }, |
| + { "MoveForward", WebEditingCommandType::MoveForward }, |
| + { "MoveForwardAndModifySelection", WebEditingCommandType::MoveForwardAndModifySelection }, |
| + { "MoveLeft", WebEditingCommandType::MoveLeft }, |
| + { "MoveLeftAndModifySelection", WebEditingCommandType::MoveLeftAndModifySelection }, |
| + { "MovePageDown", WebEditingCommandType::MovePageDown }, |
| + { "MovePageDownAndModifySelection", WebEditingCommandType::MovePageDownAndModifySelection }, |
| + { "MovePageUp", WebEditingCommandType::MovePageUp }, |
| + { "MovePageUpAndModifySelection", WebEditingCommandType::MovePageUpAndModifySelection }, |
| + { "MoveParagraphBackward", WebEditingCommandType::MoveParagraphBackward }, |
| + { "MoveParagraphBackwardAndModifySelection", WebEditingCommandType::MoveParagraphBackwardAndModifySelection }, |
| + { "MoveParagraphForward", WebEditingCommandType::MoveParagraphForward }, |
| + { "MoveParagraphForwardAndModifySelection", WebEditingCommandType::MoveParagraphForwardAndModifySelection }, |
| + { "MoveRight", WebEditingCommandType::MoveRight }, |
| + { "MoveRightAndModifySelection", WebEditingCommandType::MoveRightAndModifySelection }, |
| + { "MoveToBeginningOfDocument", WebEditingCommandType::MoveToBeginningOfDocument }, |
| + { "MoveToBeginningOfDocumentAndModifySelection", WebEditingCommandType::MoveToBeginningOfDocumentAndModifySelection }, |
| + { "MoveToBeginningOfLine", WebEditingCommandType::MoveToBeginningOfLine }, |
| + { "MoveToBeginningOfLineAndModifySelection", WebEditingCommandType::MoveToBeginningOfLineAndModifySelection }, |
| + { "MoveToBeginningOfParagraph", WebEditingCommandType::MoveToBeginningOfParagraph }, |
| + { "MoveToBeginningOfParagraphAndModifySelection", WebEditingCommandType::MoveToBeginningOfParagraphAndModifySelection }, |
| + { "MoveToBeginningOfSentence", WebEditingCommandType::MoveToBeginningOfSentence }, |
| + { "MoveToBeginningOfSentenceAndModifySelection", WebEditingCommandType::MoveToBeginningOfSentenceAndModifySelection }, |
| + { "MoveToEndOfDocument", WebEditingCommandType::MoveToEndOfDocument }, |
| + { "MoveToEndOfDocumentAndModifySelection", WebEditingCommandType::MoveToEndOfDocumentAndModifySelection }, |
| + { "MoveToEndOfLine", WebEditingCommandType::MoveToEndOfLine }, |
| + { "MoveToEndOfLineAndModifySelection", WebEditingCommandType::MoveToEndOfLineAndModifySelection }, |
| + { "MoveToEndOfParagraph", WebEditingCommandType::MoveToEndOfParagraph }, |
| + { "MoveToEndOfParagraphAndModifySelection", WebEditingCommandType::MoveToEndOfParagraphAndModifySelection }, |
| + { "MoveToEndOfSentence", WebEditingCommandType::MoveToEndOfSentence }, |
| + { "MoveToEndOfSentenceAndModifySelection", WebEditingCommandType::MoveToEndOfSentenceAndModifySelection }, |
| + { "MoveToLeftEndOfLine", WebEditingCommandType::MoveToLeftEndOfLine }, |
| + { "MoveToLeftEndOfLineAndModifySelection", WebEditingCommandType::MoveToLeftEndOfLineAndModifySelection }, |
| + { "MoveToRightEndOfLine", WebEditingCommandType::MoveToRightEndOfLine }, |
| + { "MoveToRightEndOfLineAndModifySelection", WebEditingCommandType::MoveToRightEndOfLineAndModifySelection }, |
| + { "MoveUp", WebEditingCommandType::MoveUp }, |
| + { "MoveUpAndModifySelection", WebEditingCommandType::MoveUpAndModifySelection }, |
| + { "MoveWordBackward", WebEditingCommandType::MoveWordBackward }, |
| + { "MoveWordBackwardAndModifySelection", WebEditingCommandType::MoveWordBackwardAndModifySelection }, |
| + { "MoveWordForward", WebEditingCommandType::MoveWordForward }, |
| + { "MoveWordForwardAndModifySelection", WebEditingCommandType::MoveWordForwardAndModifySelection }, |
| + { "MoveWordLeft", WebEditingCommandType::MoveWordLeft }, |
| + { "MoveWordLeftAndModifySelection", WebEditingCommandType::MoveWordLeftAndModifySelection }, |
| + { "MoveWordRight", WebEditingCommandType::MoveWordRight }, |
| + { "MoveWordRightAndModifySelection", WebEditingCommandType::MoveWordRightAndModifySelection }, |
| + { "Outdent", WebEditingCommandType::Outdent }, |
| + { "OverWrite", WebEditingCommandType::OverWrite }, |
| + { "Paste", WebEditingCommandType::Paste }, |
| + { "PasteAndMatchStyle", WebEditingCommandType::PasteAndMatchStyle }, |
| + { "PasteGlobalSelection", WebEditingCommandType::PasteGlobalSelection }, |
| + { "Print", WebEditingCommandType::Print }, |
| + { "Redo", WebEditingCommandType::Redo }, |
| + { "RemoveFormat", WebEditingCommandType::RemoveFormat }, |
| + { "ScrollLineDown", WebEditingCommandType::ScrollLineDown }, |
| + { "ScrollLineUp", WebEditingCommandType::ScrollLineUp }, |
| + { "ScrollPageBackward", WebEditingCommandType::ScrollPageBackward }, |
| + { "ScrollPageForward", WebEditingCommandType::ScrollPageForward }, |
| + { "ScrollToBeginningOfDocument", WebEditingCommandType::ScrollToBeginningOfDocument }, |
| + { "ScrollToEndOfDocument", WebEditingCommandType::ScrollToEndOfDocument }, |
| + { "SelectAll", WebEditingCommandType::SelectAll }, |
| + { "SelectLine", WebEditingCommandType::SelectLine }, |
| + { "SelectParagraph", WebEditingCommandType::SelectParagraph }, |
| + { "SelectSentence", WebEditingCommandType::SelectSentence }, |
| + { "SelectToMark", WebEditingCommandType::SelectToMark }, |
| + { "SelectWord", WebEditingCommandType::SelectWord }, |
| + { "SetMark", WebEditingCommandType::SetMark }, |
| + { "Strikethrough", WebEditingCommandType::Strikethrough }, |
| + { "StyleWithCSS", WebEditingCommandType::StyleWithCSS }, |
| + { "Subscript", WebEditingCommandType::Subscript }, |
| + { "Superscript", WebEditingCommandType::Superscript }, |
| + { "SwapWithMark", WebEditingCommandType::SwapWithMark }, |
| + { "ToggleBold", WebEditingCommandType::ToggleBold }, |
| + { "ToggleItalic", WebEditingCommandType::ToggleItalic }, |
| + { "ToggleUnderline", WebEditingCommandType::ToggleUnderline }, |
| + { "Transpose", WebEditingCommandType::Transpose }, |
| + { "Underline", WebEditingCommandType::Underline }, |
| + { "Undo", WebEditingCommandType::Undo }, |
| + { "Unlink", WebEditingCommandType::Unlink }, |
| + { "Unscript", WebEditingCommandType::Unscript }, |
| + { "Unselect", WebEditingCommandType::Unselect }, |
| + { "UseCSS", WebEditingCommandType::UseCSS }, |
| + { "Yank", WebEditingCommandType::Yank }, |
| + { "YankAndSelect", WebEditingCommandType::YankAndSelect }, |
| +}; |
| + |
| +// Handles all commands except WebEditingCommandType::Invalid. |
| +static_assert(arraysize(kCommandNameEntries) + 1 == static_cast<int>(WebEditingCommandType::NumberOfCommandTypes), |
| + "must handle all valid WebEditingCommandType"); |
| + |
| +int CommandNameEntryCmp(const void* entry1, const void* entry2) |
| +{ |
| + return strcasecmp( |
| + reinterpret_cast<const CommandNameEntry*>(entry1)->name, |
| + reinterpret_cast<const CommandNameEntry*>(entry2)->name); |
| +} |
| + |
| +WebEditingCommandType WebEditingCommandTypeFromCommandName(const String& commandName) |
| +{ |
| + CString latin1String = commandName.latin1(); |
| + CommandNameEntry keyEntry = { latin1String.data(), WebEditingCommandType::Invalid }; |
| + CommandNameEntry* entry = reinterpret_cast<CommandNameEntry*>( |
| + bsearch(&keyEntry, kCommandNameEntries, arraysize(kCommandNameEntries), |
| + sizeof(CommandNameEntry), CommandNameEntryCmp)); |
| + if (entry) |
| + return entry->type; |
| + return WebEditingCommandType::Invalid; |
| +} |
| + |
| +} // anonymous namespace |
| + |
| class EditorInternalCommand { |
| public: |
| - int idForUserMetrics; |
| + WebEditingCommandType commandType; |
| bool (*execute)(LocalFrame&, Event*, EditorCommandSource, const String&); |
| bool (*isSupportedFromDOM)(LocalFrame*); |
| bool (*isEnabled)(LocalFrame&, Event*, EditorCommandSource); |
| @@ -84,8 +260,6 @@ public: |
| bool allowExecutionWhenDisabled; |
| }; |
| -typedef HashMap<String, const EditorInternalCommand*, CaseFoldingHash> CommandMap; |
| - |
| static const bool notTextInsertion = false; |
| static const bool isTextInsertion = true; |
| @@ -1479,224 +1653,164 @@ 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, enabledInRichlyEditableText, stateNone, valueFontName, notTextInsertion, doNotAllowExecutionWhenDisabled } }, |
| - { "FontSize", {24, executeFontSize, supported, enabledInRichlyEditableText, stateNone, valueFontSize, notTextInsertion, doNotAllowExecutionWhenDisabled } }, |
| - { "FontSizeDelta", {25, executeFontSizeDelta, supported, enabledInRichlyEditableText, 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* internalCommand(const String& commandName) |
| +{ |
| + static const EditorInternalCommand kEditorCommands[] = { |
| + // Lists all commands in blink::WebEditingCommandType. |
| + // Must be ordered by |commandType| for index lookup. |
| + // Covered by unit tests in EditingCommandTest.cpp |
| + { WebEditingCommandType::AlignJustified /* 1 */, executeJustifyFull, supportedFromMenuOrKeyBinding, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::AlignLeft /* 2 */, executeJustifyLeft, supportedFromMenuOrKeyBinding, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
|
dtapuska
2016/03/29 18:47:50
I'm not sure you need the /* 1 */ etc...
|
| + { WebEditingCommandType::AlignRight /* 3 */, executeJustifyRight, supportedFromMenuOrKeyBinding, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::BackColor /* 4 */, executeBackColor, supported, enabledInRichlyEditableText, stateNone, valueBackColor, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::BackwardDelete /* 5 */, executeDeleteBackward, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, // FIXME: remove BackwardDelete when Safari for Windows stops using it. |
| + { WebEditingCommandType::Bold /* 6 */, executeToggleBold, supported, enabledInRichlyEditableText, stateBold, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::Copy /* 7 */, executeCopy, supported, enabledCopy, stateNone, valueNull, notTextInsertion, allowExecutionWhenDisabled }, |
| + { WebEditingCommandType::CreateLink /* 8 */, executeCreateLink, supported, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::Cut /* 9 */, executeCut, supported, enabledCut, stateNone, valueNull, notTextInsertion, allowExecutionWhenDisabled }, |
| + { WebEditingCommandType::DefaultParagraphSeparator /* 10 */, executeDefaultParagraphSeparator, supported, enabled, stateNone, valueDefaultParagraphSeparator, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::Delete /* 11 */, executeDelete, supported, enabledDelete, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::DeleteBackward /* 12 */, executeDeleteBackward, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::DeleteBackwardByDecomposingPreviousCharacter /* 13 */, executeDeleteBackwardByDecomposingPreviousCharacter, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::DeleteForward /* 14 */, executeDeleteForward, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::DeleteToBeginningOfLine /* 15 */, executeDeleteToBeginningOfLine, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::DeleteToBeginningOfParagraph /* 16 */, executeDeleteToBeginningOfParagraph, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::DeleteToEndOfLine /* 17 */, executeDeleteToEndOfLine, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::DeleteToEndOfParagraph /* 18 */, executeDeleteToEndOfParagraph, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::DeleteToMark /* 19 */, executeDeleteToMark, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::DeleteWordBackward /* 20 */, executeDeleteWordBackward, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::DeleteWordForward /* 21 */, executeDeleteWordForward, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::FindString /* 22 */, executeFindString, supported, enabled, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::FontName /* 23 */, executeFontName, supported, enabledInRichlyEditableText, stateNone, valueFontName, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::FontSize /* 24 */, executeFontSize, supported, enabledInRichlyEditableText, stateNone, valueFontSize, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::FontSizeDelta /* 25 */, executeFontSizeDelta, supported, enabledInRichlyEditableText, stateNone, valueFontSizeDelta, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::ForeColor /* 26 */, executeForeColor, supported, enabledInRichlyEditableText, stateNone, valueForeColor, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::FormatBlock /* 27 */, executeFormatBlock, supported, enabledInRichlyEditableText, stateNone, valueFormatBlock, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::ForwardDelete /* 28 */, executeForwardDelete, supported, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::HiliteColor /* 29 */, executeBackColor, supported, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::IgnoreSpelling /* 30 */, executeIgnoreSpelling, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::Indent /* 31 */, executeIndent, supported, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::InsertBacktab /* 32 */, executeInsertBacktab, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, isTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::InsertHTML /* 33 */, executeInsertHTML, supported, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::InsertHorizontalRule /* 34 */, executeInsertHorizontalRule, supported, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::InsertImage /* 35 */, executeInsertImage, supported, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::InsertLineBreak /* 36 */, executeInsertLineBreak, supported, enabledInEditableText, stateNone, valueNull, isTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::InsertNewline /* 37 */, executeInsertNewline, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, isTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::InsertNewlineInQuotedContent /* 38 */, executeInsertNewlineInQuotedContent, supported, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::InsertOrderedList /* 39 */, executeInsertOrderedList, supported, enabledInRichlyEditableText, stateOrderedList, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::InsertParagraph /* 40 */, executeInsertParagraph, supported, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::InsertTab /* 41 */, executeInsertTab, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, isTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::InsertText /* 42 */, executeInsertText, supported, enabledInEditableText, stateNone, valueNull, isTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::InsertUnorderedList /* 43 */, executeInsertUnorderedList, supported, enabledInRichlyEditableText, stateUnorderedList, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::Italic /* 44 */, executeToggleItalic, supported, enabledInRichlyEditableText, stateItalic, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::JustifyCenter /* 45 */, executeJustifyCenter, supported, enabledInRichlyEditableText, stateJustifyCenter, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::JustifyFull /* 46 */, executeJustifyFull, supported, enabledInRichlyEditableText, stateJustifyFull, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::JustifyLeft /* 47 */, executeJustifyLeft, supported, enabledInRichlyEditableText, stateJustifyLeft, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::JustifyNone /* 48 */, executeJustifyLeft, supported, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::JustifyRight /* 49 */, executeJustifyRight, supported, enabledInRichlyEditableText, stateJustifyRight, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::MakeTextWritingDirectionLeftToRight /* 50 */, executeMakeTextWritingDirectionLeftToRight, supportedFromMenuOrKeyBinding, enabledInRichlyEditableText, stateTextWritingDirectionLeftToRight, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::MakeTextWritingDirectionNatural /* 51 */, executeMakeTextWritingDirectionNatural, supportedFromMenuOrKeyBinding, enabledInRichlyEditableText, stateTextWritingDirectionNatural, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::MakeTextWritingDirectionRightToLeft /* 52 */, executeMakeTextWritingDirectionRightToLeft, supportedFromMenuOrKeyBinding, enabledInRichlyEditableText, stateTextWritingDirectionRightToLeft, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::MoveBackward /* 53 */, executeMoveBackward, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::MoveBackwardAndModifySelection /* 54 */, executeMoveBackwardAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::MoveDown /* 55 */, executeMoveDown, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::MoveDownAndModifySelection /* 56 */, executeMoveDownAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::MoveForward /* 57 */, executeMoveForward, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::MoveForwardAndModifySelection /* 58 */, executeMoveForwardAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::MoveLeft /* 59 */, executeMoveLeft, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::MoveLeftAndModifySelection /* 60 */, executeMoveLeftAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::MovePageDown /* 61 */, executeMovePageDown, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::MovePageDownAndModifySelection /* 62 */, executeMovePageDownAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::MovePageUp /* 63 */, executeMovePageUp, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::MovePageUpAndModifySelection /* 64 */, executeMovePageUpAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::MoveParagraphBackward /* 65 */, executeMoveParagraphBackward, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::MoveParagraphBackwardAndModifySelection /* 66 */, executeMoveParagraphBackwardAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::MoveParagraphForward /* 67 */, executeMoveParagraphForward, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::MoveParagraphForwardAndModifySelection /* 68 */, executeMoveParagraphForwardAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::MoveRight /* 69 */, executeMoveRight, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::MoveRightAndModifySelection /* 70 */, executeMoveRightAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::MoveToBeginningOfDocument /* 71 */, executeMoveToBeginningOfDocument, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::MoveToBeginningOfDocumentAndModifySelection /* 72 */, executeMoveToBeginningOfDocumentAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::MoveToBeginningOfLine /* 73 */, executeMoveToBeginningOfLine, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::MoveToBeginningOfLineAndModifySelection /* 74 */, executeMoveToBeginningOfLineAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::MoveToBeginningOfParagraph /* 75 */, executeMoveToBeginningOfParagraph, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::MoveToBeginningOfParagraphAndModifySelection /* 76 */, executeMoveToBeginningOfParagraphAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::MoveToBeginningOfSentence /* 77 */, executeMoveToBeginningOfSentence, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::MoveToBeginningOfSentenceAndModifySelection /* 78 */, executeMoveToBeginningOfSentenceAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::MoveToEndOfDocument /* 79 */, executeMoveToEndOfDocument, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::MoveToEndOfDocumentAndModifySelection /* 80 */, executeMoveToEndOfDocumentAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::MoveToEndOfLine /* 81 */, executeMoveToEndOfLine, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::MoveToEndOfLineAndModifySelection /* 82 */, executeMoveToEndOfLineAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::MoveToEndOfParagraph /* 83 */, executeMoveToEndOfParagraph, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::MoveToEndOfParagraphAndModifySelection /* 84 */, executeMoveToEndOfParagraphAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::MoveToEndOfSentence /* 85 */, executeMoveToEndOfSentence, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::MoveToEndOfSentenceAndModifySelection /* 86 */, executeMoveToEndOfSentenceAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::MoveToLeftEndOfLine /* 87 */, executeMoveToLeftEndOfLine, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::MoveToLeftEndOfLineAndModifySelection /* 88 */, executeMoveToLeftEndOfLineAndModifySelection, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::MoveToRightEndOfLine /* 89 */, executeMoveToRightEndOfLine, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::MoveToRightEndOfLineAndModifySelection /* 90 */, executeMoveToRightEndOfLineAndModifySelection, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::MoveUp /* 91 */, executeMoveUp, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::MoveUpAndModifySelection /* 92 */, executeMoveUpAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::MoveWordBackward /* 93 */, executeMoveWordBackward, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::MoveWordBackwardAndModifySelection /* 94 */, executeMoveWordBackwardAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::MoveWordForward /* 95 */, executeMoveWordForward, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::MoveWordForwardAndModifySelection /* 96 */, executeMoveWordForwardAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::MoveWordLeft /* 97 */, executeMoveWordLeft, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::MoveWordLeftAndModifySelection /* 98 */, executeMoveWordLeftAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::MoveWordRight /* 99 */, executeMoveWordRight, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::MoveWordRightAndModifySelection /* 100 */, executeMoveWordRightAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::Outdent /* 101 */, executeOutdent, supported, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::OverWrite /* 102 */, executeToggleOverwrite, supportedFromMenuOrKeyBinding, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::Paste /* 103 */, executePaste, supported, enabledPaste, stateNone, valueNull, notTextInsertion, allowExecutionWhenDisabled }, |
| + { WebEditingCommandType::PasteAndMatchStyle /* 104 */, executePasteAndMatchStyle, supported, enabledPaste, stateNone, valueNull, notTextInsertion, allowExecutionWhenDisabled }, |
| + { WebEditingCommandType::PasteGlobalSelection /* 105 */, executePasteGlobalSelection, supportedFromMenuOrKeyBinding, enabledPaste, stateNone, valueNull, notTextInsertion, allowExecutionWhenDisabled }, |
| + { WebEditingCommandType::Print /* 106 */, executePrint, supported, enabled, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::Redo /* 107 */, executeRedo, supported, enabledRedo, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::RemoveFormat /* 108 */, executeRemoveFormat, supported, enabledRangeInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::ScrollPageBackward /* 109 */, executeScrollPageBackward, supportedFromMenuOrKeyBinding, enabled, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::ScrollPageForward /* 110 */, executeScrollPageForward, supportedFromMenuOrKeyBinding, enabled, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::ScrollLineUp /* 111 */, executeScrollLineUp, supportedFromMenuOrKeyBinding, enabled, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::ScrollLineDown /* 112 */, executeScrollLineDown, supportedFromMenuOrKeyBinding, enabled, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::ScrollToBeginningOfDocument /* 113 */, executeScrollToBeginningOfDocument, supportedFromMenuOrKeyBinding, enabled, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::ScrollToEndOfDocument /* 114 */, executeScrollToEndOfDocument, supportedFromMenuOrKeyBinding, enabled, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::SelectAll /* 115 */, executeSelectAll, supported, enabled, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::SelectLine /* 116 */, executeSelectLine, supportedFromMenuOrKeyBinding, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::SelectParagraph /* 117 */, executeSelectParagraph, supportedFromMenuOrKeyBinding, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::SelectSentence /* 118 */, executeSelectSentence, supportedFromMenuOrKeyBinding, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::SelectToMark /* 119 */, executeSelectToMark, supportedFromMenuOrKeyBinding, enabledVisibleSelectionAndMark, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::SelectWord /* 120 */, executeSelectWord, supportedFromMenuOrKeyBinding, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::SetMark /* 121 */, executeSetMark, supportedFromMenuOrKeyBinding, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::Strikethrough /* 122 */, executeStrikethrough, supported, enabledInRichlyEditableText, stateStrikethrough, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::StyleWithCSS /* 123 */, executeStyleWithCSS, supported, enabled, stateStyleWithCSS, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::Subscript /* 124 */, executeSubscript, supported, enabledInRichlyEditableText, stateSubscript, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::Superscript /* 125 */, executeSuperscript, supported, enabledInRichlyEditableText, stateSuperscript, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::SwapWithMark /* 126 */, executeSwapWithMark, supportedFromMenuOrKeyBinding, enabledVisibleSelectionAndMark, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::ToggleBold /* 127 */, executeToggleBold, supportedFromMenuOrKeyBinding, enabledInRichlyEditableText, stateBold, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::ToggleItalic /* 128 */, executeToggleItalic, supportedFromMenuOrKeyBinding, enabledInRichlyEditableText, stateItalic, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::ToggleUnderline /* 129 */, executeUnderline, supportedFromMenuOrKeyBinding, enabledInRichlyEditableText, stateUnderline, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::Transpose /* 130 */, executeTranspose, supported, enableCaretInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::Underline /* 131 */, executeUnderline, supported, enabledInRichlyEditableText, stateUnderline, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::Undo /* 132 */, executeUndo, supported, enabledUndo, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::Unlink /* 133 */, executeUnlink, supported, enabledRangeInRichlyEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::Unscript /* 134 */, executeUnscript, supportedFromMenuOrKeyBinding, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::Unselect /* 135 */, executeUnselect, supported, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::UseCSS /* 136 */, executeUseCSS, supported, enabled, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::Yank /* 137 */, executeYank, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::YankAndSelect /* 138 */, executeYankAndSelect, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| + { WebEditingCommandType::AlignCenter /* 139 */, executeJustifyCenter, supportedFromMenuOrKeyBinding, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled }, |
| }; |
| + // Handles all commands except WebEditingCommandType::Invalid. |
| + static_assert(arraysize(kEditorCommands) + 1 == static_cast<int>(WebEditingCommandType::NumberOfCommandTypes), "must handle all valid WebEditingCommandType"); |
| - // These unsupported commands are listed here since they appear in the Microsoft |
| - // documentation used as the starting point for our DOM executeCommand support. |
| - // |
| - // 2D-Position (not supported) |
| - // AbsolutePosition (not supported) |
| - // BlockDirLTR (not supported) |
| - // BlockDirRTL (not supported) |
| - // BrowseMode (not supported) |
| - // ClearAuthenticationCache (not supported) |
| - // CreateBookmark (not supported) |
| - // DirLTR (not supported) |
| - // DirRTL (not supported) |
| - // EditMode (not supported) |
| - // InlineDirLTR (not supported) |
| - // InlineDirRTL (not supported) |
| - // InsertButton (not supported) |
| - // InsertFieldSet (not supported) |
| - // InsertIFrame (not supported) |
| - // InsertInputButton (not supported) |
| - // InsertInputCheckbox (not supported) |
| - // InsertInputFileUpload (not supported) |
| - // InsertInputHidden (not supported) |
| - // InsertInputImage (not supported) |
| - // InsertInputPassword (not supported) |
| - // InsertInputRadio (not supported) |
| - // InsertInputReset (not supported) |
| - // InsertInputSubmit (not supported) |
| - // InsertInputText (not supported) |
| - // InsertMarquee (not supported) |
| - // InsertSelectDropDown (not supported) |
| - // InsertSelectListBox (not supported) |
| - // InsertTextArea (not supported) |
| - // LiveResize (not supported) |
| - // MultipleSelection (not supported) |
| - // Open (not supported) |
| - // PlayImage (not supported) |
| - // Refresh (not supported) |
| - // RemoveParaFormat (not supported) |
| - // SaveAs (not supported) |
| - // SizeToControl (not supported) |
| - // SizeToControlHeight (not supported) |
| - // SizeToControlWidth (not supported) |
| - // Stop (not supported) |
| - // StopImage (not supported) |
| - // Unbookmark (not supported) |
| - |
| - CommandMap& commandMap = *new CommandMap; |
| -#if ENABLE(ASSERT) |
| - 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); |
| + WebEditingCommandType commandType = WebEditingCommandTypeFromCommandName(commandName); |
| + if (commandType == WebEditingCommandType::Invalid) |
| + return nullptr; |
| + |
| + int commandIndex = static_cast<int>(commandType) - 1; |
| #if ENABLE(ASSERT) |
| - ASSERT(!idSet.contains(command.command.idForUserMetrics)); |
| - idSet.add(command.command.idForUserMetrics); |
| + ASSERT(commandIndex >= 0 && commandIndex < static_cast<int>(arraysize(kEditorCommands))); |
| #endif |
| - } |
| - |
| - return commandMap; |
| -} |
| - |
| -static const EditorInternalCommand* internalCommand(const String& commandName) |
| -{ |
| - static const CommandMap& commandMap = createCommandMap(); |
| - return commandName.isEmpty() ? 0 : commandMap.get(commandName); |
| + return &kEditorCommands[commandIndex]; |
| } |
| Editor::Command Editor::createCommand(const String& commandName) |
| @@ -1781,7 +1895,7 @@ bool Editor::Command::execute(const String& parameter, Event* triggeringEvent) c |
| } |
| frame().document()->updateLayoutIgnorePendingStylesheets(); |
| DEFINE_STATIC_LOCAL(SparseHistogram, commandHistogram, ("WebCore.Editing.Commands")); |
| - commandHistogram.sample(m_command->idForUserMetrics); |
| + commandHistogram.sample(static_cast<int>(m_command->commandType)); |
| return m_command->execute(*m_frame, triggeringEvent, m_source, parameter); |
| } |
| @@ -1834,7 +1948,7 @@ bool Editor::Command::isTextInsertion() const |
| int Editor::Command::idForHistogram() const |
| { |
| - return isSupported() ? m_command->idForUserMetrics : 0; |
| + return isSupported() ? static_cast<int>(m_command->commandType) : 0; |
| } |
| } // namespace blink |