Bug 1379891 - remove nsPIEditorTransaction interface, GetTxnDescription methods. r=m_kato,masayuki
authorAdrian Wielgosik <adrian.wielgosik@gmail.com>
Wed, 10 Jan 2018 21:39:43 +0100
changeset 453520 a50f8a3e37013199700b3a0d88c2fba12608277b
parent 453519 11fd0d47649f5fa72d3c065de493ba9f4a764297
child 453521 e8ae7190dd15d67766b396320de894120faa5734
push id1648
push usermtabara@mozilla.com
push dateThu, 01 Mar 2018 12:45:47 +0000
treeherdermozilla-release@cbb9688c2eeb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersm_kato, masayuki
bugs1379891
milestone59.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 1379891 - remove nsPIEditorTransaction interface, GetTxnDescription methods. r=m_kato,masayuki MozReview-Commit-ID: 4NLeMrrqIv5
editor/libeditor/ChangeAttributeTransaction.cpp
editor/libeditor/ChangeStyleTransaction.cpp
editor/libeditor/CompositionTransaction.cpp
editor/libeditor/CreateElementTransaction.cpp
editor/libeditor/DeleteNodeTransaction.cpp
editor/libeditor/DeleteRangeTransaction.cpp
editor/libeditor/DeleteTextTransaction.cpp
editor/libeditor/EditAggregateTransaction.cpp
editor/libeditor/EditTransactionBase.cpp
editor/libeditor/EditTransactionBase.h
editor/libeditor/InsertNodeTransaction.cpp
editor/libeditor/InsertTextTransaction.cpp
editor/libeditor/JoinNodeTransaction.cpp
editor/libeditor/PlaceholderTransaction.cpp
editor/libeditor/SplitNodeTransaction.cpp
editor/libeditor/StyleSheetTransactions.cpp
editor/moz.build
editor/nsPIEditorTransaction.idl
--- a/editor/libeditor/ChangeAttributeTransaction.cpp
+++ b/editor/libeditor/ChangeAttributeTransaction.cpp
@@ -96,23 +96,9 @@ ChangeAttributeTransaction::RedoTransact
 {
   if (mRemoveAttribute) {
     return mElement->UnsetAttr(kNameSpaceID_None, mAttribute, true);
   }
 
   return mElement->SetAttr(kNameSpaceID_None, mAttribute, mValue, true);
 }
 
-NS_IMETHODIMP
-ChangeAttributeTransaction::GetTxnDescription(nsAString& aString)
-{
-  aString.AssignLiteral("ChangeAttributeTransaction: [mRemoveAttribute == ");
-
-  if (mRemoveAttribute) {
-    aString.AppendLiteral("true] ");
-  } else {
-    aString.AppendLiteral("false] ");
-  }
-  aString += nsDependentAtomString(mAttribute);
-  return NS_OK;
-}
-
 } // namespace mozilla
--- a/editor/libeditor/ChangeStyleTransaction.cpp
+++ b/editor/libeditor/ChangeStyleTransaction.cpp
@@ -266,30 +266,16 @@ ChangeStyleTransaction::UndoTransaction(
 }
 
 NS_IMETHODIMP
 ChangeStyleTransaction::RedoTransaction()
 {
   return SetStyle(mRedoAttributeWasSet, mRedoValue);
 }
 
-NS_IMETHODIMP
-ChangeStyleTransaction::GetTxnDescription(nsAString& aString)
-{
-  aString.AssignLiteral("ChangeStyleTransaction: [mRemoveProperty == ");
-
-  if (mRemoveProperty) {
-    aString.AppendLiteral("true] ");
-  } else {
-    aString.AppendLiteral("false] ");
-  }
-  aString += nsDependentAtomString(mProperty);
-  return NS_OK;
-}
-
 // True if the CSS property accepts more than one value
 bool
 ChangeStyleTransaction::AcceptsMoreThanOneValue(nsAtom& aCSSProperty)
 {
   return &aCSSProperty == nsGkAtoms::text_decoration;
 }
 
 // Adds the value aNewValue to the list of white-space separated values aValues
--- a/editor/libeditor/CompositionTransaction.cpp
+++ b/editor/libeditor/CompositionTransaction.cpp
@@ -197,24 +197,16 @@ CompositionTransaction::Merge(nsITransac
 }
 
 void
 CompositionTransaction::MarkFixed()
 {
   mFixed = true;
 }
 
-NS_IMETHODIMP
-CompositionTransaction::GetTxnDescription(nsAString& aString)
-{
-  aString.AssignLiteral("CompositionTransaction: ");
-  aString += mStringToInsert;
-  return NS_OK;
-}
-
 /* ============ private methods ================== */
 
 nsresult
 CompositionTransaction::SetSelectionForRanges()
 {
   if (NS_WARN_IF(!mEditorBase)) {
     return NS_ERROR_NOT_INITIALIZED;
   }
--- a/editor/libeditor/CreateElementTransaction.cpp
+++ b/editor/libeditor/CreateElementTransaction.cpp
@@ -175,23 +175,15 @@ CreateElementTransaction::RedoTransactio
   ErrorResult error;
   InsertNewNode(error);
   if (NS_WARN_IF(error.Failed())) {
     return error.StealNSResult();
   }
   return NS_OK;
 }
 
-NS_IMETHODIMP
-CreateElementTransaction::GetTxnDescription(nsAString& aString)
-{
-  aString.AssignLiteral("CreateElementTransaction: ");
-  aString += nsDependentAtomString(mTag);
-  return NS_OK;
-}
-
 already_AddRefed<Element>
 CreateElementTransaction::GetNewNode()
 {
   return nsCOMPtr<Element>(mNewNode).forget();
 }
 
 } // namespace mozilla
--- a/editor/libeditor/DeleteNodeTransaction.cpp
+++ b/editor/libeditor/DeleteNodeTransaction.cpp
@@ -102,16 +102,9 @@ DeleteNodeTransaction::RedoTransaction()
 
   mEditorBase->RangeUpdaterRef().SelAdjDeleteNode(mNodeToDelete);
 
   ErrorResult error;
   mParentNode->RemoveChild(*mNodeToDelete, error);
   return error.StealNSResult();
 }
 
-NS_IMETHODIMP
-DeleteNodeTransaction::GetTxnDescription(nsAString& aString)
-{
-  aString.AssignLiteral("DeleteNodeTransaction");
-  return NS_OK;
-}
-
 } // namespace mozilla
--- a/editor/libeditor/DeleteRangeTransaction.cpp
+++ b/editor/libeditor/DeleteRangeTransaction.cpp
@@ -115,23 +115,16 @@ DeleteRangeTransaction::UndoTransaction(
 }
 
 NS_IMETHODIMP
 DeleteRangeTransaction::RedoTransaction()
 {
   return EditAggregateTransaction::RedoTransaction();
 }
 
-NS_IMETHODIMP
-DeleteRangeTransaction::GetTxnDescription(nsAString& aString)
-{
-  aString.AssignLiteral("DeleteRangeTransaction");
-  return NS_OK;
-}
-
 nsresult
 DeleteRangeTransaction::CreateTxnsToDeleteBetween(
                           const RawRangeBoundary& aStart,
                           const RawRangeBoundary& aEnd)
 {
   if (NS_WARN_IF(!aStart.IsSetAndValid()) ||
       NS_WARN_IF(!aEnd.IsSetAndValid()) ||
       NS_WARN_IF(aStart.Container() != aEnd.Container())) {
--- a/editor/libeditor/DeleteTextTransaction.cpp
+++ b/editor/libeditor/DeleteTextTransaction.cpp
@@ -156,17 +156,9 @@ NS_IMETHODIMP
 DeleteTextTransaction::UndoTransaction()
 {
   if (NS_WARN_IF(!mCharData)) {
     return NS_ERROR_NOT_INITIALIZED;
   }
   return mCharData->InsertData(mOffset, mDeletedText);
 }
 
-NS_IMETHODIMP
-DeleteTextTransaction::GetTxnDescription(nsAString& aString)
-{
-  aString.AssignLiteral("DeleteTextTransaction: ");
-  aString += mDeletedText;
-  return NS_OK;
-}
-
 } // namespace mozilla
--- a/editor/libeditor/EditAggregateTransaction.cpp
+++ b/editor/libeditor/EditAggregateTransaction.cpp
@@ -97,30 +97,16 @@ EditAggregateTransaction::Merge(nsITrans
   nsITransaction *txn = mChildren[0];
   if (!txn) {
     return NS_ERROR_NULL_POINTER;
   }
   return txn->Merge(aTransaction, aDidMerge);
 }
 
 NS_IMETHODIMP
-EditAggregateTransaction::GetTxnDescription(nsAString& aString)
-{
-  aString.AssignLiteral("EditAggregateTransaction: ");
-
-  if (mName) {
-    nsAutoString name;
-    mName->ToString(name);
-    aString += name;
-  }
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
 EditAggregateTransaction::AppendChild(EditTransactionBase* aTransaction)
 {
   if (!aTransaction) {
     return NS_ERROR_NULL_POINTER;
   }
 
   RefPtr<EditTransactionBase>* slot = mChildren.AppendElement();
   if (!slot) {
--- a/editor/libeditor/EditTransactionBase.cpp
+++ b/editor/libeditor/EditTransactionBase.cpp
@@ -13,17 +13,16 @@ NS_IMPL_CYCLE_COLLECTION_CLASS(EditTrans
 
 NS_IMPL_CYCLE_COLLECTION_UNLINK_0(EditTransactionBase)
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(EditTransactionBase)
   // We don't have anything to traverse, but some of our subclasses do.
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(EditTransactionBase)
   NS_INTERFACE_MAP_ENTRY(nsITransaction)
-  NS_INTERFACE_MAP_ENTRY(nsPIEditorTransaction)
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsITransaction)
 NS_INTERFACE_MAP_END
 
 NS_IMPL_CYCLE_COLLECTING_ADDREF(EditTransactionBase)
 NS_IMPL_CYCLE_COLLECTING_RELEASE(EditTransactionBase)
 
 EditTransactionBase::~EditTransactionBase()
 {
--- a/editor/libeditor/EditTransactionBase.h
+++ b/editor/libeditor/EditTransactionBase.h
@@ -4,26 +4,24 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_EditTransactionBase_h
 #define mozilla_EditTransactionBase_h
 
 #include "nsCycleCollectionParticipant.h"
 #include "nsISupportsImpl.h"
 #include "nsITransaction.h"
-#include "nsPIEditorTransaction.h"
 #include "nscore.h"
 
 namespace mozilla {
 
 /**
  * Base class for all document editing transactions.
  */
 class EditTransactionBase : public nsITransaction
-                          , public nsPIEditorTransaction
 {
 public:
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(EditTransactionBase, nsITransaction)
 
   NS_IMETHOD RedoTransaction(void) override;
   NS_IMETHOD GetIsTransient(bool* aIsTransient) override;
   NS_IMETHOD Merge(nsITransaction* aTransaction, bool* aDidMerge) override;
@@ -31,12 +29,11 @@ public:
 protected:
   virtual ~EditTransactionBase();
 };
 
 } // namespace mozilla
 
 #define NS_DECL_EDITTRANSACTIONBASE \
   NS_IMETHOD DoTransaction() override; \
-  NS_IMETHOD UndoTransaction() override; \
-  NS_IMETHOD GetTxnDescription(nsAString& aTransactionDescription) override;
+  NS_IMETHOD UndoTransaction() override;
 
 #endif // #ifndef mozilla_EditTransactionBase_h
--- a/editor/libeditor/InsertNodeTransaction.cpp
+++ b/editor/libeditor/InsertNodeTransaction.cpp
@@ -133,16 +133,9 @@ InsertNodeTransaction::UndoTransaction()
   ErrorResult error;
   mPointToInsert.GetContainer()->RemoveChild(*mContentToInsert, error);
   if (NS_WARN_IF(error.Failed())) {
     return error.StealNSResult();
   }
   return NS_OK;
 }
 
-NS_IMETHODIMP
-InsertNodeTransaction::GetTxnDescription(nsAString& aString)
-{
-  aString.AssignLiteral("InsertNodeTransaction");
-  return NS_OK;
-}
-
 } // namespace mozilla
--- a/editor/libeditor/InsertTextTransaction.cpp
+++ b/editor/libeditor/InsertTextTransaction.cpp
@@ -113,24 +113,16 @@ InsertTextTransaction::Merge(nsITransact
     otherTransaction->GetData(otherData);
     mStringToInsert += otherData;
     *aDidMerge = true;
   }
 
   return NS_OK;
 }
 
-NS_IMETHODIMP
-InsertTextTransaction::GetTxnDescription(nsAString& aString)
-{
-  aString.AssignLiteral("InsertTextTransaction: ");
-  aString += mStringToInsert;
-  return NS_OK;
-}
-
 /* ============ private methods ================== */
 
 void
 InsertTextTransaction::GetData(nsString& aResult)
 {
   aResult = mStringToInsert;
 }
 
--- a/editor/libeditor/JoinNodeTransaction.cpp
+++ b/editor/libeditor/JoinNodeTransaction.cpp
@@ -122,16 +122,9 @@ JoinNodeTransaction::UndoTransaction()
     }
   }
   // Second, re-insert the left node into the tree
   nsCOMPtr<nsINode> refNode = mRightNode;
   mParent->InsertBefore(*mLeftNode, refNode, rv);
   return rv.StealNSResult();
 }
 
-NS_IMETHODIMP
-JoinNodeTransaction::GetTxnDescription(nsAString& aString)
-{
-  aString.AssignLiteral("JoinNodeTransaction");
-  return NS_OK;
-}
-
 } // namespace mozilla
--- a/editor/libeditor/PlaceholderTransaction.cpp
+++ b/editor/libeditor/PlaceholderTransaction.cpp
@@ -107,24 +107,16 @@ PlaceholderTransaction::Merge(nsITransac
   // set out param default value
   *aDidMerge=false;
 
   if (mForwarding) {
     NS_NOTREACHED("tried to merge into a placeholder that was in forwarding mode!");
     return NS_ERROR_FAILURE;
   }
 
-  // check to see if aTransaction is one of the editor's
-  // private transactions. If not, we want to avoid merging
-  // the foreign transaction into our placeholder since we
-  // don't know what it does.
-
-  nsCOMPtr<nsPIEditorTransaction> pTxn = do_QueryInterface(aTransaction);
-  NS_ENSURE_TRUE(pTxn, NS_OK); // it's foreign so just bail!
-
   // XXX: hack, not safe!  need nsIEditTransaction!
   EditTransactionBase* editTransactionBase = (EditTransactionBase*)aTransaction;
   // determine if this incoming txn is a placeholder txn
   nsCOMPtr<nsIAbsorbingTransaction> absorbingTransaction =
     do_QueryObject(editTransactionBase);
 
   // We are absorbing all transactions if mAbsorb is lit.
   if (mAbsorb) {
@@ -185,30 +177,16 @@ PlaceholderTransaction::Merge(nsITransac
         }
       }
     }
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP
-PlaceholderTransaction::GetTxnDescription(nsAString& aString)
-{
-  aString.AssignLiteral("PlaceholderTransaction: ");
-
-  if (mName) {
-    nsAutoString name;
-    mName->ToString(name);
-    aString += name;
-  }
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
 PlaceholderTransaction::GetTxnName(nsAtom** aName)
 {
   return GetName(aName);
 }
 
 NS_IMETHODIMP
 PlaceholderTransaction::StartSelectionEquals(SelectionState* aSelState,
                                              bool* aResult)
--- a/editor/libeditor/SplitNodeTransaction.cpp
+++ b/editor/libeditor/SplitNodeTransaction.cpp
@@ -180,23 +180,15 @@ SplitNodeTransaction::RedoTransaction()
   ErrorResult error;
   mParent->InsertBefore(*mNewLeftNode, mStartOfRightNode.GetContainer(), error);
   if (NS_WARN_IF(error.Failed())) {
     return error.StealNSResult();
   }
   return NS_OK;
 }
 
-
-NS_IMETHODIMP
-SplitNodeTransaction::GetTxnDescription(nsAString& aString)
-{
-  aString.AssignLiteral("SplitNodeTransaction");
-  return NS_OK;
-}
-
 nsIContent*
 SplitNodeTransaction::GetNewNode()
 {
   return mNewLeftNode;
 }
 
 } // namespace mozilla
--- a/editor/libeditor/StyleSheetTransactions.cpp
+++ b/editor/libeditor/StyleSheetTransactions.cpp
@@ -74,23 +74,16 @@ AddStyleSheetTransaction::UndoTransactio
 {
   if (NS_WARN_IF(!mEditorBase) || NS_WARN_IF(!mSheet)) {
     return NS_ERROR_NOT_INITIALIZED;
   }
   RemoveStyleSheet(*mEditorBase, mSheet);
   return NS_OK;
 }
 
-NS_IMETHODIMP
-AddStyleSheetTransaction::GetTxnDescription(nsAString& aString)
-{
-  aString.AssignLiteral("AddStyleSheetTransaction");
-  return NS_OK;
-}
-
 /******************************************************************************
  * RemoveStyleSheetTransaction
  ******************************************************************************/
 
 RemoveStyleSheetTransaction::RemoveStyleSheetTransaction(
                                EditorBase& aEditorBase,
                                StyleSheet& aStyleSheet)
   : mEditorBase(&aEditorBase)
@@ -121,16 +114,9 @@ RemoveStyleSheetTransaction::UndoTransac
 {
   if (NS_WARN_IF(!mEditorBase) || NS_WARN_IF(!mSheet)) {
     return NS_ERROR_NOT_INITIALIZED;
   }
   AddStyleSheet(*mEditorBase, mSheet);
   return NS_OK;
 }
 
-NS_IMETHODIMP
-RemoveStyleSheetTransaction::GetTxnDescription(nsAString& aString)
-{
-  aString.AssignLiteral("RemoveStyleSheetTransaction");
-  return NS_OK;
-}
-
 } // namespace mozilla
--- a/editor/moz.build
+++ b/editor/moz.build
@@ -22,17 +22,16 @@ XPIDL_SOURCES += [
     'nsIEditorUtils.idl',
     'nsIHTMLAbsPosEditor.idl',
     'nsIHTMLEditor.idl',
     'nsIHTMLInlineTableEditor.idl',
     'nsIHTMLObjectResizer.idl',
     'nsIPlaintextEditor.idl',
     'nsITableEditor.idl',
     'nsIURIRefObject.idl',
-    'nsPIEditorTransaction.idl',
 ]
 
 XPIDL_MODULE = 'editor'
 
 EXPORTS += [
     'nsEditorCID.h',
 ]
 
deleted file mode 100644
--- a/editor/nsPIEditorTransaction.idl
+++ /dev/null
@@ -1,20 +0,0 @@
-/* -*- 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/. */
-
-#include "nsISupports.idl"
-
-/*
- * The nsPIEditorTransaction interface.
- * <P>
- * This interface is implemented by every transaction created by this
- * editor implementation. It is used to help us distinguish our internal
- * transactions from those generated by 3rd party extensions.
- */
-[scriptable, uuid(4f18ada2-0ddc-11d5-9d3a-0060b0f8baff)]
-interface nsPIEditorTransaction : nsISupports
-{
-  readonly attribute DOMString txnDescription;
-};
-