Bug 1463985 - part 11: Rename EditSubAction::setTextProperty and EditSubAction::removeTextProperty to EditSubAction::eSetTextProperty and EditSubAction::eRemoveTextProperty r=m_kato
authorMasayuki Nakano <masayuki@d-toybox.com>
Mon, 28 May 2018 22:05:10 +0900
changeset 474809 3b43794aa5cd71e0a2aab7bd49470b73d607d76e
parent 474808 d2d0b0d3b43b3d730ec468e13d9de86ec4cc86b5
child 474810 f276e2f986dd73cc0431992129a6184530f00227
push id9374
push userjlund@mozilla.com
push dateMon, 18 Jun 2018 21:43:20 +0000
treeherdermozilla-beta@160e085dfb0b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersm_kato
bugs1463985
milestone62.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1463985 - part 11: Rename EditSubAction::setTextProperty and EditSubAction::removeTextProperty to EditSubAction::eSetTextProperty and EditSubAction::eRemoveTextProperty r=m_kato There may be better name for them though. MozReview-Commit-ID: KxwziJArh84
editor/libeditor/EditAction.h
editor/libeditor/HTMLEditor.cpp
editor/libeditor/HTMLStyleEditor.cpp
editor/libeditor/TextEditRules.cpp
--- a/editor/libeditor/EditAction.h
+++ b/editor/libeditor/EditAction.h
@@ -47,18 +47,22 @@ enum class EditSubAction : int32_t
 
   // eInsertTextComingFromIME indicates to insert or update composition string
   // with new text which is new composition string or commit string.
   eInsertTextComingFromIME,
 
   // eDeleteSelectedContent indicates to remove selected content.
   eDeleteSelectedContent,
 
-  setTextProperty,
-  removeTextProperty,
+  // eSetTextProperty indicates to set a style from text.
+  eSetTextProperty,
+
+  // eRemoveTextProperty indicates to remove a style from text.
+  eRemoveTextProperty,
+
   outputText,
   setText,
 
   // HTML editor only actions
   insertBreak = 3000,
   makeList,
   indent,
   outdent,
--- a/editor/libeditor/HTMLEditor.cpp
+++ b/editor/libeditor/HTMLEditor.cpp
@@ -4372,18 +4372,20 @@ HTMLEditor::SetCSSBackgroundColorWithTra
 
   AutoPlaceholderBatch batchIt(this);
   AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
                                       *this, EditSubAction::insertElement,
                                       nsIEditor::eNext);
   AutoSelectionRestorer selectionRestorer(selection, this);
   AutoTransactionsConserveSelection dontChangeMySelection(this);
 
+  // XXX Although, this method may set background color of ancestor block
+  //     element, using EditSubAction::eSetTextProperty.
   bool cancel, handled;
-  EditSubActionInfo subActionInfo(EditSubAction::setTextProperty);
+  EditSubActionInfo subActionInfo(EditSubAction::eSetTextProperty);
   nsresult rv =
     rules->WillDoAction(selection, subActionInfo, &cancel, &handled);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
   if (!cancel && !handled) {
     // Loop through the ranges in the selection
     for (uint32_t i = 0; i < selection->RangeCount(); i++) {
--- a/editor/libeditor/HTMLStyleEditor.cpp
+++ b/editor/libeditor/HTMLStyleEditor.cpp
@@ -87,17 +87,17 @@ HTMLEditor::SetInlineProperty(nsAtom* aP
   AutoPlaceholderBatch batchIt(this);
   AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
                                       *this, EditSubAction::insertElement,
                                       nsIEditor::eNext);
   AutoSelectionRestorer selectionRestorer(selection, this);
   AutoTransactionsConserveSelection dontChangeMySelection(this);
 
   bool cancel, handled;
-  EditSubActionInfo subActionInfo(EditSubAction::setTextProperty);
+  EditSubActionInfo subActionInfo(EditSubAction::eSetTextProperty);
   // Protect the edit rules object from dying
   nsresult rv =
     rules->WillDoAction(selection, subActionInfo, &cancel, &handled);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
   if (!cancel && !handled) {
     // Loop through the ranges in the selection
@@ -1235,23 +1235,23 @@ HTMLEditor::RemoveInlineProperty(nsAtom*
     } else {
       mTypeInState->ClearAllProps();
     }
     return NS_OK;
   }
 
   AutoPlaceholderBatch batchIt(this);
   AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
-                                      *this, EditSubAction::removeTextProperty,
+                                      *this, EditSubAction::eRemoveTextProperty,
                                       nsIEditor::eNext);
   AutoSelectionRestorer selectionRestorer(selection, this);
   AutoTransactionsConserveSelection dontChangeMySelection(this);
 
   bool cancel, handled;
-  EditSubActionInfo subActionInfo(EditSubAction::removeTextProperty);
+  EditSubActionInfo subActionInfo(EditSubAction::eRemoveTextProperty);
   // Protect the edit rules object from dying
   RefPtr<TextEditRules> rules(mRules);
   nsresult rv =
     rules->WillDoAction(selection, subActionInfo, &cancel, &handled);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
   if (!cancel && !handled) {
@@ -1396,17 +1396,17 @@ HTMLEditor::RelativeFontChange(FontSize 
     // for the next text insertion
     mTypeInState->SetProp(&atom, nullptr, EmptyString());
     return NS_OK;
   }
 
   // Wrap with txn batching, rules sniffing, and selection preservation code
   AutoPlaceholderBatch batchIt(this);
   AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
-                                      *this, EditSubAction::setTextProperty,
+                                      *this, EditSubAction::eSetTextProperty,
                                       nsIEditor::eNext);
   AutoSelectionRestorer selectionRestorer(selection, this);
   AutoTransactionsConserveSelection dontChangeMySelection(this);
 
   // Loop through the ranges in the selection
   AutoRangeArray arrayOfRanges(selection);
   for (auto& range : arrayOfRanges.mRanges) {
     // Adjust range to include any ancestors with entirely selected children
--- a/editor/libeditor/TextEditRules.cpp
+++ b/editor/libeditor/TextEditRules.cpp
@@ -341,19 +341,19 @@ TextEditRules::WillDoAction(Selection* a
       return WillSetText(aCancel, aHandled, aInfo.inString,
                          aInfo.maxLength);
     case EditSubAction::eDeleteSelectedContent:
       return WillDeleteSelection(aInfo.collapsedAction, aCancel, aHandled);
     case EditSubAction::eUndo:
       return WillUndo(aCancel, aHandled);
     case EditSubAction::eRedo:
       return WillRedo(aCancel, aHandled);
-    case EditSubAction::setTextProperty:
+    case EditSubAction::eSetTextProperty:
       return WillSetTextProperty(aCancel, aHandled);
-    case EditSubAction::removeTextProperty:
+    case EditSubAction::eRemoveTextProperty:
       return WillRemoveTextProperty(aCancel, aHandled);
     case EditSubAction::outputText:
       return WillOutputText(aInfo.outputFormat, aInfo.outString, aInfo.flags,
                             aCancel, aHandled);
     case EditSubAction::insertElement:
       // i had thought this would be html rules only.  but we put pre elements
       // into plaintext mail when doing quoting for reply!  doh!
       return WillInsert(aCancel);