зеркало из https://github.com/mozilla/pjs.git
Part of fix for bug 340674 (Clean up some editor transactions code). r=glazman, sr=jst.
This commit is contained in:
Родитель
0a649fc243
Коммит
37a57a85c1
|
@ -43,10 +43,6 @@ ChangeAttributeTxn::ChangeAttributeTxn()
|
|||
{
|
||||
}
|
||||
|
||||
ChangeAttributeTxn::~ChangeAttributeTxn()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP ChangeAttributeTxn::Init(nsIEditor *aEditor,
|
||||
nsIDOMElement *aElement,
|
||||
const nsAString& aAttribute,
|
||||
|
@ -115,13 +111,6 @@ NS_IMETHODIMP ChangeAttributeTxn::RedoTransaction(void)
|
|||
return result;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP ChangeAttributeTxn::Merge(nsITransaction *aTransaction, PRBool *aDidMerge)
|
||||
{
|
||||
if (aDidMerge)
|
||||
*aDidMerge=PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP ChangeAttributeTxn::GetTxnDescription(nsAString& aString)
|
||||
{
|
||||
aString.AssignLiteral("ChangeAttributeTxn: [mRemoveAttribute == ");
|
||||
|
|
|
@ -58,8 +58,6 @@ public:
|
|||
|
||||
static const nsIID& GetCID() { static const nsIID iid = CHANGE_ATTRIBUTE_TXN_CID; return iid; }
|
||||
|
||||
virtual ~ChangeAttributeTxn();
|
||||
|
||||
/** Initialize the transaction.
|
||||
* @param aEditor the object providing core editing operations
|
||||
* @param aNode the node whose attribute will be changed
|
||||
|
@ -78,15 +76,9 @@ private:
|
|||
|
||||
public:
|
||||
|
||||
NS_IMETHOD DoTransaction(void);
|
||||
NS_DECL_EDITTXN
|
||||
|
||||
NS_IMETHOD UndoTransaction(void);
|
||||
|
||||
NS_IMETHOD RedoTransaction(void);
|
||||
|
||||
NS_IMETHOD Merge(nsITransaction *aTransaction, PRBool *aDidMerge);
|
||||
|
||||
NS_IMETHOD GetTxnDescription(nsAString& aTxnDescription);
|
||||
NS_IMETHOD RedoTransaction();
|
||||
|
||||
protected:
|
||||
|
||||
|
|
|
@ -47,17 +47,6 @@
|
|||
|
||||
#define kNullCh (PRUnichar('\0'))
|
||||
|
||||
void
|
||||
ChangeCSSInlineStyleTxn::AppendDeclaration(nsAString & aOutputString,
|
||||
const nsAString & aProperty,
|
||||
const nsAString & aValues)
|
||||
{
|
||||
aOutputString.Append(aProperty
|
||||
+ NS_LITERAL_STRING(": ")
|
||||
+ aValues
|
||||
+ NS_LITERAL_STRING("; "));
|
||||
}
|
||||
|
||||
// answers true if aValue is in the string list of white-space separated values aValueList
|
||||
// a case-sensitive search is performed if aCaseSensitive is true
|
||||
PRBool
|
||||
|
@ -143,10 +132,6 @@ ChangeCSSInlineStyleTxn::ChangeCSSInlineStyleTxn()
|
|||
{
|
||||
}
|
||||
|
||||
ChangeCSSInlineStyleTxn::~ChangeCSSInlineStyleTxn()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP ChangeCSSInlineStyleTxn::Init(nsIEditor *aEditor,
|
||||
nsIDOMElement *aElement,
|
||||
nsIAtom *aProperty,
|
||||
|
@ -307,13 +292,6 @@ NS_IMETHODIMP ChangeCSSInlineStyleTxn::RedoTransaction(void)
|
|||
return SetStyle(mRedoAttributeWasSet, mRedoValue);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP ChangeCSSInlineStyleTxn::Merge(nsITransaction *aTransaction, PRBool *aDidMerge)
|
||||
{
|
||||
if (aDidMerge)
|
||||
*aDidMerge = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP ChangeCSSInlineStyleTxn::GetTxnDescription(nsAString& aString)
|
||||
{
|
||||
aString.AssignLiteral("ChangeCSSInlineStyleTxn: [mRemoveProperty == ");
|
||||
|
|
|
@ -59,8 +59,6 @@ public:
|
|||
|
||||
static const nsIID& GetCID() { static const nsIID iid = CHANGE_CSSINLINESTYLE_TXN_CID; return iid; }
|
||||
|
||||
virtual ~ChangeCSSInlineStyleTxn();
|
||||
|
||||
/** Initialize the transaction.
|
||||
* @param aEditor [IN] the object providing core editing operations
|
||||
* @param aNode [IN] the node whose style attribute will be changed
|
||||
|
@ -106,16 +104,6 @@ private:
|
|||
*/
|
||||
void RemoveValueFromListOfValues(nsAString & aValues, const nsAString & aRemoveValue);
|
||||
|
||||
/** appends 'property : value' to the string
|
||||
*
|
||||
* @param aOutputString [IN/OUT] the string
|
||||
* @param aPropert [IN] the css property string
|
||||
* @param aValues [IN] the value string for the css property
|
||||
*/
|
||||
void AppendDeclaration(nsAString & aOutputString,
|
||||
const nsAString & aProperty,
|
||||
const nsAString & aValues);
|
||||
|
||||
/** If the boolean is true and if the value is not the empty string,
|
||||
* set the property in the transaction to that value; if the value
|
||||
* is empty, remove the property from element's styles. If the boolean
|
||||
|
@ -124,16 +112,9 @@ private:
|
|||
nsresult SetStyle(PRBool aAttributeWasSet, nsAString & aValue);
|
||||
|
||||
public:
|
||||
NS_DECL_EDITTXN
|
||||
|
||||
NS_IMETHOD DoTransaction(void);
|
||||
|
||||
NS_IMETHOD UndoTransaction(void);
|
||||
|
||||
NS_IMETHOD RedoTransaction(void);
|
||||
|
||||
NS_IMETHOD Merge(nsITransaction *aTransaction, PRBool *aDidMerge);
|
||||
|
||||
NS_IMETHOD GetTxnDescription(nsAString& aTxnDescription);
|
||||
NS_IMETHOD RedoTransaction();
|
||||
|
||||
protected:
|
||||
|
||||
|
|
|
@ -80,10 +80,6 @@ NS_IMETHODIMP CreateElementTxn::Init(nsEditor *aEditor,
|
|||
}
|
||||
|
||||
|
||||
CreateElementTxn::~CreateElementTxn()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP CreateElementTxn::DoTransaction(void)
|
||||
{
|
||||
#ifdef NS_DEBUG
|
||||
|
@ -220,13 +216,6 @@ NS_IMETHODIMP CreateElementTxn::RedoTransaction(void)
|
|||
return mParent->InsertBefore(mNewNode, mRefNode, getter_AddRefs(resultNode));
|
||||
}
|
||||
|
||||
NS_IMETHODIMP CreateElementTxn::Merge(nsITransaction *aTransaction, PRBool *aDidMerge)
|
||||
{
|
||||
if (aDidMerge)
|
||||
*aDidMerge=PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP CreateElementTxn::GetTxnDescription(nsAString& aString)
|
||||
{
|
||||
aString.AssignLiteral("CreateElementTxn: ");
|
||||
|
|
|
@ -75,18 +75,9 @@ private:
|
|||
CreateElementTxn();
|
||||
|
||||
public:
|
||||
NS_DECL_EDITTXN
|
||||
|
||||
virtual ~CreateElementTxn();
|
||||
|
||||
NS_IMETHOD DoTransaction(void);
|
||||
|
||||
NS_IMETHOD UndoTransaction(void);
|
||||
|
||||
NS_IMETHOD RedoTransaction(void);
|
||||
|
||||
NS_IMETHOD Merge(nsITransaction *aTransaction, PRBool *aDidMerge);
|
||||
|
||||
NS_IMETHOD GetTxnDescription(nsAString& aTxnDescription);
|
||||
NS_IMETHOD RedoTransaction();
|
||||
|
||||
NS_IMETHOD GetNewNode(nsIDOMNode **aNewNode);
|
||||
|
||||
|
|
|
@ -68,10 +68,6 @@ NS_IMETHODIMP DeleteElementTxn::Init(nsIDOMNode *aElement,
|
|||
}
|
||||
|
||||
|
||||
DeleteElementTxn::~DeleteElementTxn()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP DeleteElementTxn::DoTransaction(void)
|
||||
{
|
||||
#ifdef NS_DEBUG
|
||||
|
@ -173,14 +169,6 @@ NS_IMETHODIMP DeleteElementTxn::RedoTransaction(void)
|
|||
return mParent->RemoveChild(mElement, getter_AddRefs(resultNode));
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP DeleteElementTxn::Merge(nsITransaction *aTransaction, PRBool *aDidMerge)
|
||||
{
|
||||
if (aDidMerge)
|
||||
*aDidMerge = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP DeleteElementTxn::GetTxnDescription(nsAString& aString)
|
||||
{
|
||||
aString.AssignLiteral("DeleteElementTxn");
|
||||
|
|
|
@ -68,18 +68,9 @@ private:
|
|||
DeleteElementTxn();
|
||||
|
||||
public:
|
||||
NS_DECL_EDITTXN
|
||||
|
||||
virtual ~DeleteElementTxn();
|
||||
|
||||
NS_IMETHOD DoTransaction(void);
|
||||
|
||||
NS_IMETHOD UndoTransaction(void);
|
||||
|
||||
NS_IMETHOD RedoTransaction(void);
|
||||
|
||||
NS_IMETHOD Merge(nsITransaction *aTransaction, PRBool *aDidMerge);
|
||||
|
||||
NS_IMETHOD GetTxnDescription(nsAString& aTxnDescription);
|
||||
NS_IMETHOD RedoTransaction();
|
||||
|
||||
protected:
|
||||
|
||||
|
|
|
@ -128,10 +128,6 @@ NS_IMETHODIMP DeleteRangeTxn::Init(nsIEditor *aEditor,
|
|||
|
||||
}
|
||||
|
||||
DeleteRangeTxn::~DeleteRangeTxn()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP DeleteRangeTxn::DoTransaction(void)
|
||||
{
|
||||
#ifdef NS_DEBUG
|
||||
|
@ -214,13 +210,6 @@ NS_IMETHODIMP DeleteRangeTxn::RedoTransaction(void)
|
|||
return EditAggregateTxn::RedoTransaction();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP DeleteRangeTxn::Merge(nsITransaction *aTransaction, PRBool *aDidMerge)
|
||||
{
|
||||
if (aDidMerge)
|
||||
*aDidMerge = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP DeleteRangeTxn::GetTxnDescription(nsAString& aString)
|
||||
{
|
||||
aString.AssignLiteral("DeleteRangeTxn");
|
||||
|
|
|
@ -74,18 +74,9 @@ private:
|
|||
DeleteRangeTxn();
|
||||
|
||||
public:
|
||||
NS_DECL_EDITTXN
|
||||
|
||||
virtual ~DeleteRangeTxn();
|
||||
|
||||
NS_IMETHOD DoTransaction(void);
|
||||
|
||||
NS_IMETHOD UndoTransaction(void);
|
||||
|
||||
NS_IMETHOD RedoTransaction(void);
|
||||
|
||||
NS_IMETHOD Merge(nsITransaction *aTransaction, PRBool *aDidMerge);
|
||||
|
||||
NS_IMETHOD GetTxnDescription(nsAString& aTxnDescription);
|
||||
NS_IMETHOD RedoTransaction();
|
||||
|
||||
protected:
|
||||
|
||||
|
|
|
@ -54,10 +54,6 @@ DeleteTextTxn::DeleteTextTxn()
|
|||
{
|
||||
}
|
||||
|
||||
DeleteTextTxn::~DeleteTextTxn()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP DeleteTextTxn::Init(nsIEditor *aEditor,
|
||||
nsIDOMCharacterData *aElement,
|
||||
PRUint32 aOffset,
|
||||
|
@ -131,13 +127,6 @@ NS_IMETHODIMP DeleteTextTxn::UndoTransaction(void)
|
|||
return mElement->InsertData(mOffset, mDeletedText);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP DeleteTextTxn::Merge(nsITransaction *aTransaction, PRBool *aDidMerge)
|
||||
{
|
||||
if (aDidMerge)
|
||||
*aDidMerge = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP DeleteTextTxn::GetTxnDescription(nsAString& aString)
|
||||
{
|
||||
aString.AssignLiteral("DeleteTextTxn: ");
|
||||
|
|
|
@ -75,15 +75,7 @@ private:
|
|||
DeleteTextTxn();
|
||||
|
||||
public:
|
||||
virtual ~DeleteTextTxn();
|
||||
|
||||
NS_IMETHOD DoTransaction(void);
|
||||
|
||||
NS_IMETHOD UndoTransaction(void);
|
||||
|
||||
NS_IMETHOD Merge(nsITransaction *aTransaction, PRBool *aDidMerge);
|
||||
|
||||
NS_IMETHOD GetTxnDescription(nsAString& aTxnDescription);
|
||||
NS_DECL_EDITTXN
|
||||
|
||||
PRUint32 GetOffset() { return mOffset; }
|
||||
|
||||
|
|
|
@ -45,11 +45,6 @@ EditAggregateTxn::EditAggregateTxn()
|
|||
NS_POSTCONDITION(NS_SUCCEEDED(res), "EditAggregateTxn failed in constructor");
|
||||
}
|
||||
|
||||
EditAggregateTxn::~EditAggregateTxn()
|
||||
{
|
||||
// nsISupportsArray cleans up array for us at destruct time
|
||||
}
|
||||
|
||||
NS_IMETHODIMP EditAggregateTxn::DoTransaction(void)
|
||||
{
|
||||
nsresult result=NS_OK; // it's legal (but not very useful) to have an empty child list
|
||||
|
@ -111,13 +106,6 @@ NS_IMETHODIMP EditAggregateTxn::RedoTransaction(void)
|
|||
return result;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP EditAggregateTxn::GetIsTransient(PRBool *aIsTransient)
|
||||
{
|
||||
if (aIsTransient)
|
||||
*aIsTransient = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP EditAggregateTxn::Merge(nsITransaction *aTransaction, PRBool *aDidMerge)
|
||||
{
|
||||
nsresult result=NS_OK; // it's legal (but not very useful) to have an empty child list
|
||||
|
@ -223,18 +211,6 @@ NS_IMETHODIMP EditAggregateTxn::GetName(nsIAtom **aName)
|
|||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(nsrefcnt) EditAggregateTxn::AddRef(void)
|
||||
{
|
||||
return EditTxn::AddRef();
|
||||
}
|
||||
|
||||
//NS_IMPL_RELEASE_INHERITED(Class, Super)
|
||||
NS_IMETHODIMP_(nsrefcnt) EditAggregateTxn::Release(void)
|
||||
{
|
||||
return EditTxn::Release();
|
||||
}
|
||||
|
||||
//NS_IMPL_QUERY_INTERFACE_INHERITED1(Class, Super, AdditionalInterface)
|
||||
NS_IMETHODIMP EditAggregateTxn::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
{
|
||||
if (!aInstancePtr) return NS_ERROR_NULL_POINTER;
|
||||
|
|
|
@ -56,27 +56,17 @@
|
|||
class EditAggregateTxn : public EditTxn
|
||||
{
|
||||
public:
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_IMETHOD QueryInterface(REFNSIID aIID, void **aInstancePtr);
|
||||
|
||||
static const nsIID& GetCID() { static const nsIID cid = EDIT_AGGREGATE_TXN_CID; return cid; }
|
||||
|
||||
EditAggregateTxn();
|
||||
|
||||
virtual ~EditAggregateTxn();
|
||||
|
||||
NS_IMETHOD DoTransaction(void);
|
||||
|
||||
NS_IMETHOD UndoTransaction(void);
|
||||
|
||||
NS_IMETHOD RedoTransaction(void);
|
||||
|
||||
NS_IMETHOD GetIsTransient(PRBool *aIsTransient);
|
||||
NS_DECL_EDITTXN
|
||||
|
||||
NS_IMETHOD RedoTransaction();
|
||||
NS_IMETHOD Merge(nsITransaction *aTransaction, PRBool *aDidMerge);
|
||||
|
||||
NS_IMETHOD GetTxnDescription(nsAString& aTxnDescription);
|
||||
|
||||
/** append a transaction to this aggregate */
|
||||
NS_IMETHOD AppendChild(EditTxn *aTxn);
|
||||
|
||||
|
|
|
@ -40,44 +40,28 @@
|
|||
|
||||
NS_IMPL_ISUPPORTS2(EditTxn, nsITransaction, nsPIEditorTransaction)
|
||||
|
||||
EditTxn::EditTxn()
|
||||
{
|
||||
}
|
||||
|
||||
EditTxn::~EditTxn()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP EditTxn::DoTransaction(void)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP EditTxn::UndoTransaction(void)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP EditTxn::RedoTransaction(void)
|
||||
NS_IMETHODIMP
|
||||
EditTxn::RedoTransaction(void)
|
||||
{
|
||||
return DoTransaction();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP EditTxn::GetIsTransient(PRBool *aIsTransient)
|
||||
NS_IMETHODIMP
|
||||
EditTxn::GetIsTransient(PRBool *aIsTransient)
|
||||
{
|
||||
if (aIsTransient)
|
||||
*aIsTransient = PR_FALSE;
|
||||
*aIsTransient = PR_FALSE;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP EditTxn::Merge(nsITransaction *aTransaction, PRBool *aDidMerge)
|
||||
NS_IMETHODIMP
|
||||
EditTxn::Merge(nsITransaction *aTransaction, PRBool *aDidMerge)
|
||||
{
|
||||
*aDidMerge = PR_FALSE;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP EditTxn::GetTxnDescription(nsAString& aString)
|
||||
{
|
||||
aString.AssignLiteral("EditTxn");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,6 @@
|
|||
|
||||
#include "nsITransaction.h"
|
||||
#include "nsString.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsPIEditorTransaction.h"
|
||||
|
||||
#define EDIT_TXN_CID \
|
||||
|
@ -49,13 +48,10 @@
|
|||
{0x86, 0xd8, 0x0, 0x0, 0x64, 0x65, 0x73, 0x74} }
|
||||
|
||||
/**
|
||||
* base class for all document editing transactions.
|
||||
* provides default concrete behavior for all nsITransaction methods.
|
||||
* EditTxns optionally have a name. This name is for internal purposes only,
|
||||
* it is never seen by the user or by any external entity.
|
||||
* Base class for all document editing transactions.
|
||||
*/
|
||||
class EditTxn : public nsITransaction
|
||||
, public nsPIEditorTransaction
|
||||
class EditTxn : public nsITransaction,
|
||||
public nsPIEditorTransaction
|
||||
{
|
||||
public:
|
||||
|
||||
|
@ -63,21 +59,16 @@ public:
|
|||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
EditTxn();
|
||||
virtual ~EditTxn();
|
||||
|
||||
|
||||
NS_IMETHOD DoTransaction(void);
|
||||
|
||||
NS_IMETHOD UndoTransaction(void);
|
||||
|
||||
NS_IMETHOD RedoTransaction(void);
|
||||
|
||||
NS_IMETHOD GetIsTransient(PRBool *aIsTransient);
|
||||
|
||||
NS_IMETHOD Merge(nsITransaction *aTransaction, PRBool *aDidMerge);
|
||||
|
||||
NS_IMETHOD GetTxnDescription(nsAString& aTxnDescription);
|
||||
};
|
||||
|
||||
#define NS_DECL_EDITTXN \
|
||||
NS_IMETHOD DoTransaction(); \
|
||||
NS_IMETHOD UndoTransaction(); \
|
||||
NS_IMETHOD GetTxnDescription(nsAString& aTxnDescription);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -52,11 +52,6 @@ IMETextTxn::IMETextTxn()
|
|||
{
|
||||
}
|
||||
|
||||
IMETextTxn::~IMETextTxn()
|
||||
{
|
||||
mRangeList = do_QueryInterface(nsnull);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP IMETextTxn::Init(nsIDOMCharacterData *aElement,
|
||||
PRUint32 aOffset,
|
||||
PRUint32 aReplaceLength,
|
||||
|
|
|
@ -63,8 +63,6 @@ class IMETextTxn : public EditTxn
|
|||
public:
|
||||
static const nsIID& GetCID() { static const nsIID iid = IME_TEXT_TXN_CID; return iid; }
|
||||
|
||||
virtual ~IMETextTxn();
|
||||
|
||||
/** initialize the transaction
|
||||
* @param aElement the text content node
|
||||
* @param aOffset the location in aElement to do the insertion
|
||||
|
@ -84,15 +82,10 @@ private:
|
|||
IMETextTxn();
|
||||
|
||||
public:
|
||||
|
||||
NS_IMETHOD DoTransaction(void);
|
||||
|
||||
NS_IMETHOD UndoTransaction(void);
|
||||
NS_DECL_EDITTXN
|
||||
|
||||
NS_IMETHOD Merge(nsITransaction *aTransaction, PRBool *aDidMerge);
|
||||
|
||||
NS_IMETHOD GetTxnDescription(nsAString& aTxnDescription);
|
||||
|
||||
NS_IMETHOD MarkFixed(void);
|
||||
|
||||
// nsISupports declarations
|
||||
|
|
|
@ -70,10 +70,6 @@ NS_IMETHODIMP InsertElementTxn::Init(nsIDOMNode *aNode,
|
|||
}
|
||||
|
||||
|
||||
InsertElementTxn::~InsertElementTxn()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP InsertElementTxn::DoTransaction(void)
|
||||
{
|
||||
#ifdef NS_DEBUG
|
||||
|
@ -148,13 +144,6 @@ NS_IMETHODIMP InsertElementTxn::UndoTransaction(void)
|
|||
return mParent->RemoveChild(mNode, getter_AddRefs(resultNode));
|
||||
}
|
||||
|
||||
NS_IMETHODIMP InsertElementTxn::Merge(nsITransaction *aTransaction, PRBool *aDidMerge)
|
||||
{
|
||||
if (aDidMerge)
|
||||
*aDidMerge = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP InsertElementTxn::GetTxnDescription(nsAString& aString)
|
||||
{
|
||||
aString.AssignLiteral("InsertElementTxn");
|
||||
|
|
|
@ -71,16 +71,7 @@ private:
|
|||
InsertElementTxn();
|
||||
|
||||
public:
|
||||
|
||||
virtual ~InsertElementTxn();
|
||||
|
||||
NS_IMETHOD DoTransaction(void);
|
||||
|
||||
NS_IMETHOD UndoTransaction(void);
|
||||
|
||||
NS_IMETHOD Merge(nsITransaction *aTransaction, PRBool *aDidMerge);
|
||||
|
||||
NS_IMETHOD GetTxnDescription(nsAString& aTxnDescription);
|
||||
NS_DECL_EDITTXN
|
||||
|
||||
protected:
|
||||
|
||||
|
|
|
@ -49,10 +49,6 @@ InsertTextTxn::InsertTextTxn()
|
|||
{
|
||||
}
|
||||
|
||||
InsertTextTxn::~InsertTextTxn()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP InsertTextTxn::Init(nsIDOMCharacterData *aElement,
|
||||
PRUint32 aOffset,
|
||||
const nsAString &aStringToInsert,
|
||||
|
|
|
@ -48,8 +48,6 @@
|
|||
0x93276f00, 0xab2c, 0x11d2, \
|
||||
{0x8f, 0xb4, 0x0, 0x60, 0x8, 0x15, 0x9b, 0xc} }
|
||||
|
||||
class nsIPresShell;
|
||||
|
||||
/**
|
||||
* A transaction that inserts text into a content node.
|
||||
*/
|
||||
|
@ -59,8 +57,6 @@ public:
|
|||
|
||||
static const nsIID& GetCID() { static const nsIID iid = INSERT_TEXT_TXN_CID; return iid; }
|
||||
|
||||
virtual ~InsertTextTxn();
|
||||
|
||||
/** initialize the transaction
|
||||
* @param aElement the text content node
|
||||
* @param aOffset the location in aElement to do the insertion
|
||||
|
@ -78,14 +74,10 @@ private:
|
|||
|
||||
public:
|
||||
|
||||
NS_IMETHOD DoTransaction(void);
|
||||
|
||||
NS_IMETHOD UndoTransaction(void);
|
||||
NS_DECL_EDITTXN
|
||||
|
||||
NS_IMETHOD Merge(nsITransaction *aTransaction, PRBool *aDidMerge);
|
||||
|
||||
NS_IMETHOD GetTxnDescription(nsAString& aTxnDescription);
|
||||
|
||||
// nsISupports declarations
|
||||
|
||||
// override QueryInterface to handle InsertTextTxn request
|
||||
|
|
|
@ -62,10 +62,6 @@ NS_IMETHODIMP JoinElementTxn::Init(nsEditor *aEditor,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
JoinElementTxn::~JoinElementTxn()
|
||||
{
|
||||
}
|
||||
|
||||
// After DoTransaction() and RedoTransaction(), the left node is removed from the content tree and right node remains.
|
||||
NS_IMETHODIMP JoinElementTxn::DoTransaction(void)
|
||||
{
|
||||
|
@ -162,20 +158,6 @@ NS_IMETHODIMP JoinElementTxn::UndoTransaction(void)
|
|||
|
||||
}
|
||||
|
||||
NS_IMETHODIMP JoinElementTxn::GetIsTransient(PRBool *aIsTransient)
|
||||
{
|
||||
if (aIsTransient)
|
||||
*aIsTransient = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult JoinElementTxn::Merge(nsITransaction *aTransaction, PRBool *aDidMerge)
|
||||
{
|
||||
if (aDidMerge)
|
||||
*aDidMerge = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP JoinElementTxn::GetTxnDescription(nsAString& aString)
|
||||
{
|
||||
aString.AssignLiteral("JoinElementTxn");
|
||||
|
|
|
@ -75,20 +75,7 @@ protected:
|
|||
JoinElementTxn();
|
||||
|
||||
public:
|
||||
|
||||
virtual ~JoinElementTxn();
|
||||
|
||||
NS_IMETHOD DoTransaction(void);
|
||||
|
||||
NS_IMETHOD UndoTransaction(void);
|
||||
|
||||
// NS_IMETHOD RedoTransaction(void);
|
||||
|
||||
NS_IMETHOD GetIsTransient(PRBool *aIsTransient);
|
||||
|
||||
NS_IMETHOD Merge(nsITransaction *aTransaction, PRBool *aDidMerge);
|
||||
|
||||
NS_IMETHOD GetTxnDescription(nsAString& aTxnDescription);
|
||||
NS_DECL_EDITTXN
|
||||
|
||||
protected:
|
||||
|
||||
|
|
|
@ -52,31 +52,8 @@ PlaceholderTxn::PlaceholderTxn() : EditAggregateTxn(),
|
|||
}
|
||||
|
||||
|
||||
PlaceholderTxn::~PlaceholderTxn()
|
||||
{
|
||||
delete mStartSel;
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(PlaceholderTxn, EditAggregateTxn)
|
||||
NS_IMPL_RELEASE_INHERITED(PlaceholderTxn, EditAggregateTxn)
|
||||
|
||||
//NS_IMPL_QUERY_INTERFACE_INHERITED1(Class, Super, AdditionalInterface)
|
||||
NS_IMETHODIMP PlaceholderTxn::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
{
|
||||
if (!aInstancePtr) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
if (aIID.Equals(NS_GET_IID(nsIAbsorbingTransaction))) {
|
||||
*aInstancePtr = (nsISupports*)(nsIAbsorbingTransaction*)(this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(NS_GET_IID(nsISupportsWeakReference))) {
|
||||
*aInstancePtr = (nsISupports*)(nsISupportsWeakReference*) this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
return EditAggregateTxn::QueryInterface(aIID, aInstancePtr);
|
||||
}
|
||||
NS_IMPL_ISUPPORTS_INHERITED2(PlaceholderTxn, EditAggregateTxn,
|
||||
nsIAbsorbingTransaction, nsISupportsWeakReference)
|
||||
|
||||
NS_IMETHODIMP PlaceholderTxn::Init(nsIAtom *aName, nsSelectionState *aSelState, nsIEditor *aEditor)
|
||||
{
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
#include "nsCOMPtr.h"
|
||||
#include "nsWeakPtr.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsAutoPtr.h"
|
||||
|
||||
#define PLACEHOLDER_TXN_CID \
|
||||
{/* {0CE9FB00-D9D1-11d2-86DE-000064657374} */ \
|
||||
|
@ -75,21 +76,13 @@ private:
|
|||
PlaceholderTxn();
|
||||
|
||||
public:
|
||||
|
||||
virtual ~PlaceholderTxn();
|
||||
|
||||
// ------------ EditAggregateTxn -----------------------
|
||||
|
||||
NS_IMETHOD DoTransaction(void);
|
||||
|
||||
NS_IMETHOD UndoTransaction(void);
|
||||
|
||||
NS_IMETHOD RedoTransaction(void);
|
||||
NS_DECL_EDITTXN
|
||||
|
||||
NS_IMETHOD RedoTransaction();
|
||||
NS_IMETHOD Merge(nsITransaction *aTransaction, PRBool *aDidMerge);
|
||||
|
||||
NS_IMETHOD GetTxnDescription(nsAString& aTxnDescription);
|
||||
|
||||
// ------------ nsIAbsorbingTransaction -----------------------
|
||||
|
||||
NS_IMETHOD Init(nsIAtom *aName, nsSelectionState *aSelState, nsIEditor *aEditor);
|
||||
|
@ -120,7 +113,7 @@ protected:
|
|||
// selection at the start of the txn is stored, as is the selection at the end.
|
||||
// This is so that UndoTransaction() and RedoTransaction() can restore the
|
||||
// selection properly.
|
||||
nsSelectionState *mStartSel; // use a pointer because this is constructed before we exist
|
||||
nsAutoPtr<nsSelectionState> mStartSel; // use a pointer because this is constructed before we exist
|
||||
nsSelectionState mEndSel;
|
||||
nsIEditor* mEditor; /** the editor for this transaction */
|
||||
};
|
||||
|
|
|
@ -64,10 +64,6 @@ NS_IMETHODIMP SetDocTitleTxn::Init(nsIHTMLEditor *aEditor,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
SetDocTitleTxn::~SetDocTitleTxn()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP SetDocTitleTxn::DoTransaction(void)
|
||||
{
|
||||
nsresult res = SetDomTitle(mValue);
|
||||
|
@ -217,13 +213,6 @@ nsresult SetDocTitleTxn::SetDomTitle(const nsAString& aTitle)
|
|||
return res;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP SetDocTitleTxn::Merge(nsITransaction *aTransaction, PRBool *aDidMerge)
|
||||
{
|
||||
if (aDidMerge)
|
||||
*aDidMerge = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP SetDocTitleTxn::GetTxnDescription(nsAString& aString)
|
||||
{
|
||||
aString.AssignLiteral("SetDocTitleTxn: ");
|
||||
|
|
|
@ -60,9 +60,6 @@ public:
|
|||
|
||||
static const nsIID& GetCID() { static const nsIID iid = SET_DOC_TITLE_TXN_CID; return iid; }
|
||||
|
||||
virtual ~SetDocTitleTxn();
|
||||
|
||||
|
||||
/** Initialize the transaction.
|
||||
* @param aEditor the object providing core editing operations
|
||||
* @param aValue the new value for document title
|
||||
|
@ -75,18 +72,11 @@ private:
|
|||
nsresult SetDomTitle(const nsAString& aTitle);
|
||||
|
||||
public:
|
||||
NS_IMETHOD DoTransaction(void);
|
||||
|
||||
NS_IMETHOD UndoTransaction(void);
|
||||
|
||||
NS_IMETHOD RedoTransaction(void);
|
||||
|
||||
NS_IMETHOD Merge(nsITransaction *aTransaction, PRBool *aDidMerge);
|
||||
NS_DECL_EDITTXN
|
||||
|
||||
NS_IMETHOD RedoTransaction();
|
||||
NS_IMETHOD GetIsTransient(PRBool *aIsTransient);
|
||||
|
||||
NS_IMETHOD GetTxnDescription(nsAString& aTxnDescription);
|
||||
|
||||
protected:
|
||||
|
||||
/** the editor that created this transaction */
|
||||
|
|
|
@ -65,10 +65,6 @@ NS_IMETHODIMP SplitElementTxn::Init(nsEditor *aEditor,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
SplitElementTxn::~SplitElementTxn()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP SplitElementTxn::DoTransaction(void)
|
||||
{
|
||||
#ifdef NS_DEBUG
|
||||
|
@ -213,13 +209,6 @@ NS_IMETHODIMP SplitElementTxn::RedoTransaction(void)
|
|||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP SplitElementTxn::Merge(nsITransaction *aTransaction, PRBool *aDidMerge)
|
||||
{
|
||||
if (aDidMerge)
|
||||
*aDidMerge = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP SplitElementTxn::GetTxnDescription(nsAString& aString)
|
||||
{
|
||||
aString.AssignLiteral("SplitElementTxn");
|
||||
|
|
|
@ -74,18 +74,10 @@ protected:
|
|||
SplitElementTxn();
|
||||
|
||||
public:
|
||||
virtual ~SplitElementTxn();
|
||||
|
||||
NS_IMETHOD DoTransaction(void);
|
||||
|
||||
NS_IMETHOD UndoTransaction(void);
|
||||
NS_DECL_EDITTXN
|
||||
|
||||
NS_IMETHOD RedoTransaction(void);
|
||||
|
||||
NS_IMETHOD Merge(nsITransaction *aTransaction, PRBool *aDidMerge);
|
||||
|
||||
NS_IMETHOD GetTxnDescription(nsAString& aTxnDescription);
|
||||
|
||||
NS_IMETHOD GetNewNode(nsIDOMNode **aNewNode);
|
||||
|
||||
protected:
|
||||
|
|
|
@ -79,10 +79,6 @@ AddStyleSheetTxn::AddStyleSheetTxn()
|
|||
{
|
||||
}
|
||||
|
||||
AddStyleSheetTxn::~AddStyleSheetTxn()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
AddStyleSheetTxn::Init(nsIEditor *aEditor, nsICSSStyleSheet *aSheet)
|
||||
{
|
||||
|
@ -119,23 +115,6 @@ AddStyleSheetTxn::UndoTransaction()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
AddStyleSheetTxn::RedoTransaction()
|
||||
{
|
||||
return DoTransaction();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
AddStyleSheetTxn::Merge(nsITransaction *aTransaction, PRBool *aDidMerge)
|
||||
{
|
||||
// set out param default value
|
||||
if (!aDidMerge)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
*aDidMerge = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
AddStyleSheetTxn::GetTxnDescription(nsAString& aString)
|
||||
{
|
||||
|
@ -154,10 +133,6 @@ RemoveStyleSheetTxn::RemoveStyleSheetTxn()
|
|||
{
|
||||
}
|
||||
|
||||
RemoveStyleSheetTxn::~RemoveStyleSheetTxn()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
RemoveStyleSheetTxn::Init(nsIEditor *aEditor, nsICSSStyleSheet *aSheet)
|
||||
{
|
||||
|
@ -194,23 +169,6 @@ RemoveStyleSheetTxn::UndoTransaction()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
RemoveStyleSheetTxn::RedoTransaction()
|
||||
{
|
||||
return DoTransaction();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
RemoveStyleSheetTxn::Merge(nsITransaction *aTransaction, PRBool *aDidMerge)
|
||||
{
|
||||
// set out param default value
|
||||
if (!aDidMerge)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
*aDidMerge = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
RemoveStyleSheetTxn::GetTxnDescription(nsAString& aString)
|
||||
{
|
||||
|
|
|
@ -60,8 +60,6 @@ public:
|
|||
|
||||
static const nsIID& GetCID() { static const nsIID iid = ADD_STYLESHEET_TXN_CID; return iid; }
|
||||
|
||||
virtual ~AddStyleSheetTxn();
|
||||
|
||||
/** Initialize the transaction.
|
||||
* @param aEditor the object providing core editing operations
|
||||
* @param aSheet the stylesheet to add
|
||||
|
@ -73,16 +71,7 @@ private:
|
|||
AddStyleSheetTxn();
|
||||
|
||||
public:
|
||||
|
||||
NS_IMETHOD DoTransaction(void);
|
||||
|
||||
NS_IMETHOD UndoTransaction(void);
|
||||
|
||||
NS_IMETHOD RedoTransaction(void);
|
||||
|
||||
NS_IMETHOD Merge(nsITransaction *aTransaction, PRBool *aDidMerge);
|
||||
|
||||
NS_IMETHOD GetTxnDescription(nsAString& aTxnDescription);
|
||||
NS_DECL_EDITTXN
|
||||
|
||||
protected:
|
||||
|
||||
|
@ -100,8 +89,6 @@ public:
|
|||
|
||||
static const nsIID& GetCID() { static const nsIID iid = REMOVE_STYLESHEET_TXN_CID; return iid; }
|
||||
|
||||
virtual ~RemoveStyleSheetTxn();
|
||||
|
||||
/** Initialize the transaction.
|
||||
* @param aEditor the object providing core editing operations
|
||||
* @param aSheet the stylesheet to remove
|
||||
|
@ -113,16 +100,7 @@ private:
|
|||
RemoveStyleSheetTxn();
|
||||
|
||||
public:
|
||||
|
||||
NS_IMETHOD DoTransaction(void);
|
||||
|
||||
NS_IMETHOD UndoTransaction(void);
|
||||
|
||||
NS_IMETHOD RedoTransaction(void);
|
||||
|
||||
NS_IMETHOD Merge(nsITransaction *aTransaction, PRBool *aDidMerge);
|
||||
|
||||
NS_IMETHOD GetTxnDescription(nsAString& aTxnDescription);
|
||||
NS_DECL_EDITTXN
|
||||
|
||||
protected:
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче