First pass checkin of the JavaScript editor logging mechanism. All changes are

ifdef'd with ENABLE_JS_EDITOR_LOG.


git-svn-id: svn://10.0.0.236/trunk@34611 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
kin%netscape.com
1999-06-10 19:41:40 +00:00
parent 9dec3904ca
commit 87f40affc1
7 changed files with 611 additions and 10 deletions

View File

@@ -54,6 +54,10 @@
#include "nsIContentIterator.h"
#include "nsLayoutCID.h"
#ifdef ENABLE_JS_EDITOR_LOG
#include "nsJSEditorLog.h"
#endif // ENABLE_JS_EDITOR_LOG
// transactions the editor knows how to build
#include "TransactionFactory.h"
#include "EditAggregateTxn.h"
@@ -290,6 +294,9 @@ nsEditor::nsEditor()
, mUpdateCount(0)
, mActionListeners(nsnull)
, mDoc(nsnull)
#ifdef ENABLE_JS_EDITOR_LOG
, mJSEditorLog(nsnull)
#endif // ENABLE_JS_EDITOR_LOG
{
//initialize member variables here
NS_INIT_REFCNT();
@@ -320,6 +327,14 @@ nsEditor::~nsEditor()
mActionListeners = 0;
}
#ifdef ENABLE_JS_EDITOR_LOG
if (mJSEditorLog)
{
delete mJSEditorLog;
mJSEditorLog = 0;
}
#endif // ENABLE_JS_EDITOR_LOG
// Release service pointers
if (mPrefs)
nsServiceManager::ReleaseService(kPrefCID, mPrefs);
@@ -518,8 +533,9 @@ nsEditor::Init(nsIDOMDocument *aDoc, nsIPresShell* aPresShell)
}
// #define DEBUG_WITH_JS_EDITOR_LOG
#ifdef DEBUG_WITH_JS_EDITOR_LOG
#include "nsJSEditorLog.h"
// #define DEBUG_WITH_JS_TXN_LOG
#ifdef DEBUG_WITH_JS_TXN_LOG
#include "nsJSTxnLog.h"
#endif
NS_IMETHODIMP
@@ -539,8 +555,8 @@ nsEditor::EnableUndo(PRBool aEnable)
return NS_ERROR_NOT_AVAILABLE;
}
#ifdef DEBUG_WITH_JS_EDITOR_LOG
nsJSEditorLog *log = new nsJSEditorLog();
#ifdef DEBUG_WITH_JS_TXN_LOG
nsJSTxnLog *log = new nsJSTxnLog();
if (log)
{
NS_ADDREF(log);
@@ -548,6 +564,14 @@ nsEditor::EnableUndo(PRBool aEnable)
NS_RELEASE(log);
}
#endif
#ifdef ENABLE_JS_EDITOR_LOG
#ifdef DEBUG_WITH_JS_EDITOR_LOG
mJSEditorLog = new nsJSEditorLog(this);
#endif
#endif // ENABLE_JS_EDITOR_LOG
}
mTxnMgr->SetMaxTransactionCount(-1);
}
@@ -832,6 +856,13 @@ nsEditor::Do(nsITransaction *aTxn)
NS_IMETHODIMP
nsEditor::Undo(PRUint32 aCount)
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->Undo(aCount);
#endif // ENABLE_JS_EDITOR_LOG
if (gNoisy) { printf("Editor::Undo ----------\n"); }
nsresult result = NS_OK;
nsCOMPtr<nsIDOMSelection>selection;
@@ -861,6 +892,13 @@ nsEditor::Undo(PRUint32 aCount)
NS_IMETHODIMP
nsEditor::Redo(PRUint32 aCount)
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->Redo(aCount);
#endif // ENABLE_JS_EDITOR_LOG
if (gNoisy) { printf("Editor::Redo ----------\n"); }
nsresult result = NS_OK;
nsCOMPtr<nsIDOMSelection>selection;
@@ -885,6 +923,13 @@ nsEditor::Redo(PRUint32 aCount)
NS_IMETHODIMP
nsEditor::BeginTransaction()
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->BeginTransaction();
#endif // ENABLE_JS_EDITOR_LOG
NS_PRECONDITION(mUpdateCount>=0, "bad state");
nsCOMPtr<nsIDOMSelection>selection;
@@ -917,6 +962,13 @@ nsEditor::BeginTransaction()
NS_IMETHODIMP
nsEditor::EndTransaction()
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->EndTransaction();
#endif // ENABLE_JS_EDITOR_LOG
NS_PRECONDITION(mUpdateCount>0, "bad state");
if ((nsITransactionManager *)nsnull!=mTxnMgr.get())
@@ -955,6 +1007,13 @@ NS_IMETHODIMP nsEditor::ScrollIntoView(PRBool aScrollToBegin)
// XXX: the rule system should tell us which node to select all on (ie, the root, or the body)
NS_IMETHODIMP nsEditor::SelectAll()
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->SelectAll();
#endif // ENABLE_JS_EDITOR_LOG
if (!mDoc || !mPresShell) { return NS_ERROR_NOT_INITIALIZED; }
nsCOMPtr<nsIDOMSelection> selection;
@@ -990,6 +1049,13 @@ NS_IMETHODIMP nsEditor::SelectAll()
NS_IMETHODIMP nsEditor::Cut()
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->Cut();
#endif // ENABLE_JS_EDITOR_LOG
nsCOMPtr<nsIDOMSelection> selection;
nsresult res = mPresShell->GetSelection(getter_AddRefs(selection));
if (!NS_SUCCEEDED(res))
@@ -1008,6 +1074,13 @@ NS_IMETHODIMP nsEditor::Cut()
NS_IMETHODIMP nsEditor::Copy()
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->Copy();
#endif // ENABLE_JS_EDITOR_LOG
//printf("nsEditor::Copy\n");
return mPresShell->DoCopy();
@@ -1015,6 +1088,13 @@ NS_IMETHODIMP nsEditor::Copy()
NS_IMETHODIMP nsEditor::Paste()
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->Paste();
#endif // ENABLE_JS_EDITOR_LOG
//printf("nsEditor::Paste\n");
nsString stuffToPaste;
@@ -1304,6 +1384,15 @@ NS_IMETHODIMP nsEditor::CreateAggregateTxnForDeleteSelection(nsIAtom *aTxnName,
NS_IMETHODIMP
nsEditor::InsertText(const nsString& aStringToInsert)
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->InsertText(aStringToInsert);
nsAutoEditBatch aeb(this);
#endif // ENABLE_JS_EDITOR_LOG
EditAggregateTxn *aggTxn = nsnull;
// Create the "delete current selection" txn
nsresult result = CreateAggregateTxnForDeleteSelection(InsertTextTxn::gInsertTextTxnName, &aggTxn);
@@ -1673,6 +1762,13 @@ NS_IMETHODIMP nsEditor::DeleteSelectionAndPrepareToCreateNode(nsCOMPtr<nsIDOMNod
NS_IMETHODIMP
nsEditor::DeleteSelection(nsIEditor::ECollapsedSelectionAction aAction)
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->DeleteSelection(aAction);
#endif // ENABLE_JS_EDITOR_LOG
nsresult result;
EditAggregateTxn *txn;

View File

@@ -53,6 +53,10 @@ class nsIStringBundleService;
class nsIStringBundle;
class nsILocale;
#ifdef ENABLE_JS_EDITOR_LOG
class nsJSEditorLog;
#endif // ENABLE_JS_EDITOR_LOG
//This is the monitor for the editor.
PRMonitor *getEditorMonitor();
@@ -77,12 +81,15 @@ private:
nsVoidArray *mActionListeners;
nsCOMPtr<nsIStringBundle> mStringBundle;
protected:
nsIDOMDocument * mDoc;
// Services are not nsCOMPtr friendly
nsIPref* mPrefs;
#ifdef ENABLE_JS_EDITOR_LOG
nsJSEditorLog *mJSEditorLog;
#endif // ENABLE_JS_EDITOR_LOG
public:
enum IterDirection

View File

@@ -47,6 +47,10 @@
#include "nsIDocumentEncoder.h"
#include "nsIPresShell.h"
#ifdef ENABLE_JS_EDITOR_LOG
#include "nsJSEditorLog.h"
#endif // ENABLE_JS_EDITOR_LOG
static NS_DEFINE_IID(kInsertHTMLTxnIID, NS_INSERT_HTML_TXN_IID);
static NS_DEFINE_CID(kEditorCID, NS_EDITOR_CID);
@@ -158,6 +162,13 @@ NS_IMETHODIMP nsHTMLEditor::InsertText(const nsString& aStringToInsert)
NS_IMETHODIMP nsHTMLEditor::SetBackgroundColor(const nsString& aColor)
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->SetBackgroundColor(aColor);
#endif // ENABLE_JS_EDITOR_LOG
nsresult res;
NS_ASSERTION(mDoc, "Missing Editor DOM Document");
@@ -177,6 +188,13 @@ NS_IMETHODIMP nsHTMLEditor::SetBackgroundColor(const nsString& aColor)
NS_IMETHODIMP nsHTMLEditor::SetBodyAttribute(const nsString& aAttribute, const nsString& aValue)
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->SetBodyAttribute(aAttribute, aValue);
#endif // ENABLE_JS_EDITOR_LOG
nsresult res;
// TODO: Check selection for Cell, Row, Column or table and do color on appropriate level
@@ -196,6 +214,13 @@ NS_IMETHODIMP nsHTMLEditor::SetBodyAttribute(const nsString& aAttribute, const n
NS_IMETHODIMP nsHTMLEditor::InsertBreak()
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->InsertBreak();
#endif // ENABLE_JS_EDITOR_LOG
nsresult res;
if (!mRules) { return NS_ERROR_NOT_INITIALIZED; }
@@ -278,6 +303,13 @@ NS_IMETHODIMP nsHTMLEditor::GetParagraphFormat(nsString& aParagraphFormat)
NS_IMETHODIMP nsHTMLEditor::SetParagraphFormat(const nsString& aParagraphFormat)
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->SetParagraphFormat(aParagraphFormat);
#endif // ENABLE_JS_EDITOR_LOG
nsresult res = NS_ERROR_NOT_INITIALIZED;
//Kinda sad to waste memory just to force lower case
nsAutoString tag = aParagraphFormat;
@@ -408,12 +440,26 @@ NS_IMETHODIMP nsHTMLEditor::Paste()
//
NS_IMETHODIMP nsHTMLEditor::PasteAsQuotation()
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->PasteAsQuotation();
#endif // ENABLE_JS_EDITOR_LOG
nsAutoString citation("");
return PasteAsCitedQuotation(citation);
}
NS_IMETHODIMP nsHTMLEditor::PasteAsCitedQuotation(const nsString& aCitation)
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->PasteAsCitedQuotation(aCitation);
#endif // ENABLE_JS_EDITOR_LOG
printf("nsHTMLEditor::PasteAsQuotation\n");
nsAutoEditBatch beginBatching(this);
@@ -456,6 +502,13 @@ NS_IMETHODIMP nsHTMLEditor::PasteAsCitedQuotation(const nsString& aCitation)
NS_IMETHODIMP nsHTMLEditor::InsertAsQuotation(const nsString& aQuotedText)
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->InsertAsQuotation(aQuotedText);
#endif // ENABLE_JS_EDITOR_LOG
nsAutoString citation ("");
return InsertAsCitedQuotation(aQuotedText, citation);
}
@@ -463,6 +516,13 @@ NS_IMETHODIMP nsHTMLEditor::InsertAsQuotation(const nsString& aQuotedText)
NS_IMETHODIMP nsHTMLEditor::InsertAsCitedQuotation(const nsString& aQuotedText,
const nsString& aCitation)
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->InsertAsCitedQuotation(aQuotedText, aCitation);
#endif // ENABLE_JS_EDITOR_LOG
printf("nsHTMLEditor::InsertAsQuotation\n");
nsAutoEditBatch beginBatching(this);
@@ -490,6 +550,13 @@ NS_IMETHODIMP nsHTMLEditor::InsertAsCitedQuotation(const nsString& aQuotedText,
NS_IMETHODIMP nsHTMLEditor::InsertHTML(const nsString& aInputString)
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->InsertHTML(aInputString);
#endif // ENABLE_JS_EDITOR_LOG
nsresult res;
nsAutoEditBatch beginBatching(this);
@@ -720,6 +787,13 @@ nsHTMLEditor::GetParagraphStyle(nsStringArray *aTagList)
NS_IMETHODIMP
nsHTMLEditor::AddBlockParent(nsString& aParentTag)
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->AddBlockParent(aParentTag);
#endif // ENABLE_JS_EDITOR_LOG
if (gNoisy)
{
char *tag = aParentTag.ToNewCString();
@@ -764,6 +838,12 @@ nsHTMLEditor::AddBlockParent(nsString& aParentTag)
NS_IMETHODIMP
nsHTMLEditor::ReplaceBlockParent(nsString& aParentTag)
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->ReplaceBlockParent(aParentTag);
#endif // ENABLE_JS_EDITOR_LOG
if (gNoisy)
{
@@ -1153,6 +1233,13 @@ nsHTMLEditor::ReParentContentOfRange(nsIDOMRange *aRange,
NS_IMETHODIMP
nsHTMLEditor::RemoveParagraphStyle()
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->RemoveParagraphStyle();
#endif // ENABLE_JS_EDITOR_LOG
if (gNoisy) {
printf("---------- nsHTMLEditor::RemoveParagraphStyle ----------\n");
}
@@ -1266,6 +1353,13 @@ nsHTMLEditor::RemoveParagraphStyleFromBlockContent(nsIDOMRange *aRange)
NS_IMETHODIMP
nsHTMLEditor::RemoveParent(const nsString &aParentTag)
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->RemoveParent(aParentTag);
#endif // ENABLE_JS_EDITOR_LOG
if (gNoisy) {
printf("---------- nsHTMLEditor::RemoveParent ----------\n");
}
@@ -1386,6 +1480,13 @@ nsHTMLEditor::RemoveParentFromBlockContent(const nsString &aParentTag, nsIDOMRan
NS_IMETHODIMP
nsHTMLEditor::Indent(const nsString& aIndent)
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->Indent(aIndent);
#endif // ENABLE_JS_EDITOR_LOG
nsAutoEditBatch beginBatching(this);
nsCOMPtr<nsIDOMNode> node;
PRInt32 offset;
@@ -1461,6 +1562,13 @@ nsHTMLEditor::Indent(const nsString& aIndent)
NS_IMETHODIMP
nsHTMLEditor::Align(const nsString& aAlignType)
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->Align(aAlignType);
#endif // ENABLE_JS_EDITOR_LOG
nsAutoEditBatch beginBatching(this);
nsCOMPtr<nsIDOMNode> node;
PRInt32 offset;
@@ -1497,6 +1605,13 @@ nsHTMLEditor::Align(const nsString& aAlignType)
NS_IMETHODIMP
nsHTMLEditor::InsertList(const nsString& aListType)
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->InsertList(aListType);
#endif // ENABLE_JS_EDITOR_LOG
nsresult res;
if (!mRules) { return NS_ERROR_NOT_INITIALIZED; }
@@ -1581,6 +1696,13 @@ nsHTMLEditor::InsertList(const nsString& aListType)
NS_IMETHODIMP
nsHTMLEditor::InsertLink(nsString& aURL)
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->InsertLink(aURL);
#endif // ENABLE_JS_EDITOR_LOG
nsAutoEditBatch beginBatching(this);
// Find out if the selection is collapsed:
@@ -1673,6 +1795,13 @@ nsHTMLEditor::InsertImage(nsString& aURL,
nsString& aAlt,
nsString& aAlignment)
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->InsertImage(aURL, aWidth, aHeight, aHspace, aVspace, aBorder, aAlt, aAlignment);
#endif // ENABLE_JS_EDITOR_LOG
nsresult res;
nsCOMPtr<nsIDOMNode> newNode;
@@ -1935,6 +2064,13 @@ nsHTMLEditor::CreateElementWithDefaults(const nsString& aTagName, nsIDOMElement*
NS_IMETHODIMP
nsHTMLEditor::InsertElement(nsIDOMElement* aElement, PRBool aDeleteSelection, nsIDOMElement** aReturn)
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->InsertElement(aElement, aDeleteSelection, aReturn);
#endif // ENABLE_JS_EDITOR_LOG
nsresult res=NS_ERROR_NOT_INITIALIZED;
if (aReturn)
*aReturn = nsnull;
@@ -1974,6 +2110,13 @@ nsHTMLEditor::InsertElement(nsIDOMElement* aElement, PRBool aDeleteSelection, ns
NS_IMETHODIMP
nsHTMLEditor::InsertLinkAroundSelection(nsIDOMElement* aAnchorElement)
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->InsertLinkAroundSelection(aAnchorElement);
#endif // ENABLE_JS_EDITOR_LOG
nsresult res=NS_ERROR_NULL_POINTER;
nsCOMPtr<nsIDOMSelection> selection;
@@ -2053,6 +2196,13 @@ PRBool nsHTMLEditor::IsElementInBody(nsIDOMElement* aElement)
NS_IMETHODIMP
nsHTMLEditor::SelectElement(nsIDOMElement* aElement)
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->SelectElement(aElement);
#endif // ENABLE_JS_EDITOR_LOG
nsresult res = NS_ERROR_NULL_POINTER;
// Must be sure that element is contained in the document body
@@ -2085,6 +2235,13 @@ nsHTMLEditor::SelectElement(nsIDOMElement* aElement)
NS_IMETHODIMP
nsHTMLEditor::SetCaretAfterElement(nsIDOMElement* aElement)
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->SetCaretAfterElement(aElement);
#endif // ENABLE_JS_EDITOR_LOG
nsresult res = NS_ERROR_NULL_POINTER;
// Must be sure that element is contained in the document body

View File

@@ -92,6 +92,10 @@ static NS_DEFINE_IID(kCXIFFormatConverterCID, NS_XIFFORMATCONVERTER_CID);
#include "nsAOLCiter.h"
#include "nsInternetCiter.h"
#ifdef ENABLE_JS_EDITOR_LOG
#include "nsJSEditorLog.h"
#endif // ENABLE_JS_EDITOR_LOG
static NS_DEFINE_CID(kEditorCID, NS_EDITOR_CID);
static NS_DEFINE_CID(kTextEditorCID, NS_TEXTEDITOR_CID);
static NS_DEFINE_CID(kCContentIteratorCID, NS_CONTENTITERATOR_CID);
@@ -378,6 +382,13 @@ NS_IMETHODIMP nsTextEditor::SetTextProperty(nsIAtom *aProperty,
const nsString *aAttribute,
const nsString *aValue)
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->SetTextProperty(aProperty, aAttribute, aValue);
#endif // ENABLE_JS_EDITOR_LOG
if (!aProperty) { return NS_ERROR_NULL_POINTER; }
if (!mRules) { return NS_ERROR_NOT_INITIALIZED; }
@@ -698,6 +709,13 @@ void nsTextEditor::IsTextPropertySetByContent(nsIDOMNode *aNode,
NS_IMETHODIMP nsTextEditor::RemoveTextProperty(nsIAtom *aProperty, const nsString *aAttribute)
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->RemoveTextProperty(aProperty, aAttribute);
#endif // ENABLE_JS_EDITOR_LOG
if (!aProperty) { return NS_ERROR_NULL_POINTER; }
if (!mRules) { return NS_ERROR_NOT_INITIALIZED; }
@@ -945,6 +963,13 @@ void nsTextEditor::ResetTextSelectionForRange(nsIDOMNode *aParent,
NS_IMETHODIMP nsTextEditor::DeleteSelection(nsIEditor::ECollapsedSelectionAction aAction)
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->DeleteSelection(aAction);
#endif // ENABLE_JS_EDITOR_LOG
if (!mRules) { return NS_ERROR_NOT_INITIALIZED; }
nsCOMPtr<nsIDOMSelection> selection;
@@ -973,6 +998,13 @@ NS_IMETHODIMP nsTextEditor::DeleteSelection(nsIEditor::ECollapsedSelectionAction
NS_IMETHODIMP nsTextEditor::InsertText(const nsString& aStringToInsert)
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->InsertText(aStringToInsert);
#endif // ENABLE_JS_EDITOR_LOG
if (!mRules) { return NS_ERROR_NOT_INITIALIZED; }
nsCOMPtr<nsIDOMSelection> selection;
@@ -1010,6 +1042,13 @@ NS_IMETHODIMP nsTextEditor::SetMaxTextLength(PRInt32 aMaxTextLength)
NS_IMETHODIMP nsTextEditor::InsertBreak()
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->InsertBreak();
#endif // ENABLE_JS_EDITOR_LOG
nsCOMPtr<nsIDOMSelection> selection;
PRBool cancel= PR_FALSE;
@@ -1037,6 +1076,13 @@ NS_IMETHODIMP nsTextEditor::EnableUndo(PRBool aEnable)
NS_IMETHODIMP nsTextEditor::Undo(PRUint32 aCount)
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->Undo(aCount);
#endif // ENABLE_JS_EDITOR_LOG
nsCOMPtr<nsIDOMSelection> selection;
PRBool cancel= PR_FALSE;
@@ -1060,6 +1106,13 @@ NS_IMETHODIMP nsTextEditor::CanUndo(PRBool &aIsEnabled, PRBool &aCanUndo)
NS_IMETHODIMP nsTextEditor::Redo(PRUint32 aCount)
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->Redo(aCount);
#endif // ENABLE_JS_EDITOR_LOG
nsCOMPtr<nsIDOMSelection> selection;
PRBool cancel= PR_FALSE;
@@ -1201,11 +1254,25 @@ NS_IMETHODIMP nsTextEditor::SaveDocument(PRBool saveAs, PRBool saveCopy)
NS_IMETHODIMP nsTextEditor::Save()
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->Save();
#endif // ENABLE_JS_EDITOR_LOG
return SaveDocument(PR_FALSE, PR_FALSE);
}
NS_IMETHODIMP nsTextEditor::SaveAs(PRBool aSavingCopy)
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->SaveAs(aSavingCopy);
#endif // ENABLE_JS_EDITOR_LOG
return SaveDocument(PR_TRUE, aSavingCopy);
}
@@ -1229,6 +1296,13 @@ NS_IMETHODIMP nsTextEditor::Paste()
//
NS_IMETHODIMP nsTextEditor::PasteAsQuotation()
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->PasteAsQuotation();
#endif // ENABLE_JS_EDITOR_LOG
#ifdef DEBUG_akkana
printf("nsTextEditor::PasteAsQuotation\n");
#endif
@@ -1281,6 +1355,13 @@ NS_IMETHODIMP nsTextEditor::PasteAsQuotation()
NS_IMETHODIMP nsTextEditor::InsertAsQuotation(const nsString& aQuotedText)
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->InsertAsQuotation(aQuotedText);
#endif // ENABLE_JS_EDITOR_LOG
// Now we have the text. Cite it appropriately:
nsCOMPtr<nsICiter> citer;
nsCOMPtr<nsIPref> prefs;

View File

@@ -54,6 +54,10 @@
#include "nsIContentIterator.h"
#include "nsLayoutCID.h"
#ifdef ENABLE_JS_EDITOR_LOG
#include "nsJSEditorLog.h"
#endif // ENABLE_JS_EDITOR_LOG
// transactions the editor knows how to build
#include "TransactionFactory.h"
#include "EditAggregateTxn.h"
@@ -290,6 +294,9 @@ nsEditor::nsEditor()
, mUpdateCount(0)
, mActionListeners(nsnull)
, mDoc(nsnull)
#ifdef ENABLE_JS_EDITOR_LOG
, mJSEditorLog(nsnull)
#endif // ENABLE_JS_EDITOR_LOG
{
//initialize member variables here
NS_INIT_REFCNT();
@@ -320,6 +327,14 @@ nsEditor::~nsEditor()
mActionListeners = 0;
}
#ifdef ENABLE_JS_EDITOR_LOG
if (mJSEditorLog)
{
delete mJSEditorLog;
mJSEditorLog = 0;
}
#endif // ENABLE_JS_EDITOR_LOG
// Release service pointers
if (mPrefs)
nsServiceManager::ReleaseService(kPrefCID, mPrefs);
@@ -518,8 +533,9 @@ nsEditor::Init(nsIDOMDocument *aDoc, nsIPresShell* aPresShell)
}
// #define DEBUG_WITH_JS_EDITOR_LOG
#ifdef DEBUG_WITH_JS_EDITOR_LOG
#include "nsJSEditorLog.h"
// #define DEBUG_WITH_JS_TXN_LOG
#ifdef DEBUG_WITH_JS_TXN_LOG
#include "nsJSTxnLog.h"
#endif
NS_IMETHODIMP
@@ -539,8 +555,8 @@ nsEditor::EnableUndo(PRBool aEnable)
return NS_ERROR_NOT_AVAILABLE;
}
#ifdef DEBUG_WITH_JS_EDITOR_LOG
nsJSEditorLog *log = new nsJSEditorLog();
#ifdef DEBUG_WITH_JS_TXN_LOG
nsJSTxnLog *log = new nsJSTxnLog();
if (log)
{
NS_ADDREF(log);
@@ -548,6 +564,14 @@ nsEditor::EnableUndo(PRBool aEnable)
NS_RELEASE(log);
}
#endif
#ifdef ENABLE_JS_EDITOR_LOG
#ifdef DEBUG_WITH_JS_EDITOR_LOG
mJSEditorLog = new nsJSEditorLog(this);
#endif
#endif // ENABLE_JS_EDITOR_LOG
}
mTxnMgr->SetMaxTransactionCount(-1);
}
@@ -832,6 +856,13 @@ nsEditor::Do(nsITransaction *aTxn)
NS_IMETHODIMP
nsEditor::Undo(PRUint32 aCount)
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->Undo(aCount);
#endif // ENABLE_JS_EDITOR_LOG
if (gNoisy) { printf("Editor::Undo ----------\n"); }
nsresult result = NS_OK;
nsCOMPtr<nsIDOMSelection>selection;
@@ -861,6 +892,13 @@ nsEditor::Undo(PRUint32 aCount)
NS_IMETHODIMP
nsEditor::Redo(PRUint32 aCount)
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->Redo(aCount);
#endif // ENABLE_JS_EDITOR_LOG
if (gNoisy) { printf("Editor::Redo ----------\n"); }
nsresult result = NS_OK;
nsCOMPtr<nsIDOMSelection>selection;
@@ -885,6 +923,13 @@ nsEditor::Redo(PRUint32 aCount)
NS_IMETHODIMP
nsEditor::BeginTransaction()
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->BeginTransaction();
#endif // ENABLE_JS_EDITOR_LOG
NS_PRECONDITION(mUpdateCount>=0, "bad state");
nsCOMPtr<nsIDOMSelection>selection;
@@ -917,6 +962,13 @@ nsEditor::BeginTransaction()
NS_IMETHODIMP
nsEditor::EndTransaction()
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->EndTransaction();
#endif // ENABLE_JS_EDITOR_LOG
NS_PRECONDITION(mUpdateCount>0, "bad state");
if ((nsITransactionManager *)nsnull!=mTxnMgr.get())
@@ -955,6 +1007,13 @@ NS_IMETHODIMP nsEditor::ScrollIntoView(PRBool aScrollToBegin)
// XXX: the rule system should tell us which node to select all on (ie, the root, or the body)
NS_IMETHODIMP nsEditor::SelectAll()
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->SelectAll();
#endif // ENABLE_JS_EDITOR_LOG
if (!mDoc || !mPresShell) { return NS_ERROR_NOT_INITIALIZED; }
nsCOMPtr<nsIDOMSelection> selection;
@@ -990,6 +1049,13 @@ NS_IMETHODIMP nsEditor::SelectAll()
NS_IMETHODIMP nsEditor::Cut()
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->Cut();
#endif // ENABLE_JS_EDITOR_LOG
nsCOMPtr<nsIDOMSelection> selection;
nsresult res = mPresShell->GetSelection(getter_AddRefs(selection));
if (!NS_SUCCEEDED(res))
@@ -1008,6 +1074,13 @@ NS_IMETHODIMP nsEditor::Cut()
NS_IMETHODIMP nsEditor::Copy()
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->Copy();
#endif // ENABLE_JS_EDITOR_LOG
//printf("nsEditor::Copy\n");
return mPresShell->DoCopy();
@@ -1015,6 +1088,13 @@ NS_IMETHODIMP nsEditor::Copy()
NS_IMETHODIMP nsEditor::Paste()
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->Paste();
#endif // ENABLE_JS_EDITOR_LOG
//printf("nsEditor::Paste\n");
nsString stuffToPaste;
@@ -1304,6 +1384,15 @@ NS_IMETHODIMP nsEditor::CreateAggregateTxnForDeleteSelection(nsIAtom *aTxnName,
NS_IMETHODIMP
nsEditor::InsertText(const nsString& aStringToInsert)
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->InsertText(aStringToInsert);
nsAutoEditBatch aeb(this);
#endif // ENABLE_JS_EDITOR_LOG
EditAggregateTxn *aggTxn = nsnull;
// Create the "delete current selection" txn
nsresult result = CreateAggregateTxnForDeleteSelection(InsertTextTxn::gInsertTextTxnName, &aggTxn);
@@ -1673,6 +1762,13 @@ NS_IMETHODIMP nsEditor::DeleteSelectionAndPrepareToCreateNode(nsCOMPtr<nsIDOMNod
NS_IMETHODIMP
nsEditor::DeleteSelection(nsIEditor::ECollapsedSelectionAction aAction)
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->DeleteSelection(aAction);
#endif // ENABLE_JS_EDITOR_LOG
nsresult result;
EditAggregateTxn *txn;

View File

@@ -53,6 +53,10 @@ class nsIStringBundleService;
class nsIStringBundle;
class nsILocale;
#ifdef ENABLE_JS_EDITOR_LOG
class nsJSEditorLog;
#endif // ENABLE_JS_EDITOR_LOG
//This is the monitor for the editor.
PRMonitor *getEditorMonitor();
@@ -77,12 +81,15 @@ private:
nsVoidArray *mActionListeners;
nsCOMPtr<nsIStringBundle> mStringBundle;
protected:
nsIDOMDocument * mDoc;
// Services are not nsCOMPtr friendly
nsIPref* mPrefs;
#ifdef ENABLE_JS_EDITOR_LOG
nsJSEditorLog *mJSEditorLog;
#endif // ENABLE_JS_EDITOR_LOG
public:
enum IterDirection

View File

@@ -47,6 +47,10 @@
#include "nsIDocumentEncoder.h"
#include "nsIPresShell.h"
#ifdef ENABLE_JS_EDITOR_LOG
#include "nsJSEditorLog.h"
#endif // ENABLE_JS_EDITOR_LOG
static NS_DEFINE_IID(kInsertHTMLTxnIID, NS_INSERT_HTML_TXN_IID);
static NS_DEFINE_CID(kEditorCID, NS_EDITOR_CID);
@@ -158,6 +162,13 @@ NS_IMETHODIMP nsHTMLEditor::InsertText(const nsString& aStringToInsert)
NS_IMETHODIMP nsHTMLEditor::SetBackgroundColor(const nsString& aColor)
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->SetBackgroundColor(aColor);
#endif // ENABLE_JS_EDITOR_LOG
nsresult res;
NS_ASSERTION(mDoc, "Missing Editor DOM Document");
@@ -177,6 +188,13 @@ NS_IMETHODIMP nsHTMLEditor::SetBackgroundColor(const nsString& aColor)
NS_IMETHODIMP nsHTMLEditor::SetBodyAttribute(const nsString& aAttribute, const nsString& aValue)
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->SetBodyAttribute(aAttribute, aValue);
#endif // ENABLE_JS_EDITOR_LOG
nsresult res;
// TODO: Check selection for Cell, Row, Column or table and do color on appropriate level
@@ -196,6 +214,13 @@ NS_IMETHODIMP nsHTMLEditor::SetBodyAttribute(const nsString& aAttribute, const n
NS_IMETHODIMP nsHTMLEditor::InsertBreak()
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->InsertBreak();
#endif // ENABLE_JS_EDITOR_LOG
nsresult res;
if (!mRules) { return NS_ERROR_NOT_INITIALIZED; }
@@ -278,6 +303,13 @@ NS_IMETHODIMP nsHTMLEditor::GetParagraphFormat(nsString& aParagraphFormat)
NS_IMETHODIMP nsHTMLEditor::SetParagraphFormat(const nsString& aParagraphFormat)
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->SetParagraphFormat(aParagraphFormat);
#endif // ENABLE_JS_EDITOR_LOG
nsresult res = NS_ERROR_NOT_INITIALIZED;
//Kinda sad to waste memory just to force lower case
nsAutoString tag = aParagraphFormat;
@@ -408,12 +440,26 @@ NS_IMETHODIMP nsHTMLEditor::Paste()
//
NS_IMETHODIMP nsHTMLEditor::PasteAsQuotation()
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->PasteAsQuotation();
#endif // ENABLE_JS_EDITOR_LOG
nsAutoString citation("");
return PasteAsCitedQuotation(citation);
}
NS_IMETHODIMP nsHTMLEditor::PasteAsCitedQuotation(const nsString& aCitation)
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->PasteAsCitedQuotation(aCitation);
#endif // ENABLE_JS_EDITOR_LOG
printf("nsHTMLEditor::PasteAsQuotation\n");
nsAutoEditBatch beginBatching(this);
@@ -456,6 +502,13 @@ NS_IMETHODIMP nsHTMLEditor::PasteAsCitedQuotation(const nsString& aCitation)
NS_IMETHODIMP nsHTMLEditor::InsertAsQuotation(const nsString& aQuotedText)
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->InsertAsQuotation(aQuotedText);
#endif // ENABLE_JS_EDITOR_LOG
nsAutoString citation ("");
return InsertAsCitedQuotation(aQuotedText, citation);
}
@@ -463,6 +516,13 @@ NS_IMETHODIMP nsHTMLEditor::InsertAsQuotation(const nsString& aQuotedText)
NS_IMETHODIMP nsHTMLEditor::InsertAsCitedQuotation(const nsString& aQuotedText,
const nsString& aCitation)
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->InsertAsCitedQuotation(aQuotedText, aCitation);
#endif // ENABLE_JS_EDITOR_LOG
printf("nsHTMLEditor::InsertAsQuotation\n");
nsAutoEditBatch beginBatching(this);
@@ -490,6 +550,13 @@ NS_IMETHODIMP nsHTMLEditor::InsertAsCitedQuotation(const nsString& aQuotedText,
NS_IMETHODIMP nsHTMLEditor::InsertHTML(const nsString& aInputString)
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->InsertHTML(aInputString);
#endif // ENABLE_JS_EDITOR_LOG
nsresult res;
nsAutoEditBatch beginBatching(this);
@@ -720,6 +787,13 @@ nsHTMLEditor::GetParagraphStyle(nsStringArray *aTagList)
NS_IMETHODIMP
nsHTMLEditor::AddBlockParent(nsString& aParentTag)
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->AddBlockParent(aParentTag);
#endif // ENABLE_JS_EDITOR_LOG
if (gNoisy)
{
char *tag = aParentTag.ToNewCString();
@@ -764,6 +838,12 @@ nsHTMLEditor::AddBlockParent(nsString& aParentTag)
NS_IMETHODIMP
nsHTMLEditor::ReplaceBlockParent(nsString& aParentTag)
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->ReplaceBlockParent(aParentTag);
#endif // ENABLE_JS_EDITOR_LOG
if (gNoisy)
{
@@ -1153,6 +1233,13 @@ nsHTMLEditor::ReParentContentOfRange(nsIDOMRange *aRange,
NS_IMETHODIMP
nsHTMLEditor::RemoveParagraphStyle()
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->RemoveParagraphStyle();
#endif // ENABLE_JS_EDITOR_LOG
if (gNoisy) {
printf("---------- nsHTMLEditor::RemoveParagraphStyle ----------\n");
}
@@ -1266,6 +1353,13 @@ nsHTMLEditor::RemoveParagraphStyleFromBlockContent(nsIDOMRange *aRange)
NS_IMETHODIMP
nsHTMLEditor::RemoveParent(const nsString &aParentTag)
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->RemoveParent(aParentTag);
#endif // ENABLE_JS_EDITOR_LOG
if (gNoisy) {
printf("---------- nsHTMLEditor::RemoveParent ----------\n");
}
@@ -1386,6 +1480,13 @@ nsHTMLEditor::RemoveParentFromBlockContent(const nsString &aParentTag, nsIDOMRan
NS_IMETHODIMP
nsHTMLEditor::Indent(const nsString& aIndent)
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->Indent(aIndent);
#endif // ENABLE_JS_EDITOR_LOG
nsAutoEditBatch beginBatching(this);
nsCOMPtr<nsIDOMNode> node;
PRInt32 offset;
@@ -1461,6 +1562,13 @@ nsHTMLEditor::Indent(const nsString& aIndent)
NS_IMETHODIMP
nsHTMLEditor::Align(const nsString& aAlignType)
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->Align(aAlignType);
#endif // ENABLE_JS_EDITOR_LOG
nsAutoEditBatch beginBatching(this);
nsCOMPtr<nsIDOMNode> node;
PRInt32 offset;
@@ -1497,6 +1605,13 @@ nsHTMLEditor::Align(const nsString& aAlignType)
NS_IMETHODIMP
nsHTMLEditor::InsertList(const nsString& aListType)
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->InsertList(aListType);
#endif // ENABLE_JS_EDITOR_LOG
nsresult res;
if (!mRules) { return NS_ERROR_NOT_INITIALIZED; }
@@ -1581,6 +1696,13 @@ nsHTMLEditor::InsertList(const nsString& aListType)
NS_IMETHODIMP
nsHTMLEditor::InsertLink(nsString& aURL)
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->InsertLink(aURL);
#endif // ENABLE_JS_EDITOR_LOG
nsAutoEditBatch beginBatching(this);
// Find out if the selection is collapsed:
@@ -1673,6 +1795,13 @@ nsHTMLEditor::InsertImage(nsString& aURL,
nsString& aAlt,
nsString& aAlignment)
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->InsertImage(aURL, aWidth, aHeight, aHspace, aVspace, aBorder, aAlt, aAlignment);
#endif // ENABLE_JS_EDITOR_LOG
nsresult res;
nsCOMPtr<nsIDOMNode> newNode;
@@ -1935,6 +2064,13 @@ nsHTMLEditor::CreateElementWithDefaults(const nsString& aTagName, nsIDOMElement*
NS_IMETHODIMP
nsHTMLEditor::InsertElement(nsIDOMElement* aElement, PRBool aDeleteSelection, nsIDOMElement** aReturn)
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->InsertElement(aElement, aDeleteSelection, aReturn);
#endif // ENABLE_JS_EDITOR_LOG
nsresult res=NS_ERROR_NOT_INITIALIZED;
if (aReturn)
*aReturn = nsnull;
@@ -1974,6 +2110,13 @@ nsHTMLEditor::InsertElement(nsIDOMElement* aElement, PRBool aDeleteSelection, ns
NS_IMETHODIMP
nsHTMLEditor::InsertLinkAroundSelection(nsIDOMElement* aAnchorElement)
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->InsertLinkAroundSelection(aAnchorElement);
#endif // ENABLE_JS_EDITOR_LOG
nsresult res=NS_ERROR_NULL_POINTER;
nsCOMPtr<nsIDOMSelection> selection;
@@ -2053,6 +2196,13 @@ PRBool nsHTMLEditor::IsElementInBody(nsIDOMElement* aElement)
NS_IMETHODIMP
nsHTMLEditor::SelectElement(nsIDOMElement* aElement)
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->SelectElement(aElement);
#endif // ENABLE_JS_EDITOR_LOG
nsresult res = NS_ERROR_NULL_POINTER;
// Must be sure that element is contained in the document body
@@ -2085,6 +2235,13 @@ nsHTMLEditor::SelectElement(nsIDOMElement* aElement)
NS_IMETHODIMP
nsHTMLEditor::SetCaretAfterElement(nsIDOMElement* aElement)
{
#ifdef ENABLE_JS_EDITOR_LOG
nsAutoJSEditorLogLock logLock(mJSEditorLog);
if (mJSEditorLog)
mJSEditorLog->SetCaretAfterElement(aElement);
#endif // ENABLE_JS_EDITOR_LOG
nsresult res = NS_ERROR_NULL_POINTER;
// Must be sure that element is contained in the document body