2018-01-12 13:01:04 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#ifndef mozilla_EditAction_h
|
|
|
|
#define mozilla_EditAction_h
|
|
|
|
|
2019-01-07 13:10:57 +03:00
|
|
|
#include "mozilla/EventForwards.h"
|
2019-07-26 04:10:23 +03:00
|
|
|
#include "mozilla/StaticPrefs_dom.h"
|
2019-01-07 13:10:57 +03:00
|
|
|
|
2018-01-12 13:01:04 +03:00
|
|
|
namespace mozilla {
|
|
|
|
|
2018-10-30 12:56:41 +03:00
|
|
|
/**
|
|
|
|
* EditAction indicates which operation or command causes running the methods
|
|
|
|
* of editors.
|
|
|
|
*/
|
|
|
|
enum class EditAction {
|
|
|
|
// eNone indicates no edit action is being handled.
|
|
|
|
eNone,
|
|
|
|
|
|
|
|
// eNotEditing indicates that something is retrieved or initializing
|
|
|
|
// something at creating, destroying or focus move etc, i.e., not edit
|
|
|
|
// action is being handled but editor is doing something.
|
|
|
|
eNotEditing,
|
2018-10-30 12:57:52 +03:00
|
|
|
|
2018-10-30 12:59:33 +03:00
|
|
|
// eInsertText indicates to insert some characters.
|
|
|
|
eInsertText,
|
|
|
|
|
|
|
|
// eInsertParagraphSeparator indicates to insert a paragraph separator such
|
2018-11-03 14:22:13 +03:00
|
|
|
// as <p>, <div>.
|
2018-10-30 12:59:33 +03:00
|
|
|
eInsertParagraphSeparator,
|
|
|
|
|
2018-11-03 14:22:13 +03:00
|
|
|
// eInsertLineBreak indicates to insert \n into TextEditor or a <br> element
|
|
|
|
// in HTMLEditor.
|
2018-10-30 13:00:17 +03:00
|
|
|
eInsertLineBreak,
|
|
|
|
|
2018-10-30 12:59:33 +03:00
|
|
|
// eDeleteSelection indicates to delete selected content or content around
|
|
|
|
// caret if selection is collapsed.
|
|
|
|
eDeleteSelection,
|
|
|
|
|
|
|
|
// eDeleteBackward indicates to remove previous character element of caret.
|
|
|
|
// This may be set even when Selection is not collapsed.
|
|
|
|
eDeleteBackward,
|
|
|
|
|
|
|
|
// eDeleteForward indicates to remove next character or element of caret.
|
|
|
|
// This may be set even when Selection is not collapsed.
|
|
|
|
eDeleteForward,
|
|
|
|
|
|
|
|
// eDeleteWordBackward indicates to remove previous word. If caret is in
|
|
|
|
// a word, remove characters between word start and caret.
|
|
|
|
// This may be set even when Selection is not collapsed.
|
|
|
|
eDeleteWordBackward,
|
|
|
|
|
|
|
|
// eDeleteWordForward indicates to remove next word. If caret is in a
|
|
|
|
// word, remove characters between caret and word end.
|
|
|
|
// This may be set even when Selection is not collapsed.
|
|
|
|
eDeleteWordForward,
|
|
|
|
|
|
|
|
// eDeleteToBeginningOfSoftLine indicates to remove characters between
|
|
|
|
// caret and previous visual line break.
|
|
|
|
// This may be set even when Selection is not collapsed.
|
|
|
|
eDeleteToBeginningOfSoftLine,
|
|
|
|
|
|
|
|
// eDeleteToEndOfSoftLine indicates to remove characters between caret and
|
|
|
|
// next visual line break.
|
|
|
|
// This may be set even when Selection is not collapsed.
|
|
|
|
eDeleteToEndOfSoftLine,
|
|
|
|
|
2019-01-07 13:10:57 +03:00
|
|
|
// eDeleteByDrag indicates to remove selection by dragging the content
|
|
|
|
// to different place.
|
|
|
|
eDeleteByDrag,
|
|
|
|
|
2018-10-30 12:59:33 +03:00
|
|
|
// eStartComposition indicates that user starts composition.
|
|
|
|
eStartComposition,
|
|
|
|
|
|
|
|
// eUpdateComposition indicates that user updates composition with
|
2018-11-01 11:07:04 +03:00
|
|
|
// new non-empty composition string and IME selections.
|
2018-10-30 12:59:33 +03:00
|
|
|
eUpdateComposition,
|
|
|
|
|
|
|
|
// eCommitComposition indicates that user commits composition.
|
|
|
|
eCommitComposition,
|
|
|
|
|
2018-11-01 11:07:04 +03:00
|
|
|
// eCancelComposition indicates that user cancels composition.
|
|
|
|
eCancelComposition,
|
|
|
|
|
|
|
|
// eDeleteByComposition indicates that user starts composition with
|
|
|
|
// empty string and there was selected content.
|
|
|
|
eDeleteByComposition,
|
2018-10-30 12:59:33 +03:00
|
|
|
|
|
|
|
// eUndo/eRedo indicate to undo/redo a transaction.
|
|
|
|
eUndo,
|
|
|
|
eRedo,
|
|
|
|
|
2018-10-30 12:57:52 +03:00
|
|
|
// eSetTextDirection indicates that setting text direction (LTR or RTL).
|
|
|
|
eSetTextDirection,
|
|
|
|
|
2018-10-30 12:59:33 +03:00
|
|
|
// eCut indicates to delete selected content and copy it to the clipboard.
|
|
|
|
eCut,
|
|
|
|
|
|
|
|
// eCopy indicates to copy selected content to the clipboard.
|
|
|
|
eCopy,
|
|
|
|
|
|
|
|
// ePaste indicates to paste clipboard data.
|
|
|
|
ePaste,
|
|
|
|
|
2019-03-05 17:35:43 +03:00
|
|
|
// ePasteAsQuotation indicates to paste clipboard data as quotation.
|
|
|
|
ePasteAsQuotation,
|
|
|
|
|
2018-10-30 12:59:33 +03:00
|
|
|
// eDrop indicates that user drops dragging item into the editor.
|
|
|
|
eDrop,
|
|
|
|
|
2018-10-30 13:00:17 +03:00
|
|
|
// eIndent indicates that to indent selected line(s).
|
|
|
|
eIndent,
|
|
|
|
|
|
|
|
// eOutdent indicates that to outdent selected line(s).
|
|
|
|
eOutdent,
|
|
|
|
|
2018-10-30 12:59:33 +03:00
|
|
|
// eReplaceText indicates to replace a part of range in editor with
|
|
|
|
// specific text. For example, user select a correct word in suggestions
|
|
|
|
// of spellchecker or a suggestion in list of autocomplete.
|
|
|
|
eReplaceText,
|
|
|
|
|
2018-10-30 13:00:17 +03:00
|
|
|
// eInsertTableRowElement indicates to insert table rows (i.e., <tr>
|
|
|
|
// elements).
|
|
|
|
eInsertTableRowElement,
|
|
|
|
|
|
|
|
// eRemoveTableRowElement indicates to remove table row elements.
|
|
|
|
eRemoveTableRowElement,
|
|
|
|
|
|
|
|
// eInsertTableColumn indicates to insert cell elements to each row.
|
|
|
|
eInsertTableColumn,
|
|
|
|
|
|
|
|
// eRemoveTableColumn indicates to remove cell elements from each row.
|
|
|
|
eRemoveTableColumn,
|
|
|
|
|
|
|
|
// eResizeElement indicates that user resizes an element size with dragging
|
|
|
|
// a resizer which is provided by Gecko.
|
|
|
|
eResizeElement,
|
|
|
|
|
|
|
|
// eMoveElement indicates that user moves an element with grabber which is
|
|
|
|
// provided by Gecko.
|
|
|
|
eMoveElement,
|
|
|
|
|
2018-10-30 12:57:52 +03:00
|
|
|
// The following edit actions are not user's operation. They are caused
|
2018-10-30 12:59:33 +03:00
|
|
|
// by if UI does something or web apps does something with JS.
|
2018-10-30 12:57:52 +03:00
|
|
|
|
|
|
|
// eUnknown indicates some special edit actions, e.g., batching of some
|
|
|
|
// nsI*Editor method calls. This shouldn't be set while handling a user
|
|
|
|
// operation.
|
|
|
|
eUnknown,
|
|
|
|
|
|
|
|
// eSetAttribute indicates to set attribute value of an element node.
|
|
|
|
eSetAttribute,
|
|
|
|
|
|
|
|
// eRemoveAttribute indicates to remove attribute from an element node.
|
|
|
|
eRemoveAttribute,
|
|
|
|
|
|
|
|
// eInsertNode indicates to insert a node into the tree.
|
|
|
|
eInsertNode,
|
|
|
|
|
|
|
|
// eDeleteNode indicates to remove a node form the tree.
|
|
|
|
eRemoveNode,
|
|
|
|
|
|
|
|
// eSplitNode indicates to split a node.
|
|
|
|
eSplitNode,
|
|
|
|
|
|
|
|
// eJoinNodes indicates to join 2 nodes.
|
|
|
|
eJoinNodes,
|
2018-10-30 12:59:33 +03:00
|
|
|
|
2018-10-30 13:00:17 +03:00
|
|
|
// eInsertBlockElement indicates to insert a block-level element like <div>,
|
|
|
|
// <pre>, <li>, <dd> etc.
|
|
|
|
eInsertBlockElement,
|
|
|
|
|
|
|
|
// eInsertHorizontalRuleElement indicates to insert a <hr> element.
|
|
|
|
eInsertHorizontalRuleElement,
|
|
|
|
|
|
|
|
// eInsertLinkElement indicates to insert an anchor element which has
|
|
|
|
// href attribute.
|
|
|
|
eInsertLinkElement,
|
|
|
|
|
2018-11-12 11:13:58 +03:00
|
|
|
// eInsertUnorderedListElement and eInsertOrderedListElement indicate to
|
|
|
|
// insert <ul> or <ol> element.
|
2018-10-30 13:00:17 +03:00
|
|
|
eInsertUnorderedListElement,
|
|
|
|
eInsertOrderedListElement,
|
|
|
|
|
2018-11-12 11:13:58 +03:00
|
|
|
// eRemoveUnorderedListElement and eRemoveOrderedListElement indicate to
|
|
|
|
// remove <ul> or <ol> element.
|
|
|
|
eRemoveUnorderedListElement,
|
|
|
|
eRemoveOrderedListElement,
|
|
|
|
|
|
|
|
// eRemoveListElement indicates to remove <ul>, <ol> and/or <dl> element.
|
2018-10-30 13:00:17 +03:00
|
|
|
eRemoveListElement,
|
|
|
|
|
|
|
|
// eInsertBlockquoteElement indicates to insert a <blockquote> element.
|
|
|
|
eInsertBlockquoteElement,
|
|
|
|
|
|
|
|
// eNormalizeTable indicates to normalize table. E.g., if a row does
|
|
|
|
// not have enough number of cells, inserts empty cells.
|
|
|
|
eNormalizeTable,
|
|
|
|
|
|
|
|
// eRemoveTableElement indicates to remove <table> element.
|
|
|
|
eRemoveTableElement,
|
|
|
|
|
|
|
|
// eRemoveTableCellContents indicates to remove any children in a table
|
|
|
|
// cell element.
|
|
|
|
eDeleteTableCellContents,
|
|
|
|
|
|
|
|
// eInsertTableCellElement indicates to insert table cell elements (i.e.,
|
|
|
|
// <td> or <th>).
|
|
|
|
eInsertTableCellElement,
|
|
|
|
|
|
|
|
// eRemoveTableCellEelement indicates to remove table cell elements.
|
|
|
|
eRemoveTableCellElement,
|
|
|
|
|
|
|
|
// eJoinTableCellElements indicates to join table cell elements.
|
|
|
|
eJoinTableCellElements,
|
|
|
|
|
|
|
|
// eSplitTableCellElement indicates to split table cell elements.
|
|
|
|
eSplitTableCellElement,
|
|
|
|
|
|
|
|
// eSetTableCellElementType indicates to set table cell element type to
|
|
|
|
// <td> or <th>.
|
|
|
|
eSetTableCellElementType,
|
|
|
|
|
|
|
|
// eSetInlineStyleProperty indicates to set CSS another inline style property
|
|
|
|
// which is not defined below.
|
|
|
|
eSetInlineStyleProperty,
|
|
|
|
|
|
|
|
// eRemoveInlineStyleProperty indicates to remove a CSS text property which
|
|
|
|
// is not defined below.
|
|
|
|
eRemoveInlineStyleProperty,
|
|
|
|
|
|
|
|
// <b> or font-weight.
|
|
|
|
eSetFontWeightProperty,
|
|
|
|
eRemoveFontWeightProperty,
|
|
|
|
|
|
|
|
// <i> or text-style: italic/oblique.
|
|
|
|
eSetTextStyleProperty,
|
|
|
|
eRemoveTextStyleProperty,
|
|
|
|
|
|
|
|
// <u> or text-decoration: underline.
|
|
|
|
eSetTextDecorationPropertyUnderline,
|
|
|
|
eRemoveTextDecorationPropertyUnderline,
|
|
|
|
|
|
|
|
// <strike> or text-decoration: line-through.
|
|
|
|
eSetTextDecorationPropertyLineThrough,
|
|
|
|
eRemoveTextDecorationPropertyLineThrough,
|
|
|
|
|
|
|
|
// <sup> or text-align: super.
|
|
|
|
eSetVerticalAlignPropertySuper,
|
|
|
|
eRemoveVerticalAlignPropertySuper,
|
|
|
|
|
|
|
|
// <sub> or text-align: sub.
|
|
|
|
eSetVerticalAlignPropertySub,
|
|
|
|
eRemoveVerticalAlignPropertySub,
|
|
|
|
|
|
|
|
// <font face="foo"> or font-family.
|
|
|
|
eSetFontFamilyProperty,
|
|
|
|
eRemoveFontFamilyProperty,
|
|
|
|
|
|
|
|
// <font color="foo"> or color.
|
|
|
|
eSetColorProperty,
|
|
|
|
eRemoveColorProperty,
|
|
|
|
|
|
|
|
// <span style="background-color: foo">
|
|
|
|
eSetBackgroundColorPropertyInline,
|
|
|
|
eRemoveBackgroundColorPropertyInline,
|
|
|
|
|
|
|
|
// eRemoveAllInlineStyleProperties indicates to remove all CSS inline
|
|
|
|
// style properties.
|
|
|
|
eRemoveAllInlineStyleProperties,
|
|
|
|
|
|
|
|
// eIncrementFontSize indicates to increment font-size.
|
|
|
|
eIncrementFontSize,
|
|
|
|
|
|
|
|
// eDecrementFontSize indicates to decrement font-size.
|
|
|
|
eDecrementFontSize,
|
|
|
|
|
|
|
|
// eSetAlignment indicates to set alignment of selected content but different
|
|
|
|
// from the following.
|
|
|
|
eSetAlignment,
|
|
|
|
|
|
|
|
// eAlign* and eJustify indicates to align contents in block with left
|
|
|
|
// edge, right edge, center or justify the text.
|
|
|
|
eAlignLeft,
|
|
|
|
eAlignRight,
|
|
|
|
eAlignCenter,
|
|
|
|
eJustify,
|
|
|
|
|
|
|
|
// eSetBackgroundColor indicates to set background color.
|
|
|
|
eSetBackgroundColor,
|
|
|
|
|
|
|
|
// eSetPositionToAbsoluteOrStatic indicates to set position property value
|
|
|
|
// to "absolute" or "static".
|
|
|
|
eSetPositionToAbsoluteOrStatic,
|
|
|
|
|
|
|
|
// eIncreaseOrDecreaseZIndex indicates to change z-index of an element.
|
|
|
|
eIncreaseOrDecreaseZIndex,
|
|
|
|
|
|
|
|
// eAddOverrideStyleSheet indicates to add override style sheet.
|
|
|
|
eAddOverrideStyleSheet,
|
|
|
|
|
|
|
|
// eRemoveOverrideStyleSheet indicates to remove override style sheet.
|
|
|
|
eRemoveOverrideStyleSheet,
|
|
|
|
|
|
|
|
// eReplaceOverrideStyleSheet indicates to replace added override style
|
|
|
|
// sheet with new override style sheet.
|
|
|
|
eReplaceOverrideStyleSheet,
|
|
|
|
|
|
|
|
// eEnableStyleSheet indicates to apply a style sheet.
|
|
|
|
eEnableStyleSheet,
|
|
|
|
|
|
|
|
// eEnableOrDisableCSS indicates to enable or disable CSS mode of HTMLEditor.
|
|
|
|
eEnableOrDisableCSS,
|
|
|
|
|
|
|
|
// eEnableOrDisableAbsolutePositionEditor indicates to enable or disable
|
|
|
|
// absolute positioned element editing UI.
|
|
|
|
eEnableOrDisableAbsolutePositionEditor,
|
|
|
|
|
|
|
|
// eEnableOrDisableResizer indicates to enable or disable resizers of
|
|
|
|
// <img>, <table> and absolutely positioned element.
|
|
|
|
eEnableOrDisableResizer,
|
|
|
|
|
|
|
|
// eEnableOrDisableInlineTableEditingUI indicates to enable or disable
|
|
|
|
// inline table editing UI.
|
|
|
|
eEnableOrDisableInlineTableEditingUI,
|
|
|
|
|
2018-10-30 12:59:33 +03:00
|
|
|
// eSetCharacterSet indicates to set character-set of the document.
|
|
|
|
eSetCharacterSet,
|
|
|
|
|
|
|
|
// eSetWrapWidth indicates to set wrap width.
|
|
|
|
eSetWrapWidth,
|
|
|
|
|
2018-10-30 13:00:17 +03:00
|
|
|
// eRewrap indicates to rewrap for current wrap width.
|
|
|
|
eRewrap,
|
|
|
|
|
2018-10-30 12:59:33 +03:00
|
|
|
// eSetText indicates to set new text of TextEditor, e.g., setting
|
|
|
|
// HTMLInputElement.value.
|
|
|
|
eSetText,
|
|
|
|
|
2018-10-30 13:00:17 +03:00
|
|
|
// eSetHTML indicates to set body of HTMLEditor.
|
|
|
|
eSetHTML,
|
|
|
|
|
|
|
|
// eInsertHTML indicates to insert HTML source code.
|
|
|
|
eInsertHTML,
|
|
|
|
|
2018-10-30 12:59:33 +03:00
|
|
|
// eHidePassword indicates that editor hides password with mask characters.
|
|
|
|
eHidePassword,
|
2018-10-30 13:00:17 +03:00
|
|
|
|
2019-08-02 08:44:40 +03:00
|
|
|
// eCreatePaddingBRElementForEmptyEditor indicates that editor wants to
|
|
|
|
// create a padding <br> element for empty editor after it modifies its
|
|
|
|
// content.
|
|
|
|
eCreatePaddingBRElementForEmptyEditor,
|
2018-10-30 12:56:41 +03:00
|
|
|
};
|
|
|
|
|
2018-01-12 13:01:04 +03:00
|
|
|
// This is int32_t instead of int16_t because nsIInlineSpellChecker.idl's
|
|
|
|
// spellCheckAfterEditorChange is defined to take it as a long.
|
|
|
|
// TODO: Make each name eFoo and investigate whether the numeric values
|
|
|
|
// still have some meaning.
|
Bug 1463985 - part 1: Rename EditAction to EditSubAction and related stuff r=m_kato
When we implement InputEvent.inputType, we need to set a stack class to record
which edit action is currently handled. However, currently, we call smaller
jobs as edit action. For example, when user types a character at selecting
some characters, then, EditAction::deleteSelection is performed first, then,
EditAction::insertText is performed. However, for the InputEvent.inputType,
we need inserText information. So, for making new enum EditAction, we need
to rename current EditAction to EditSubAction.
And also this renames related stuff:
EditorBase::mIsInEditAction -> EditorBase::mIsInEditSubAction
EditorBase::IsInEditAction() -> EditorBase::IsInEditSubAction()
EditorBase::mAction -> EditorBase::mTopLevelEditSubAction
TextEditRules::mTheAction -> TextEditRules::mTopLevelEditSubAction
EditorBase::StartOperation() ->
EditorBase::OnStartToHandleTopLevelEditSubAction()
EditorBase::EndOperation() ->
EditorBase::OnEndHandlingTopLevelEditSubAction()
AutoRules -> AutoTopLevelEditSubActionNotifier
RulesInfo -> EditSubActionInfo
MozReview-Commit-ID: cvSkPUjFm1
--HG--
extra : rebase_source : baf527a3e353b7a8ebe9a46be2243b059c500234
2018-05-28 14:12:34 +03:00
|
|
|
enum class EditSubAction : int32_t {
|
2018-05-28 14:29:34 +03:00
|
|
|
// eNone indicates not edit sub-action is being handled. This is useful
|
|
|
|
// of initial value of member variables.
|
2018-05-28 18:06:24 +03:00
|
|
|
eNone,
|
2018-05-28 14:36:06 +03:00
|
|
|
|
|
|
|
// eUndo and eRedo indicate entire actions of undo/redo operation.
|
|
|
|
eUndo,
|
|
|
|
eRedo,
|
|
|
|
|
2018-05-28 15:16:44 +03:00
|
|
|
// eInsertNode indicates to insert a new node into the DOM tree.
|
|
|
|
eInsertNode,
|
|
|
|
|
|
|
|
// eCreateNode indicates to create a new node and insert it into the DOM tree.
|
|
|
|
eCreateNode,
|
|
|
|
|
2018-05-28 15:19:34 +03:00
|
|
|
// eDeleteNode indicates to remove a node from the DOM tree.
|
|
|
|
eDeleteNode,
|
|
|
|
|
2018-05-28 15:25:20 +03:00
|
|
|
// eSplitNode indicates to split a node to 2 nodes.
|
|
|
|
eSplitNode,
|
|
|
|
|
|
|
|
// eJoinNodes indicates to join 2 nodes.
|
|
|
|
eJoinNodes,
|
2018-01-12 13:01:04 +03:00
|
|
|
|
2018-05-28 15:29:14 +03:00
|
|
|
// eDeleteText indicates to delete some characters form a text node.
|
|
|
|
eDeleteText,
|
2018-01-12 13:01:04 +03:00
|
|
|
|
2018-05-28 15:36:47 +03:00
|
|
|
// eInsertText indicates to insert some characters.
|
|
|
|
eInsertText,
|
|
|
|
|
2018-05-28 15:44:39 +03:00
|
|
|
// eInsertTextComingFromIME indicates to insert or update composition string
|
|
|
|
// with new text which is new composition string or commit string.
|
|
|
|
eInsertTextComingFromIME,
|
|
|
|
|
2018-05-28 15:49:56 +03:00
|
|
|
// eDeleteSelectedContent indicates to remove selected content.
|
|
|
|
eDeleteSelectedContent,
|
|
|
|
|
2018-05-28 16:05:10 +03:00
|
|
|
// eSetTextProperty indicates to set a style from text.
|
|
|
|
eSetTextProperty,
|
|
|
|
|
|
|
|
// eRemoveTextProperty indicates to remove a style from text.
|
|
|
|
eRemoveTextProperty,
|
|
|
|
|
2018-05-28 17:40:45 +03:00
|
|
|
// eRemoveAllTextProperties indicate to remove all styles from text.
|
|
|
|
eRemoveAllTextProperties,
|
|
|
|
|
2018-05-28 16:09:55 +03:00
|
|
|
// eComputeTextToOutput indicates to compute the editor value as plain text
|
|
|
|
// or something requested format.
|
|
|
|
eComputeTextToOutput,
|
|
|
|
|
2018-05-28 16:20:43 +03:00
|
|
|
// eSetText indicates to set editor value to new value.
|
|
|
|
eSetText,
|
2018-01-12 13:01:04 +03:00
|
|
|
|
2018-11-03 14:22:13 +03:00
|
|
|
// eInsertLineBreak indicates to insert a line break, <br> or \n to break
|
|
|
|
// current line.
|
|
|
|
eInsertLineBreak,
|
|
|
|
|
2018-05-28 16:27:47 +03:00
|
|
|
// eInsertParagraphSeparator indicates to insert paragraph separator, <br> or
|
2018-11-03 14:22:13 +03:00
|
|
|
// \n at least to break current line in HTMLEditor.
|
2018-05-28 16:27:47 +03:00
|
|
|
eInsertParagraphSeparator,
|
|
|
|
|
2018-05-28 16:36:19 +03:00
|
|
|
// eCreateOrChangeList indicates to create new list or change existing list
|
|
|
|
// type.
|
|
|
|
eCreateOrChangeList,
|
|
|
|
|
2018-05-28 16:42:31 +03:00
|
|
|
// eIndent and eOutdent indicates to indent or outdent the target with
|
|
|
|
// using <blockquote>, <ul>, <ol> or just margin of start edge.
|
|
|
|
eIndent,
|
|
|
|
eOutdent,
|
|
|
|
|
2018-05-28 16:51:31 +03:00
|
|
|
// eSetOrClearAlignment aligns content or clears alignment with align
|
|
|
|
// attribute or text-align.
|
|
|
|
eSetOrClearAlignment,
|
|
|
|
|
2018-05-28 17:01:19 +03:00
|
|
|
// eCreateOrRemoveBlock creates new block or removes existing block and
|
|
|
|
// move its descendants to where the block was.
|
|
|
|
eCreateOrRemoveBlock,
|
|
|
|
|
2019-08-25 07:20:34 +03:00
|
|
|
// eMergeBlockContents is not an actual sub-action, but this is used by
|
|
|
|
// HTMLEditor::MoveBlock() to request special handling in
|
|
|
|
// HTMLEditor::SplitInlinesAndCollectEditTargetNodesInOneHardLine().
|
|
|
|
eMergeBlockContents,
|
|
|
|
|
2018-05-28 17:05:00 +03:00
|
|
|
// eRemoveList removes specific type of list but keep its content.
|
|
|
|
eRemoveList,
|
|
|
|
|
2019-09-03 12:32:17 +03:00
|
|
|
// eCreateOrChangeDefinitionListItem indicates to format current hard line(s)
|
|
|
|
// `<dd>` or `<dt>`. This may cause creating or changing existing list
|
|
|
|
// element to new `<dl>` element.
|
|
|
|
eCreateOrChangeDefinitionListItem,
|
2018-05-28 17:08:50 +03:00
|
|
|
|
2018-05-28 17:13:41 +03:00
|
|
|
// eInsertElement indicates to insert an element.
|
|
|
|
eInsertElement,
|
|
|
|
|
2018-05-28 17:22:19 +03:00
|
|
|
// eInsertQuotation indicates to insert an element and make it "quoted text".
|
|
|
|
eInsertQuotation,
|
2018-01-12 13:01:04 +03:00
|
|
|
|
2019-08-09 11:25:37 +03:00
|
|
|
// eInsertQuotedText indicates to insert text which has already been quoted.
|
|
|
|
eInsertQuotedText,
|
|
|
|
|
2018-05-28 17:37:12 +03:00
|
|
|
// ePasteHTMLContent indicates to paste HTML content in clipboard.
|
|
|
|
ePasteHTMLContent,
|
|
|
|
|
|
|
|
// eInsertHTMLSource indicates to create a document fragment from given HTML
|
|
|
|
// source and insert into the DOM tree. So, this is similar to innerHTML.
|
|
|
|
eInsertHTMLSource,
|
|
|
|
|
2018-05-28 18:06:24 +03:00
|
|
|
// eReplaceHeadWithHTMLSource indicates to create a document fragment from
|
|
|
|
// given HTML source and replace content of <head> with it.
|
|
|
|
eReplaceHeadWithHTMLSource,
|
|
|
|
|
|
|
|
// eSetPositionToAbsolute and eSetPositionToStatic indicates to set position
|
2018-05-28 17:48:39 +03:00
|
|
|
// property to absolute or static.
|
|
|
|
eSetPositionToAbsolute,
|
|
|
|
eSetPositionToStatic,
|
|
|
|
|
2018-05-28 17:52:16 +03:00
|
|
|
// eDecreaseZIndex and eIncreaseZIndex indicate to decrease and increase
|
|
|
|
// z-index value.
|
|
|
|
eDecreaseZIndex,
|
|
|
|
eIncreaseZIndex,
|
2018-05-28 18:06:24 +03:00
|
|
|
|
2019-08-02 08:44:40 +03:00
|
|
|
// eCreatePaddingBRElementForEmptyEditor indicates to create a padding <br>
|
|
|
|
// element for empty editor.
|
|
|
|
eCreatePaddingBRElementForEmptyEditor,
|
2018-01-12 13:01:04 +03:00
|
|
|
};
|
|
|
|
|
2019-01-07 13:10:57 +03:00
|
|
|
inline EditorInputType ToInputType(EditAction aEditAction) {
|
|
|
|
switch (aEditAction) {
|
|
|
|
case EditAction::eInsertText:
|
|
|
|
return EditorInputType::eInsertText;
|
|
|
|
case EditAction::eReplaceText:
|
|
|
|
return EditorInputType::eInsertReplacementText;
|
|
|
|
case EditAction::eInsertLineBreak:
|
|
|
|
return EditorInputType::eInsertLineBreak;
|
|
|
|
case EditAction::eInsertParagraphSeparator:
|
|
|
|
return EditorInputType::eInsertParagraph;
|
|
|
|
case EditAction::eInsertOrderedListElement:
|
|
|
|
case EditAction::eRemoveOrderedListElement:
|
|
|
|
return EditorInputType::eInsertOrderedList;
|
|
|
|
case EditAction::eInsertUnorderedListElement:
|
|
|
|
case EditAction::eRemoveUnorderedListElement:
|
|
|
|
return EditorInputType::eInsertUnorderedList;
|
|
|
|
case EditAction::eInsertHorizontalRuleElement:
|
|
|
|
return EditorInputType::eInsertHorizontalRule;
|
|
|
|
case EditAction::eDrop:
|
|
|
|
return EditorInputType::eInsertFromDrop;
|
|
|
|
case EditAction::ePaste:
|
|
|
|
return EditorInputType::eInsertFromPaste;
|
2019-03-05 17:35:43 +03:00
|
|
|
case EditAction::ePasteAsQuotation:
|
|
|
|
return EditorInputType::eInsertFromPasteAsQuotation;
|
2019-01-07 13:10:57 +03:00
|
|
|
case EditAction::eUpdateComposition:
|
|
|
|
return EditorInputType::eInsertCompositionText;
|
|
|
|
case EditAction::eCommitComposition:
|
|
|
|
if (StaticPrefs::dom_input_events_conform_to_level_1()) {
|
|
|
|
return EditorInputType::eInsertCompositionText;
|
|
|
|
}
|
|
|
|
return EditorInputType::eInsertFromComposition;
|
|
|
|
case EditAction::eCancelComposition:
|
|
|
|
if (StaticPrefs::dom_input_events_conform_to_level_1()) {
|
|
|
|
return EditorInputType::eInsertCompositionText;
|
|
|
|
}
|
|
|
|
return EditorInputType::eDeleteCompositionText;
|
|
|
|
case EditAction::eDeleteByComposition:
|
|
|
|
if (StaticPrefs::dom_input_events_conform_to_level_1()) {
|
|
|
|
// XXX Or EditorInputType::eDeleteContent? I don't know which IME may
|
|
|
|
// causes this situation.
|
|
|
|
return EditorInputType::eInsertCompositionText;
|
|
|
|
}
|
|
|
|
return EditorInputType::eDeleteByComposition;
|
|
|
|
case EditAction::eInsertLinkElement:
|
|
|
|
return EditorInputType::eInsertLink;
|
|
|
|
case EditAction::eDeleteWordBackward:
|
|
|
|
return EditorInputType::eDeleteWordBackward;
|
|
|
|
case EditAction::eDeleteWordForward:
|
|
|
|
return EditorInputType::eDeleteWordForward;
|
|
|
|
case EditAction::eDeleteToBeginningOfSoftLine:
|
|
|
|
return EditorInputType::eDeleteSoftLineBackward;
|
|
|
|
case EditAction::eDeleteToEndOfSoftLine:
|
|
|
|
return EditorInputType::eDeleteSoftLineForward;
|
|
|
|
case EditAction::eDeleteByDrag:
|
|
|
|
return EditorInputType::eDeleteByDrag;
|
|
|
|
case EditAction::eCut:
|
|
|
|
return EditorInputType::eDeleteByCut;
|
|
|
|
case EditAction::eDeleteSelection:
|
|
|
|
case EditAction::eRemoveTableRowElement:
|
|
|
|
case EditAction::eRemoveTableColumn:
|
|
|
|
case EditAction::eRemoveTableElement:
|
|
|
|
case EditAction::eDeleteTableCellContents:
|
|
|
|
case EditAction::eRemoveTableCellElement:
|
|
|
|
return EditorInputType::eDeleteContent;
|
|
|
|
case EditAction::eDeleteBackward:
|
|
|
|
return EditorInputType::eDeleteContentBackward;
|
|
|
|
case EditAction::eDeleteForward:
|
|
|
|
return EditorInputType::eDeleteContentForward;
|
|
|
|
case EditAction::eUndo:
|
|
|
|
return EditorInputType::eHistoryUndo;
|
|
|
|
case EditAction::eRedo:
|
|
|
|
return EditorInputType::eHistoryRedo;
|
|
|
|
case EditAction::eSetFontWeightProperty:
|
|
|
|
case EditAction::eRemoveFontWeightProperty:
|
|
|
|
return EditorInputType::eFormatBold;
|
|
|
|
case EditAction::eSetTextStyleProperty:
|
|
|
|
case EditAction::eRemoveTextStyleProperty:
|
|
|
|
return EditorInputType::eFormatItalic;
|
|
|
|
case EditAction::eSetTextDecorationPropertyUnderline:
|
|
|
|
case EditAction::eRemoveTextDecorationPropertyUnderline:
|
|
|
|
return EditorInputType::eFormatUnderline;
|
|
|
|
case EditAction::eSetTextDecorationPropertyLineThrough:
|
|
|
|
case EditAction::eRemoveTextDecorationPropertyLineThrough:
|
|
|
|
return EditorInputType::eFormatStrikeThrough;
|
|
|
|
case EditAction::eSetVerticalAlignPropertySuper:
|
|
|
|
case EditAction::eRemoveVerticalAlignPropertySuper:
|
|
|
|
return EditorInputType::eFormatSuperscript;
|
|
|
|
case EditAction::eSetVerticalAlignPropertySub:
|
|
|
|
case EditAction::eRemoveVerticalAlignPropertySub:
|
|
|
|
return EditorInputType::eFormatSubscript;
|
|
|
|
case EditAction::eJustify:
|
|
|
|
return EditorInputType::eFormatJustifyFull;
|
|
|
|
case EditAction::eAlignCenter:
|
|
|
|
return EditorInputType::eFormatJustifyCenter;
|
|
|
|
case EditAction::eAlignRight:
|
|
|
|
return EditorInputType::eFormatJustifyRight;
|
|
|
|
case EditAction::eAlignLeft:
|
|
|
|
return EditorInputType::eFormatJustifyLeft;
|
|
|
|
case EditAction::eIndent:
|
|
|
|
return EditorInputType::eFormatIndent;
|
|
|
|
case EditAction::eOutdent:
|
|
|
|
return EditorInputType::eFormatOutdent;
|
|
|
|
case EditAction::eRemoveAllInlineStyleProperties:
|
|
|
|
return EditorInputType::eFormatRemove;
|
|
|
|
case EditAction::eSetTextDirection:
|
|
|
|
return EditorInputType::eFormatSetBlockTextDirection;
|
|
|
|
case EditAction::eSetBackgroundColorPropertyInline:
|
|
|
|
case EditAction::eRemoveBackgroundColorPropertyInline:
|
|
|
|
return EditorInputType::eFormatBackColor;
|
|
|
|
case EditAction::eSetColorProperty:
|
|
|
|
case EditAction::eRemoveColorProperty:
|
|
|
|
return EditorInputType::eFormatFontColor;
|
|
|
|
case EditAction::eSetFontFamilyProperty:
|
|
|
|
case EditAction::eRemoveFontFamilyProperty:
|
|
|
|
return EditorInputType::eFormatFontName;
|
|
|
|
default:
|
|
|
|
return EditorInputType::eUnknown;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-01-12 13:01:04 +03:00
|
|
|
} // namespace mozilla
|
|
|
|
|
Bug 1463985 - part 1: Rename EditAction to EditSubAction and related stuff r=m_kato
When we implement InputEvent.inputType, we need to set a stack class to record
which edit action is currently handled. However, currently, we call smaller
jobs as edit action. For example, when user types a character at selecting
some characters, then, EditAction::deleteSelection is performed first, then,
EditAction::insertText is performed. However, for the InputEvent.inputType,
we need inserText information. So, for making new enum EditAction, we need
to rename current EditAction to EditSubAction.
And also this renames related stuff:
EditorBase::mIsInEditAction -> EditorBase::mIsInEditSubAction
EditorBase::IsInEditAction() -> EditorBase::IsInEditSubAction()
EditorBase::mAction -> EditorBase::mTopLevelEditSubAction
TextEditRules::mTheAction -> TextEditRules::mTopLevelEditSubAction
EditorBase::StartOperation() ->
EditorBase::OnStartToHandleTopLevelEditSubAction()
EditorBase::EndOperation() ->
EditorBase::OnEndHandlingTopLevelEditSubAction()
AutoRules -> AutoTopLevelEditSubActionNotifier
RulesInfo -> EditSubActionInfo
MozReview-Commit-ID: cvSkPUjFm1
--HG--
extra : rebase_source : baf527a3e353b7a8ebe9a46be2243b059c500234
2018-05-28 14:12:34 +03:00
|
|
|
inline bool operator!(const mozilla::EditSubAction& aEditSubAction) {
|
2018-05-28 14:29:34 +03:00
|
|
|
return aEditSubAction == mozilla::EditSubAction::eNone;
|
2018-01-12 13:01:04 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif // #ifdef mozilla_EditAction_h
|