1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef mozilla_EditAction_h
7 #define mozilla_EditAction_h
9 #include "mozilla/EventForwards.h"
10 #include "mozilla/StaticPrefs_dom.h"
15 * EditAction indicates which operation or command causes running the methods
18 enum class EditAction
{
19 // eNone indicates no edit action is being handled.
22 // eNotEditing indicates that something is retrieved, doing something at
23 // destroying or focus move etc, i.e., not edit action is being handled but
24 // editor is doing something.
27 // eInitializing indicates that the editor instance is being initialized.
30 // eInsertText indicates to insert some characters.
33 // eInsertParagraphSeparator indicates to insert a paragraph separator such
35 eInsertParagraphSeparator
,
37 // eInsertLineBreak indicates to insert \n into TextEditor or a <br> element
41 // eDeleteSelection indicates to delete selected content or content around
42 // caret if selection is collapsed.
45 // eDeleteBackward indicates to remove previous character element of caret.
46 // This may be set even when Selection is not collapsed.
49 // eDeleteForward indicates to remove next character or element of caret.
50 // This may be set even when Selection is not collapsed.
53 // eDeleteWordBackward indicates to remove previous word. If caret is in
54 // a word, remove characters between word start and caret.
55 // This may be set even when Selection is not collapsed.
58 // eDeleteWordForward indicates to remove next word. If caret is in a
59 // word, remove characters between caret and word end.
60 // This may be set even when Selection is not collapsed.
63 // eDeleteToBeginningOfSoftLine indicates to remove characters between
64 // caret and previous visual line break.
65 // This may be set even when Selection is not collapsed.
66 eDeleteToBeginningOfSoftLine
,
68 // eDeleteToEndOfSoftLine indicates to remove characters between caret and
69 // next visual line break.
70 // This may be set even when Selection is not collapsed.
71 eDeleteToEndOfSoftLine
,
73 // eDeleteByDrag indicates to remove selection by dragging the content
74 // to different place.
77 // eStartComposition indicates that user starts composition.
80 // eUpdateComposition indicates that user updates composition with
81 // new non-empty composition string and IME selections.
84 // eCommitComposition indicates that user commits composition.
87 // eCancelComposition indicates that user cancels composition.
90 // eDeleteByComposition indicates that user starts composition with
91 // empty string and there was selected content.
94 // eUndo/eRedo indicate to undo/redo a transaction.
98 // eSetTextDirection indicates that setting text direction (LTR or RTL).
101 // eCut indicates to delete selected content and copy it to the clipboard.
104 // eCopy indicates to copy selected content to the clipboard.
107 // ePaste indicates to paste clipboard data.
110 // ePasteAsQuotation indicates to paste clipboard data as quotation.
113 // eDrop indicates that user drops dragging item into the editor.
116 // eIndent indicates that to indent selected line(s).
119 // eOutdent indicates that to outdent selected line(s).
122 // eReplaceText indicates to replace a part of range in editor with
123 // specific text. For example, user select a correct word in suggestions
124 // of spellchecker or a suggestion in list of autocomplete.
127 // eInsertTableRowElement indicates to insert table rows (i.e., <tr>
129 eInsertTableRowElement
,
131 // eRemoveTableRowElement indicates to remove table row elements.
132 eRemoveTableRowElement
,
134 // eInsertTableColumn indicates to insert cell elements to each row.
137 // eRemoveTableColumn indicates to remove cell elements from each row.
140 // eResizingElement indicates that user starts to resize or keep resizing
141 // with dragging a resizer which is provided by Gecko.
144 // eResizeElement indicates that user resizes an element size with finishing
145 // dragging a resizer which is provided by Gecko.
148 // eMovingElement indicates that user starts to move or keep moving an
149 // element with grabber which is provided by Gecko.
152 // eMoveElement indicates that user finishes moving an element with grabber
153 // which is provided by Gecko.
156 // The following edit actions are not user's operation. They are caused
157 // by if UI does something or web apps does something with JS.
159 // eUnknown indicates some special edit actions, e.g., batching of some
160 // nsI*Editor method calls. This shouldn't be set while handling a user
164 // eSetAttribute indicates to set attribute value of an element node.
167 // eRemoveAttribute indicates to remove attribute from an element node.
170 // eInsertNode indicates to insert a node into the tree.
173 // eDeleteNode indicates to remove a node form the tree.
176 // eInsertBlockElement indicates to insert a block-level element like <div>,
177 // <pre>, <li>, <dd> etc.
180 // eInsertHorizontalRuleElement indicates to insert a <hr> element.
181 eInsertHorizontalRuleElement
,
183 // eInsertLinkElement indicates to insert an anchor element which has
187 // eInsertUnorderedListElement and eInsertOrderedListElement indicate to
188 // insert <ul> or <ol> element.
189 eInsertUnorderedListElement
,
190 eInsertOrderedListElement
,
192 // eRemoveUnorderedListElement and eRemoveOrderedListElement indicate to
193 // remove <ul> or <ol> element.
194 eRemoveUnorderedListElement
,
195 eRemoveOrderedListElement
,
197 // eRemoveListElement indicates to remove <ul>, <ol> and/or <dl> element.
200 // eInsertBlockquoteElement indicates to insert a <blockquote> element.
201 eInsertBlockquoteElement
,
203 // eNormalizeTable indicates to normalize table. E.g., if a row does
204 // not have enough number of cells, inserts empty cells.
207 // eRemoveTableElement indicates to remove <table> element.
210 // eRemoveTableCellContents indicates to remove any children in a table
212 eDeleteTableCellContents
,
214 // eInsertTableCellElement indicates to insert table cell elements (i.e.,
216 eInsertTableCellElement
,
218 // eRemoveTableCellEelement indicates to remove table cell elements.
219 eRemoveTableCellElement
,
221 // eJoinTableCellElements indicates to join table cell elements.
222 eJoinTableCellElements
,
224 // eSplitTableCellElement indicates to split table cell elements.
225 eSplitTableCellElement
,
227 // eSetTableCellElementType indicates to set table cell element type to
229 eSetTableCellElementType
,
231 // Those edit actions are mapped to the methods in nsITableEditor which
232 // access table layout information.
237 eSelectAllTableCells
,
243 eGetSelectedOrParentTableElement
,
244 eGetSelectedCellsType
,
245 eGetFirstSelectedCellInTable
,
248 // eSetInlineStyleProperty indicates to set CSS another inline style property
249 // which is not defined below.
250 eSetInlineStyleProperty
,
252 // eRemoveInlineStyleProperty indicates to remove a CSS text property which
253 // is not defined below.
254 eRemoveInlineStyleProperty
,
256 // <b> or font-weight.
257 eSetFontWeightProperty
,
258 eRemoveFontWeightProperty
,
260 // <i> or text-style: italic/oblique.
261 eSetTextStyleProperty
,
262 eRemoveTextStyleProperty
,
264 // <u> or text-decoration: underline.
265 eSetTextDecorationPropertyUnderline
,
266 eRemoveTextDecorationPropertyUnderline
,
268 // <strike> or text-decoration: line-through.
269 eSetTextDecorationPropertyLineThrough
,
270 eRemoveTextDecorationPropertyLineThrough
,
272 // <sup> or text-align: super.
273 eSetVerticalAlignPropertySuper
,
274 eRemoveVerticalAlignPropertySuper
,
276 // <sub> or text-align: sub.
277 eSetVerticalAlignPropertySub
,
278 eRemoveVerticalAlignPropertySub
,
280 // <font face="foo"> or font-family.
281 eSetFontFamilyProperty
,
282 eRemoveFontFamilyProperty
,
284 // <font color="foo"> or color.
286 eRemoveColorProperty
,
288 // <span style="background-color: foo">
289 eSetBackgroundColorPropertyInline
,
290 eRemoveBackgroundColorPropertyInline
,
292 // eRemoveAllInlineStyleProperties indicates to remove all CSS inline
294 eRemoveAllInlineStyleProperties
,
296 // eIncrementFontSize indicates to increment font-size.
299 // eDecrementFontSize indicates to decrement font-size.
302 // eSetAlignment indicates to set alignment of selected content but different
303 // from the following.
306 // eAlign* and eJustify indicates to align contents in block with left
307 // edge, right edge, center or justify the text.
313 // eSetBackgroundColor indicates to set background color.
316 // eSetPositionToAbsoluteOrStatic indicates to set position property value
317 // to "absolute" or "static".
318 eSetPositionToAbsoluteOrStatic
,
320 // eIncreaseOrDecreaseZIndex indicates to change z-index of an element.
321 eIncreaseOrDecreaseZIndex
,
323 // eEnableOrDisableCSS indicates to enable or disable CSS mode of HTMLEditor.
326 // eEnableOrDisableAbsolutePositionEditor indicates to enable or disable
327 // absolute positioned element editing UI.
328 eEnableOrDisableAbsolutePositionEditor
,
330 // eEnableOrDisableResizer indicates to enable or disable resizers of
331 // <img>, <table> and absolutely positioned element.
332 eEnableOrDisableResizer
,
334 // eEnableOrDisableInlineTableEditingUI indicates to enable or disable
335 // inline table editing UI.
336 eEnableOrDisableInlineTableEditingUI
,
338 // eSetCharacterSet indicates to set character-set of the document.
341 // eSetWrapWidth indicates to set wrap width.
344 // eRewrap indicates to rewrap for current wrap width.
347 // eSetText indicates to set new text of TextEditor, e.g., setting
348 // HTMLInputElement.value.
351 // eSetHTML indicates to set body of HTMLEditor.
354 // eInsertHTML indicates to insert HTML source code.
357 // eHidePassword indicates that editor hides password with mask characters.
360 // eCreatePaddingBRElementForEmptyEditor indicates that editor wants to
361 // create a padding <br> element for empty editor after it modifies its
363 eCreatePaddingBRElementForEmptyEditor
,
366 // This is int32_t instead of int16_t because nsIInlineSpellChecker.idl's
367 // spellCheckAfterEditorChange is defined to take it as a long.
368 // TODO: Make each name eFoo and investigate whether the numeric values
369 // still have some meaning.
370 enum class EditSubAction
: int32_t {
371 // eNone indicates not edit sub-action is being handled. This is useful
372 // of initial value of member variables.
375 // eUndo and eRedo indicate entire actions of undo/redo operation.
379 // eInsertNode indicates to insert a new node into the DOM tree.
382 // eCreateNode indicates to create a new node and insert it into the DOM tree.
385 // eDeleteNode indicates to remove a node from the DOM tree.
388 // eMoveNode indicates to move a node connected in the DOM tree to different
392 // eSplitNode indicates to split a node to 2 nodes.
395 // eJoinNodes indicates to join 2 nodes.
398 // eDeleteText indicates to delete some characters form a text node.
401 // eInsertText indicates to insert some characters.
404 // eInsertTextComingFromIME indicates to insert or update composition string
405 // with new text which is new composition string or commit string.
406 eInsertTextComingFromIME
,
408 // eDeleteSelectedContent indicates to remove selected content.
409 eDeleteSelectedContent
,
411 // eSetTextProperty indicates to set a style from text.
414 // eRemoveTextProperty indicates to remove a style from text.
417 // eRemoveAllTextProperties indicate to remove all styles from text.
418 eRemoveAllTextProperties
,
420 // eComputeTextToOutput indicates to compute the editor value as plain text
421 // or something requested format.
422 eComputeTextToOutput
,
424 // eSetText indicates to set editor value to new value.
427 // eInsertLineBreak indicates to insert a line break, <br> or \n to break
431 // eInsertParagraphSeparator indicates to insert paragraph separator, <br> or
432 // \n at least to break current line in HTMLEditor.
433 eInsertParagraphSeparator
,
435 // eCreateOrChangeList indicates to create new list or change existing list
439 // eIndent and eOutdent indicates to indent or outdent the target with
440 // using <blockquote>, <ul>, <ol> or just margin of start edge.
444 // eSetOrClearAlignment aligns content or clears alignment with align
445 // attribute or text-align.
446 eSetOrClearAlignment
,
448 // eCreateOrRemoveBlock creates new block or removes existing block and
449 // move its descendants to where the block was.
450 eCreateOrRemoveBlock
,
452 // eFormatBlockForHTMLCommand wraps selected lines into format block, replaces
453 // format blocks around selection with new format block or deletes format
454 // blocks around selection.
455 eFormatBlockForHTMLCommand
,
457 // eMergeBlockContents is not an actual sub-action, but this is used by
458 // HTMLEditor::MoveBlock() to request special handling in
459 // HTMLEditor::MaybeSplitElementsAtEveryBRElement().
462 // eRemoveList removes specific type of list but keep its content.
465 // eCreateOrChangeDefinitionListItem indicates to format current hard line(s)
466 // `<dd>` or `<dt>`. This may cause creating or changing existing list
467 // element to new `<dl>` element.
468 eCreateOrChangeDefinitionListItem
,
470 // eInsertElement indicates to insert an element.
473 // eInsertQuotation indicates to insert an element and make it "quoted text".
476 // eInsertQuotedText indicates to insert text which has already been quoted.
479 // ePasteHTMLContent indicates to paste HTML content in clipboard.
482 // eInsertHTMLSource indicates to create a document fragment from given HTML
483 // source and insert into the DOM tree. So, this is similar to innerHTML.
486 // eReplaceHeadWithHTMLSource indicates to create a document fragment from
487 // given HTML source and replace content of <head> with it.
488 eReplaceHeadWithHTMLSource
,
490 // eSetPositionToAbsolute and eSetPositionToStatic indicates to set position
491 // property to absolute or static.
492 eSetPositionToAbsolute
,
493 eSetPositionToStatic
,
495 // eDecreaseZIndex and eIncreaseZIndex indicate to decrease and increase
500 // eCreatePaddingBRElementForEmptyEditor indicates to create a padding <br>
501 // element for empty editor.
502 eCreatePaddingBRElementForEmptyEditor
,
505 // You can use this macro as:
506 // case NS_EDIT_ACTION_CASES_ACCESSING_TABLE_DATA_WITHOUT_EDITING:
508 #define NS_EDIT_ACTION_CASES_ACCESSING_TABLE_DATA_WITHOUT_EDITING \
509 mozilla::EditAction::eSelectTableCell: \
510 case mozilla::EditAction::eSelectTableRow: \
511 case mozilla::EditAction::eSelectTableColumn: \
512 case mozilla::EditAction::eSelectTable: \
513 case mozilla::EditAction::eSelectAllTableCells: \
514 case mozilla::EditAction::eGetCellIndexes: \
515 case mozilla::EditAction::eGetTableSize: \
516 case mozilla::EditAction::eGetCellAt: \
517 case mozilla::EditAction::eGetCellDataAt: \
518 case mozilla::EditAction::eGetFirstRow: \
519 case mozilla::EditAction::eGetSelectedOrParentTableElement: \
520 case mozilla::EditAction::eGetSelectedCellsType: \
521 case mozilla::EditAction::eGetFirstSelectedCellInTable: \
522 case mozilla::EditAction::eGetSelectedCells
525 inline EditorInputType
ToInputType(EditAction aEditAction
) {
526 switch (aEditAction
) {
527 case EditAction::eInsertText
:
528 return EditorInputType::eInsertText
;
529 case EditAction::eReplaceText
:
530 return EditorInputType::eInsertReplacementText
;
531 case EditAction::eInsertLineBreak
:
532 return EditorInputType::eInsertLineBreak
;
533 case EditAction::eInsertParagraphSeparator
:
534 return EditorInputType::eInsertParagraph
;
535 case EditAction::eInsertOrderedListElement
:
536 case EditAction::eRemoveOrderedListElement
:
537 return EditorInputType::eInsertOrderedList
;
538 case EditAction::eInsertUnorderedListElement
:
539 case EditAction::eRemoveUnorderedListElement
:
540 return EditorInputType::eInsertUnorderedList
;
541 case EditAction::eInsertHorizontalRuleElement
:
542 return EditorInputType::eInsertHorizontalRule
;
543 case EditAction::eDrop
:
544 return EditorInputType::eInsertFromDrop
;
545 case EditAction::ePaste
:
546 return EditorInputType::eInsertFromPaste
;
547 case EditAction::ePasteAsQuotation
:
548 return EditorInputType::eInsertFromPasteAsQuotation
;
549 case EditAction::eUpdateComposition
:
550 return EditorInputType::eInsertCompositionText
;
551 case EditAction::eCommitComposition
:
552 if (StaticPrefs::dom_input_events_conform_to_level_1()) {
553 return EditorInputType::eInsertCompositionText
;
555 return EditorInputType::eInsertFromComposition
;
556 case EditAction::eCancelComposition
:
557 if (StaticPrefs::dom_input_events_conform_to_level_1()) {
558 return EditorInputType::eInsertCompositionText
;
560 return EditorInputType::eDeleteCompositionText
;
561 case EditAction::eDeleteByComposition
:
562 if (StaticPrefs::dom_input_events_conform_to_level_1()) {
563 // XXX Or EditorInputType::eDeleteContent? I don't know which IME may
564 // causes this situation.
565 return EditorInputType::eInsertCompositionText
;
567 return EditorInputType::eDeleteByComposition
;
568 case EditAction::eInsertLinkElement
:
569 return EditorInputType::eInsertLink
;
570 case EditAction::eDeleteWordBackward
:
571 return EditorInputType::eDeleteWordBackward
;
572 case EditAction::eDeleteWordForward
:
573 return EditorInputType::eDeleteWordForward
;
574 case EditAction::eDeleteToBeginningOfSoftLine
:
575 return EditorInputType::eDeleteSoftLineBackward
;
576 case EditAction::eDeleteToEndOfSoftLine
:
577 return EditorInputType::eDeleteSoftLineForward
;
578 case EditAction::eDeleteByDrag
:
579 return EditorInputType::eDeleteByDrag
;
580 case EditAction::eCut
:
581 return EditorInputType::eDeleteByCut
;
582 case EditAction::eDeleteSelection
:
583 case EditAction::eRemoveTableRowElement
:
584 case EditAction::eRemoveTableColumn
:
585 case EditAction::eRemoveTableElement
:
586 case EditAction::eDeleteTableCellContents
:
587 case EditAction::eRemoveTableCellElement
:
588 return EditorInputType::eDeleteContent
;
589 case EditAction::eDeleteBackward
:
590 return EditorInputType::eDeleteContentBackward
;
591 case EditAction::eDeleteForward
:
592 return EditorInputType::eDeleteContentForward
;
593 case EditAction::eUndo
:
594 return EditorInputType::eHistoryUndo
;
595 case EditAction::eRedo
:
596 return EditorInputType::eHistoryRedo
;
597 case EditAction::eSetFontWeightProperty
:
598 case EditAction::eRemoveFontWeightProperty
:
599 return EditorInputType::eFormatBold
;
600 case EditAction::eSetTextStyleProperty
:
601 case EditAction::eRemoveTextStyleProperty
:
602 return EditorInputType::eFormatItalic
;
603 case EditAction::eSetTextDecorationPropertyUnderline
:
604 case EditAction::eRemoveTextDecorationPropertyUnderline
:
605 return EditorInputType::eFormatUnderline
;
606 case EditAction::eSetTextDecorationPropertyLineThrough
:
607 case EditAction::eRemoveTextDecorationPropertyLineThrough
:
608 return EditorInputType::eFormatStrikeThrough
;
609 case EditAction::eSetVerticalAlignPropertySuper
:
610 case EditAction::eRemoveVerticalAlignPropertySuper
:
611 return EditorInputType::eFormatSuperscript
;
612 case EditAction::eSetVerticalAlignPropertySub
:
613 case EditAction::eRemoveVerticalAlignPropertySub
:
614 return EditorInputType::eFormatSubscript
;
615 case EditAction::eJustify
:
616 return EditorInputType::eFormatJustifyFull
;
617 case EditAction::eAlignCenter
:
618 return EditorInputType::eFormatJustifyCenter
;
619 case EditAction::eAlignRight
:
620 return EditorInputType::eFormatJustifyRight
;
621 case EditAction::eAlignLeft
:
622 return EditorInputType::eFormatJustifyLeft
;
623 case EditAction::eIndent
:
624 return EditorInputType::eFormatIndent
;
625 case EditAction::eOutdent
:
626 return EditorInputType::eFormatOutdent
;
627 case EditAction::eRemoveAllInlineStyleProperties
:
628 return EditorInputType::eFormatRemove
;
629 case EditAction::eSetTextDirection
:
630 return EditorInputType::eFormatSetBlockTextDirection
;
631 case EditAction::eSetBackgroundColorPropertyInline
:
632 case EditAction::eRemoveBackgroundColorPropertyInline
:
633 return EditorInputType::eFormatBackColor
;
634 case EditAction::eSetColorProperty
:
635 case EditAction::eRemoveColorProperty
:
636 return EditorInputType::eFormatFontColor
;
637 case EditAction::eSetFontFamilyProperty
:
638 case EditAction::eRemoveFontFamilyProperty
:
639 return EditorInputType::eFormatFontName
;
641 return EditorInputType::eUnknown
;
645 inline bool MayEditActionDeleteAroundCollapsedSelection(
646 const EditAction aEditAction
) {
647 switch (aEditAction
) {
648 case EditAction::eDeleteSelection
:
649 case EditAction::eDeleteBackward
:
650 case EditAction::eDeleteForward
:
651 case EditAction::eDeleteWordBackward
:
652 case EditAction::eDeleteWordForward
:
653 case EditAction::eDeleteToBeginningOfSoftLine
:
654 case EditAction::eDeleteToEndOfSoftLine
:
661 inline bool IsEditActionInOrderToEditSomething(const EditAction aEditAction
) {
662 switch (aEditAction
) {
663 case EditAction::eNotEditing
:
664 case NS_EDIT_ACTION_CASES_ACCESSING_TABLE_DATA_WITHOUT_EDITING
:
671 inline bool IsEditActionTableEditing(const EditAction aEditAction
) {
672 switch (aEditAction
) {
673 case EditAction::eInsertTableRowElement
:
674 case EditAction::eRemoveTableRowElement
:
675 case EditAction::eInsertTableColumn
:
676 case EditAction::eRemoveTableColumn
:
677 case EditAction::eRemoveTableElement
:
678 case EditAction::eRemoveTableCellElement
:
679 case EditAction::eDeleteTableCellContents
:
680 case EditAction::eInsertTableCellElement
:
681 case EditAction::eJoinTableCellElements
:
682 case EditAction::eSplitTableCellElement
:
683 case EditAction::eSetTableCellElementType
:
690 inline bool MayEditActionDeleteSelection(const EditAction aEditAction
) {
691 switch (aEditAction
) {
692 case EditAction::eNone
:
693 case EditAction::eNotEditing
:
694 case EditAction::eInitializing
:
695 case NS_EDIT_ACTION_CASES_ACCESSING_TABLE_DATA_WITHOUT_EDITING
:
698 // EditActions modifying around selection.
699 case EditAction::eInsertText
:
700 case EditAction::eInsertParagraphSeparator
:
701 case EditAction::eInsertLineBreak
:
702 case EditAction::eDeleteSelection
:
703 case EditAction::eDeleteBackward
:
704 case EditAction::eDeleteForward
:
705 case EditAction::eDeleteWordBackward
:
706 case EditAction::eDeleteWordForward
:
707 case EditAction::eDeleteToBeginningOfSoftLine
:
708 case EditAction::eDeleteToEndOfSoftLine
:
709 case EditAction::eDeleteByDrag
:
712 case EditAction::eStartComposition
:
715 case EditAction::eUpdateComposition
:
716 case EditAction::eCommitComposition
:
717 case EditAction::eCancelComposition
:
718 case EditAction::eDeleteByComposition
:
721 case EditAction::eUndo
:
722 case EditAction::eRedo
:
723 case EditAction::eSetTextDirection
:
726 case EditAction::eCut
:
729 case EditAction::eCopy
:
732 case EditAction::ePaste
:
733 case EditAction::ePasteAsQuotation
:
736 case EditAction::eDrop
:
737 return false; // Not deleting selection at drop.
739 // EditActions changing format around selection.
740 case EditAction::eIndent
:
741 case EditAction::eOutdent
:
744 // EditActions inserting or deleting something at specified position.
745 case EditAction::eInsertTableRowElement
:
746 case EditAction::eRemoveTableRowElement
:
747 case EditAction::eInsertTableColumn
:
748 case EditAction::eRemoveTableColumn
:
749 case EditAction::eResizingElement
:
750 case EditAction::eResizeElement
:
751 case EditAction::eMovingElement
:
752 case EditAction::eMoveElement
:
753 case EditAction::eUnknown
:
754 case EditAction::eSetAttribute
:
755 case EditAction::eRemoveAttribute
:
756 case EditAction::eRemoveNode
:
757 case EditAction::eInsertBlockElement
:
760 // EditActions inserting someting around selection or replacing selection
762 case EditAction::eReplaceText
:
763 case EditAction::eInsertNode
:
764 case EditAction::eInsertHorizontalRuleElement
:
767 // EditActions changing format around selection or inserting or deleting
768 // something at specific position.
769 case EditAction::eInsertLinkElement
:
770 case EditAction::eInsertUnorderedListElement
:
771 case EditAction::eInsertOrderedListElement
:
772 case EditAction::eRemoveUnorderedListElement
:
773 case EditAction::eRemoveOrderedListElement
:
774 case EditAction::eRemoveListElement
:
775 case EditAction::eInsertBlockquoteElement
:
776 case EditAction::eNormalizeTable
:
777 case EditAction::eRemoveTableElement
:
778 case EditAction::eRemoveTableCellElement
:
779 case EditAction::eDeleteTableCellContents
:
780 case EditAction::eInsertTableCellElement
:
781 case EditAction::eJoinTableCellElements
:
782 case EditAction::eSplitTableCellElement
:
783 case EditAction::eSetTableCellElementType
:
784 case EditAction::eSetInlineStyleProperty
:
785 case EditAction::eRemoveInlineStyleProperty
:
786 case EditAction::eSetFontWeightProperty
:
787 case EditAction::eRemoveFontWeightProperty
:
788 case EditAction::eSetTextStyleProperty
:
789 case EditAction::eRemoveTextStyleProperty
:
790 case EditAction::eSetTextDecorationPropertyUnderline
:
791 case EditAction::eRemoveTextDecorationPropertyUnderline
:
792 case EditAction::eSetTextDecorationPropertyLineThrough
:
793 case EditAction::eRemoveTextDecorationPropertyLineThrough
:
794 case EditAction::eSetVerticalAlignPropertySuper
:
795 case EditAction::eRemoveVerticalAlignPropertySuper
:
796 case EditAction::eSetVerticalAlignPropertySub
:
797 case EditAction::eRemoveVerticalAlignPropertySub
:
798 case EditAction::eSetFontFamilyProperty
:
799 case EditAction::eRemoveFontFamilyProperty
:
800 case EditAction::eSetColorProperty
:
801 case EditAction::eRemoveColorProperty
:
802 case EditAction::eSetBackgroundColorPropertyInline
:
803 case EditAction::eRemoveBackgroundColorPropertyInline
:
804 case EditAction::eRemoveAllInlineStyleProperties
:
805 case EditAction::eIncrementFontSize
:
806 case EditAction::eDecrementFontSize
:
807 case EditAction::eSetAlignment
:
808 case EditAction::eAlignLeft
:
809 case EditAction::eAlignRight
:
810 case EditAction::eAlignCenter
:
811 case EditAction::eJustify
:
812 case EditAction::eSetBackgroundColor
:
813 case EditAction::eSetPositionToAbsoluteOrStatic
:
814 case EditAction::eIncreaseOrDecreaseZIndex
:
817 // EditActions controlling editor feature or state.
818 case EditAction::eEnableOrDisableCSS
:
819 case EditAction::eEnableOrDisableAbsolutePositionEditor
:
820 case EditAction::eEnableOrDisableResizer
:
821 case EditAction::eEnableOrDisableInlineTableEditingUI
:
822 case EditAction::eSetCharacterSet
:
823 case EditAction::eSetWrapWidth
:
826 case EditAction::eRewrap
:
827 case EditAction::eSetText
:
828 case EditAction::eSetHTML
:
829 case EditAction::eInsertHTML
:
832 case EditAction::eHidePassword
:
833 case EditAction::eCreatePaddingBRElementForEmptyEditor
:
839 inline bool MayEditActionRequireLayout(const EditAction aEditAction
) {
840 switch (aEditAction
) {
841 // Table editing require layout information for referring table cell data
842 // such as row/column number and rowspan/colspan.
843 case EditAction::eInsertTableRowElement
:
844 case EditAction::eRemoveTableRowElement
:
845 case EditAction::eInsertTableColumn
:
846 case EditAction::eRemoveTableColumn
:
847 case EditAction::eRemoveTableElement
:
848 case EditAction::eRemoveTableCellElement
:
849 case EditAction::eDeleteTableCellContents
:
850 case EditAction::eInsertTableCellElement
:
851 case EditAction::eJoinTableCellElements
:
852 case EditAction::eSplitTableCellElement
:
853 case EditAction::eSetTableCellElementType
:
854 case NS_EDIT_ACTION_CASES_ACCESSING_TABLE_DATA_WITHOUT_EDITING
:
861 } // namespace mozilla
863 inline bool operator!(const mozilla::EditSubAction
& aEditSubAction
) {
864 return aEditSubAction
== mozilla::EditSubAction::eNone
;
867 #endif // #ifdef mozilla_EditAction_h