diff --git a/mozilla/editor/libeditor/base/SetDocTitleTxn.cpp b/mozilla/editor/libeditor/base/SetDocTitleTxn.cpp index 1db8b0eac23..17d8141162e 100644 --- a/mozilla/editor/libeditor/base/SetDocTitleTxn.cpp +++ b/mozilla/editor/libeditor/base/SetDocTitleTxn.cpp @@ -38,7 +38,6 @@ * ***** END LICENSE BLOCK ***** */ #include "SetDocTitleTxn.h" -#include "nsEditor.h" #include "nsIDOMNode.h" #include "nsIDOMNodeList.h" #include "nsIDOMDocument.h" @@ -93,12 +92,11 @@ nsresult SetDocTitleTxn::SetDocTitle(const nsAString& aTitle) NS_ASSERTION(mEditor, "bad state"); if (!mEditor) return NS_ERROR_NOT_INITIALIZED; - nsCOMPtr domDoc; nsCOMPtr editor = do_QueryInterface(mEditor); if (!editor) return NS_ERROR_FAILURE; + nsCOMPtr domDoc; nsresult rv = editor->GetDocument(getter_AddRefs(domDoc)); if (NS_FAILED(rv)) return rv; - if (!domDoc) return NS_ERROR_FAILURE; nsCOMPtr HTMLDoc = do_QueryInterface(domDoc); if (!HTMLDoc) return NS_ERROR_FAILURE; @@ -107,17 +105,13 @@ nsresult SetDocTitleTxn::SetDocTitle(const nsAString& aTitle) nsresult SetDocTitleTxn::SetDomTitle(const nsAString& aTitle) { - nsCOMPtr domDoc; nsCOMPtr editor = do_QueryInterface(mEditor); if (!editor) return NS_ERROR_FAILURE; + nsCOMPtr domDoc; nsresult res = editor->GetDocument(getter_AddRefs(domDoc)); - if (!domDoc) return NS_ERROR_FAILURE; nsCOMPtr titleList; - nsCOMPtrtitleNode; - nsCOMPtrheadNode; - nsCOMPtr resultNode; res = domDoc->GetElementsByTagName(NS_LITERAL_STRING("title"), getter_AddRefs(titleList)); if (NS_FAILED(res)) return res; @@ -125,6 +119,7 @@ nsresult SetDocTitleTxn::SetDomTitle(const nsAString& aTitle) // (transaction will not be pushed on stack) mIsTransient = PR_TRUE; + nsCOMPtrtitleNode; if(titleList) { res = titleList->Item(0, getter_AddRefs(titleNode)); @@ -164,6 +159,7 @@ nsresult SetDocTitleTxn::SetDomTitle(const nsAString& aTitle) if (NS_FAILED(res)) return res; if (!headList) return NS_ERROR_FAILURE; + nsCOMPtrheadNode; headList->Item(0, getter_AddRefs(headNode)); if (!headNode) return NS_ERROR_FAILURE; @@ -197,13 +193,13 @@ nsresult SetDocTitleTxn::SetDomTitle(const nsAString& aTitle) nsCOMPtr textNode; res = domDoc->CreateTextNode(aTitle, getter_AddRefs(textNode)); if (NS_FAILED(res)) return res; - if (!textNode) return NS_ERROR_FAILURE; nsCOMPtr newNode = do_QueryInterface(textNode); if (!newNode) return NS_ERROR_FAILURE; if (newTitleNode) { // Not undoable: We will insert newTitleNode below + nsCOMPtr resultNode; res = titleNode->AppendChild(newNode, getter_AddRefs(resultNode)); } else @@ -224,8 +220,8 @@ nsresult SetDocTitleTxn::SetDomTitle(const nsAString& aTitle) NS_IMETHODIMP SetDocTitleTxn::Merge(nsITransaction *aTransaction, PRBool *aDidMerge) { - if (nsnull!=aDidMerge) - *aDidMerge=PR_FALSE; + if (aDidMerge) + *aDidMerge = PR_FALSE; return NS_OK; } @@ -242,3 +238,4 @@ NS_IMETHODIMP SetDocTitleTxn::GetIsTransient(PRBool *aIsTransient) *aIsTransient = mIsTransient; return NS_OK; } + diff --git a/mozilla/editor/libeditor/base/SplitElementTxn.cpp b/mozilla/editor/libeditor/base/SplitElementTxn.cpp index db3e31e034f..40ab821fa85 100644 --- a/mozilla/editor/libeditor/base/SplitElementTxn.cpp +++ b/mozilla/editor/libeditor/base/SplitElementTxn.cpp @@ -163,8 +163,7 @@ NS_IMETHODIMP SplitElementTxn::RedoTransaction(void) nsresult result; nsCOMPtrresultNode; // first, massage the existing node so it is in its post-split state - nsCOMPtrrightNodeAsText; - rightNodeAsText = do_QueryInterface(mExistingRightNode); + nsCOMPtrrightNodeAsText = do_QueryInterface(mExistingRightNode); if (rightNodeAsText) { result = rightNodeAsText->DeleteData(0, mOffset); @@ -217,8 +216,8 @@ NS_IMETHODIMP SplitElementTxn::RedoTransaction(void) NS_IMETHODIMP SplitElementTxn::Merge(nsITransaction *aTransaction, PRBool *aDidMerge) { - if (nsnull!=aDidMerge) - *aDidMerge=PR_FALSE; + if (aDidMerge) + *aDidMerge = PR_FALSE; return NS_OK; } diff --git a/mozilla/editor/libeditor/base/TransactionFactory.cpp b/mozilla/editor/libeditor/base/TransactionFactory.cpp index d4e28d593f6..6f1aa7e017b 100644 --- a/mozilla/editor/libeditor/base/TransactionFactory.cpp +++ b/mozilla/editor/libeditor/base/TransactionFactory.cpp @@ -110,7 +110,7 @@ TransactionFactory::GetNewTransaction(REFNSIID aTxnType, EditTxn **aResult) else result = NS_ERROR_NO_INTERFACE; - if (NS_SUCCEEDED(result) && nsnull==*aResult) + if (NS_SUCCEEDED(result) && !*aResult) result = NS_ERROR_OUT_OF_MEMORY; if (NS_SUCCEEDED(result)) @@ -119,4 +119,3 @@ TransactionFactory::GetNewTransaction(REFNSIID aTxnType, EditTxn **aResult) return result; } - diff --git a/mozilla/editor/libeditor/base/nsEditorController.cpp b/mozilla/editor/libeditor/base/nsEditorController.cpp index 58a37e383c1..788ba8178d1 100644 --- a/mozilla/editor/libeditor/base/nsEditorController.cpp +++ b/mozilla/editor/libeditor/base/nsEditorController.cpp @@ -41,7 +41,6 @@ #include "nsString.h" #include "nsIComponentManager.h" #include "nsEditorController.h" -#include "nsIEditor.h" #include "nsEditorCommands.h" #include "nsIControllerCommandTable.h" @@ -141,4 +140,3 @@ nsresult nsEditorController::RegisterEditorCommands(nsIControllerCommandTable *i return NS_OK; } -