From 181e117cffe2abf616a764d4ea10f1a75312196b Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Thu, 10 Jun 2010 22:46:51 -0400 Subject: [PATCH] Bug 569523 - GetStartNodeAndOffset should take an nsIDOMNode** parameter, instead of nsCOMPtr*; r=roc --- editor/libeditor/base/nsEditor.cpp | 20 +++--- editor/libeditor/base/nsEditor.h | 4 +- editor/libeditor/html/TypeInState.cpp | 4 +- editor/libeditor/html/nsHTMLDataTransfer.cpp | 4 +- editor/libeditor/html/nsHTMLEditRules.cpp | 74 ++++++++++---------- editor/libeditor/html/nsHTMLEditor.cpp | 14 ++-- editor/libeditor/html/nsHTMLEditorStyle.cpp | 2 +- editor/libeditor/text/nsPlaintextEditor.cpp | 4 +- editor/libeditor/text/nsTextEditRules.cpp | 10 +-- 9 files changed, 70 insertions(+), 66 deletions(-) diff --git a/editor/libeditor/base/nsEditor.cpp b/editor/libeditor/base/nsEditor.cpp index 539ab949d7d..d8d28744cd8 100644 --- a/editor/libeditor/base/nsEditor.cpp +++ b/editor/libeditor/base/nsEditor.cpp @@ -2778,9 +2778,9 @@ nsEditor::SplitNodeImpl(nsIDOMNode * aExistingRightNode, // remember some selection points nsCOMPtr selStartNode, selEndNode; PRInt32 selStartOffset, selEndOffset; - result = GetStartNodeAndOffset(selection, address_of(selStartNode), &selStartOffset); + result = GetStartNodeAndOffset(selection, getter_AddRefs(selStartNode), &selStartOffset); if (NS_FAILED(result)) selStartNode = nsnull; // if selection is cleared, remember that - result = GetEndNodeAndOffset(selection, address_of(selEndNode), &selEndOffset); + result = GetEndNodeAndOffset(selection, getter_AddRefs(selEndNode), &selEndOffset); if (NS_FAILED(result)) selStartNode = nsnull; // if selection is cleared, remember that nsCOMPtr resultNode; @@ -2899,9 +2899,9 @@ nsEditor::JoinNodesImpl(nsIDOMNode * aNodeToKeep, // remember some selection points nsCOMPtr selStartNode, selEndNode; PRInt32 selStartOffset, selEndOffset, joinOffset, keepOffset; - result = GetStartNodeAndOffset(selection, address_of(selStartNode), &selStartOffset); + result = GetStartNodeAndOffset(selection, getter_AddRefs(selStartNode), &selStartOffset); if (NS_FAILED(result)) selStartNode = nsnull; - result = GetEndNodeAndOffset(selection, address_of(selEndNode), &selEndOffset); + result = GetEndNodeAndOffset(selection, getter_AddRefs(selEndNode), &selEndOffset); // Joe or Kin should comment here on why the following line is not a copy/paste error if (NS_FAILED(result)) selStartNode = nsnull; @@ -3886,12 +3886,14 @@ nsEditor::GetChildAt(nsIDOMNode *aParent, PRInt32 aOffset) // the first range in the selection. nsresult nsEditor::GetStartNodeAndOffset(nsISelection *aSelection, - nsCOMPtr *outStartNode, + nsIDOMNode **outStartNode, PRInt32 *outStartOffset) { if (!outStartNode || !outStartOffset || !aSelection) return NS_ERROR_NULL_POINTER; + *outStartNode = nsnull; + // brade: set outStartNode to null or ? nsCOMPtrselPrivate(do_QueryInterface(aSelection)); @@ -3909,7 +3911,7 @@ nsEditor::GetStartNodeAndOffset(nsISelection *aSelection, if (!range) return NS_ERROR_FAILURE; - if (NS_FAILED(range->GetStartContainer(getter_AddRefs(*outStartNode)))) + if (NS_FAILED(range->GetStartContainer(outStartNode))) return NS_ERROR_FAILURE; if (NS_FAILED(range->GetStartOffset(outStartOffset))) @@ -3924,11 +3926,13 @@ nsEditor::GetStartNodeAndOffset(nsISelection *aSelection, // the first range in the selection. nsresult nsEditor::GetEndNodeAndOffset(nsISelection *aSelection, - nsCOMPtr *outEndNode, + nsIDOMNode **outEndNode, PRInt32 *outEndOffset) { if (!outEndNode || !outEndOffset) return NS_ERROR_NULL_POINTER; + + *outEndNode = nsnull; nsCOMPtrselPrivate(do_QueryInterface(aSelection)); nsCOMPtr enumerator; @@ -3945,7 +3949,7 @@ nsEditor::GetEndNodeAndOffset(nsISelection *aSelection, if (!range) return NS_ERROR_FAILURE; - if (NS_FAILED(range->GetEndContainer(getter_AddRefs(*outEndNode)))) + if (NS_FAILED(range->GetEndContainer(outEndNode))) return NS_ERROR_FAILURE; if (NS_FAILED(range->GetEndOffset(outEndOffset))) diff --git a/editor/libeditor/base/nsEditor.h b/editor/libeditor/base/nsEditor.h index d95494fc028..34c0fdac98d 100644 --- a/editor/libeditor/base/nsEditor.h +++ b/editor/libeditor/base/nsEditor.h @@ -535,8 +535,8 @@ public: static PRInt32 GetIndexOf(nsIDOMNode *aParent, nsIDOMNode *aChild); static nsCOMPtr GetChildAt(nsIDOMNode *aParent, PRInt32 aOffset); - static nsresult GetStartNodeAndOffset(nsISelection *aSelection, nsCOMPtr *outStartNode, PRInt32 *outStartOffset); - static nsresult GetEndNodeAndOffset(nsISelection *aSelection, nsCOMPtr *outEndNode, PRInt32 *outEndOffset); + static nsresult GetStartNodeAndOffset(nsISelection *aSelection, nsIDOMNode **outStartNode, PRInt32 *outStartOffset); + static nsresult GetEndNodeAndOffset(nsISelection *aSelection, nsIDOMNode **outEndNode, PRInt32 *outEndOffset); #if DEBUG_JOE static void DumpNode(nsIDOMNode *aNode, PRInt32 indent=0); #endif diff --git a/editor/libeditor/html/TypeInState.cpp b/editor/libeditor/html/TypeInState.cpp index f93e2efb1c4..c6ebe6ff427 100644 --- a/editor/libeditor/html/TypeInState.cpp +++ b/editor/libeditor/html/TypeInState.cpp @@ -78,7 +78,7 @@ nsresult TypeInState::UpdateSelState(nsISelection *aSelection) if (isCollapsed) { - result = nsEditor::GetStartNodeAndOffset(aSelection, address_of(mLastSelectionContainer), &mLastSelectionOffset); + result = nsEditor::GetStartNodeAndOffset(aSelection, getter_AddRefs(mLastSelectionContainer), &mLastSelectionOffset); } return result; } @@ -108,7 +108,7 @@ NS_IMETHODIMP TypeInState::NotifySelectionChanged(nsIDOMDocument *, nsISelection nsCOMPtr selNode; PRInt32 selOffset = 0; - result = nsEditor::GetStartNodeAndOffset(aSelection, address_of(selNode), &selOffset); + result = nsEditor::GetStartNodeAndOffset(aSelection, getter_AddRefs(selNode), &selOffset); if (NS_FAILED(result)) return result; diff --git a/editor/libeditor/html/nsHTMLDataTransfer.cpp b/editor/libeditor/html/nsHTMLDataTransfer.cpp index 12ef224eacb..b5234b0d0c8 100644 --- a/editor/libeditor/html/nsHTMLDataTransfer.cpp +++ b/editor/libeditor/html/nsHTMLDataTransfer.cpp @@ -295,7 +295,7 @@ nsHTMLEditor::InsertHTMLWithContext(const nsAString & aInputString, { // if caller didn't provide the destination/target node, // fetch the paste insertion point from our selection - res = GetStartNodeAndOffset(selection, address_of(targetNode), &targetOffset); + res = GetStartNodeAndOffset(selection, getter_AddRefs(targetNode), &targetOffset); if (!targetNode) res = NS_ERROR_FAILURE; if (NS_FAILED(res)) return res; } @@ -417,7 +417,7 @@ nsHTMLEditor::InsertHTMLWithContext(const nsAString & aInputString, { // The rules code (WillDoAction above) might have changed the selection. // refresh our memory... - res = GetStartNodeAndOffset(selection, address_of(parentNode), &offsetOfNewNode); + res = GetStartNodeAndOffset(selection, getter_AddRefs(parentNode), &offsetOfNewNode); if (!parentNode) res = NS_ERROR_FAILURE; if (NS_FAILED(res)) return res; diff --git a/editor/libeditor/html/nsHTMLEditRules.cpp b/editor/libeditor/html/nsHTMLEditRules.cpp index 24e0e5b50fc..337c05ed59e 100644 --- a/editor/libeditor/html/nsHTMLEditRules.cpp +++ b/editor/libeditor/html/nsHTMLEditRules.cpp @@ -334,13 +334,13 @@ nsHTMLEditRules::BeforeEdit(PRInt32 action, nsIEditor::EDirection aDirection) // get the selection start location nsCOMPtr selStartNode, selEndNode; PRInt32 selOffset; - res = mHTMLEditor->GetStartNodeAndOffset(selection, address_of(selStartNode), &selOffset); + res = mHTMLEditor->GetStartNodeAndOffset(selection, getter_AddRefs(selStartNode), &selOffset); if (NS_FAILED(res)) return res; mRangeItem.startNode = selStartNode; mRangeItem.startOffset = selOffset; // get the selection end location - res = mHTMLEditor->GetEndNodeAndOffset(selection, address_of(selEndNode), &selOffset); + res = mHTMLEditor->GetEndNodeAndOffset(selection, getter_AddRefs(selEndNode), &selOffset); if (NS_FAILED(res)) return res; mRangeItem.endNode = selEndNode; mRangeItem.endOffset = selOffset; @@ -861,7 +861,7 @@ nsHTMLEditRules::GetAlignment(PRBool *aMixed, nsIHTMLEditor::EAlignment *aAlign) PRInt32 offset, rootOffset; res = nsEditor::GetNodeLocation(rootElem, address_of(parent), &rootOffset); if (NS_FAILED(res)) return res; - res = mHTMLEditor->GetStartNodeAndOffset(selection, address_of(parent), &offset); + res = mHTMLEditor->GetStartNodeAndOffset(selection, getter_AddRefs(parent), &offset); if (NS_FAILED(res)) return res; // is the selection collapsed? @@ -1076,7 +1076,7 @@ nsHTMLEditRules::GetIndentState(PRBool *aCanIndent, PRBool *aCanOutdent) if (!selection) return NS_ERROR_NULL_POINTER; // test start parent hierarchy - res = mHTMLEditor->GetStartNodeAndOffset(selection, address_of(parent), &selOffset); + res = mHTMLEditor->GetStartNodeAndOffset(selection, getter_AddRefs(parent), &selOffset); if (NS_FAILED(res)) return res; while (parent && (parent!=root)) { @@ -1090,7 +1090,7 @@ nsHTMLEditRules::GetIndentState(PRBool *aCanIndent, PRBool *aCanOutdent) } // test end parent hierarchy - res = mHTMLEditor->GetEndNodeAndOffset(selection, address_of(parent), &selOffset); + res = mHTMLEditor->GetEndNodeAndOffset(selection, getter_AddRefs(parent), &selOffset); if (NS_FAILED(res)) return res; while (parent && (parent!=root)) { @@ -1153,7 +1153,7 @@ nsHTMLEditRules::GetParagraphState(PRBool *aMixed, nsAString &outFormat) nsCOMPtrselection; res = mHTMLEditor->GetSelection(getter_AddRefs(selection)); if (NS_FAILED(res)) return res; - res = mHTMLEditor->GetStartNodeAndOffset(selection, address_of(selNode), &selOffset); + res = mHTMLEditor->GetStartNodeAndOffset(selection, getter_AddRefs(selNode), &selOffset); if (NS_FAILED(res)) return res; if (!selNode) return NS_ERROR_NULL_POINTER; arrayOfNodes.AppendObject(selNode); @@ -1298,7 +1298,7 @@ nsHTMLEditRules::WillInsert(nsISelection *aSelection, PRBool *aCancel) nsCOMPtr selNode, priorNode; PRInt32 selOffset; // get the (collapsed) selection location - res = mHTMLEditor->GetStartNodeAndOffset(aSelection, address_of(selNode), + res = mHTMLEditor->GetStartNodeAndOffset(aSelection, getter_AddRefs(selNode), &selOffset); if (NS_FAILED(res)) return res; // get prior node @@ -1390,7 +1390,7 @@ nsHTMLEditRules::WillInsertText(PRInt32 aAction, *aCancel = PR_FALSE; // get the (collapsed) selection location - res = mHTMLEditor->GetStartNodeAndOffset(aSelection, address_of(selNode), &selOffset); + res = mHTMLEditor->GetStartNodeAndOffset(aSelection, getter_AddRefs(selNode), &selOffset); if (NS_FAILED(res)) return res; // dont put text in places that can't have it @@ -1612,7 +1612,7 @@ nsHTMLEditRules::WillInsertBreak(nsISelection *aSelection, PRBool *aCancel, PRBo nsCOMPtr node; PRInt32 offset; - res = mHTMLEditor->GetStartNodeAndOffset(aSelection, address_of(node), &offset); + res = mHTMLEditor->GetStartNodeAndOffset(aSelection, getter_AddRefs(node), &offset); if (NS_FAILED(res)) return res; if (!node) return NS_ERROR_FAILURE; @@ -1795,7 +1795,7 @@ nsHTMLEditRules::SplitMailCites(nsISelection *aSelection, PRBool aPlaintext, PRB nsCOMPtr selPriv(do_QueryInterface(aSelection)); nsCOMPtr citeNode, selNode, leftCite, rightCite; PRInt32 selOffset, newOffset; - nsresult res = mHTMLEditor->GetStartNodeAndOffset(aSelection, address_of(selNode), &selOffset); + nsresult res = mHTMLEditor->GetStartNodeAndOffset(aSelection, getter_AddRefs(selNode), &selOffset); if (NS_FAILED(res)) return res; res = GetTopEnclosingMailCite(selNode, address_of(citeNode), aPlaintext); if (NS_FAILED(res)) return res; @@ -1940,7 +1940,7 @@ nsHTMLEditRules::WillDeleteSelection(nsISelection *aSelection, } } - res = mHTMLEditor->GetStartNodeAndOffset(aSelection, address_of(startNode), &startOffset); + res = mHTMLEditor->GetStartNodeAndOffset(aSelection, getter_AddRefs(startNode), &startOffset); if (NS_FAILED(res)) return res; if (!startNode) return NS_ERROR_FAILURE; @@ -1968,7 +1968,7 @@ nsHTMLEditRules::WillDeleteSelection(nsISelection *aSelection, return NS_OK; // ExtendSelectionForDelete() may have changed the selection, update it - res = mHTMLEditor->GetStartNodeAndOffset(aSelection, address_of(startNode), &startOffset); + res = mHTMLEditor->GetStartNodeAndOffset(aSelection, getter_AddRefs(startNode), &startOffset); if (NS_FAILED(res)) return res; if (!startNode) return NS_ERROR_FAILURE; @@ -2346,12 +2346,12 @@ nsHTMLEditRules::WillDeleteSelection(nsISelection *aSelection, mDidRangedDelete = PR_TRUE; // refresh start and end points - res = mHTMLEditor->GetStartNodeAndOffset(aSelection, address_of(startNode), &startOffset); + res = mHTMLEditor->GetStartNodeAndOffset(aSelection, getter_AddRefs(startNode), &startOffset); if (NS_FAILED(res)) return res; if (!startNode) return NS_ERROR_FAILURE; nsCOMPtr endNode; PRInt32 endOffset; - res = mHTMLEditor->GetEndNodeAndOffset(aSelection, address_of(endNode), &endOffset); + res = mHTMLEditor->GetEndNodeAndOffset(aSelection, getter_AddRefs(endNode), &endOffset); if (NS_FAILED(res)) return res; if (!endNode) return NS_ERROR_FAILURE; @@ -2581,7 +2581,7 @@ nsHTMLEditRules::InsertBRIfNeeded(nsISelection *aSelection) // get selection nsCOMPtr node; PRInt32 offset; - nsresult res = mEditor->GetStartNodeAndOffset(aSelection, address_of(node), &offset); + nsresult res = mEditor->GetStartNodeAndOffset(aSelection, getter_AddRefs(node), &offset); if (NS_FAILED(res)) return res; if (!node) return NS_ERROR_FAILURE; @@ -2984,7 +2984,7 @@ nsHTMLEditRules::DidDeleteSelection(nsISelection *aSelection, // find where we are nsCOMPtr startNode; PRInt32 startOffset; - nsresult res = mEditor->GetStartNodeAndOffset(aSelection, address_of(startNode), &startOffset); + nsresult res = mEditor->GetStartNodeAndOffset(aSelection, getter_AddRefs(startNode), &startOffset); if (NS_FAILED(res)) return res; if (!startNode) return NS_ERROR_FAILURE; @@ -3093,7 +3093,7 @@ nsHTMLEditRules::WillMakeList(nsISelection *aSelection, } // get selection location - res = mHTMLEditor->GetStartNodeAndOffset(aSelection, address_of(parent), &offset); + res = mHTMLEditor->GetStartNodeAndOffset(aSelection, getter_AddRefs(parent), &offset); if (NS_FAILED(res)) return res; // make sure we can put a list here @@ -3460,7 +3460,7 @@ nsHTMLEditRules::WillMakeBasicBlock(nsISelection *aSelection, PRInt32 offset; // get selection location - res = mHTMLEditor->GetStartNodeAndOffset(aSelection, address_of(parent), &offset); + res = mHTMLEditor->GetStartNodeAndOffset(aSelection, getter_AddRefs(parent), &offset); if (NS_FAILED(res)) return res; if (tString.EqualsLiteral("normal") || tString.IsEmpty() ) // we are removing blocks (going to "body text") @@ -3562,7 +3562,7 @@ nsHTMLEditRules::DidMakeBasicBlock(nsISelection *aSelection, nsCOMPtr parent; PRInt32 offset; - res = nsEditor::GetStartNodeAndOffset(aSelection, address_of(parent), &offset); + res = nsEditor::GetStartNodeAndOffset(aSelection, getter_AddRefs(parent), &offset); if (NS_FAILED(res)) return res; res = InsertMozBRIfNeeded(parent); return res; @@ -3614,7 +3614,7 @@ nsHTMLEditRules::WillCSSIndent(nsISelection *aSelection, PRBool *aCancel, PRBool { nsCOMPtr node, block; PRInt32 offset; - nsresult res = mHTMLEditor->GetStartNodeAndOffset(aSelection, address_of(node), &offset); + nsresult res = mHTMLEditor->GetStartNodeAndOffset(aSelection, getter_AddRefs(node), &offset); if (NS_FAILED(res)) return res; if (IsBlockNode(node)) block = node; @@ -3646,7 +3646,7 @@ nsHTMLEditRules::WillCSSIndent(nsISelection *aSelection, PRBool *aCancel, PRBool PRInt32 offset; nsAutoString quoteType(NS_LITERAL_STRING("div")); // get selection location - res = mHTMLEditor->GetStartNodeAndOffset(aSelection, address_of(parent), &offset); + res = mHTMLEditor->GetStartNodeAndOffset(aSelection, getter_AddRefs(parent), &offset); if (NS_FAILED(res)) return res; // make sure we can put a block here res = SplitAsNeeded("eType, address_of(parent), &offset); @@ -3829,7 +3829,7 @@ nsHTMLEditRules::WillHTMLIndent(nsISelection *aSelection, PRBool *aCancel, PRBoo PRInt32 offset; // get selection location - res = mHTMLEditor->GetStartNodeAndOffset(aSelection, address_of(parent), &offset); + res = mHTMLEditor->GetStartNodeAndOffset(aSelection, getter_AddRefs(parent), &offset); if (NS_FAILED(res)) return res; // make sure we can put a block here res = SplitAsNeeded("eType, address_of(parent), &offset); @@ -4247,7 +4247,7 @@ nsHTMLEditRules::WillOutdent(nsISelection *aSelection, PRBool *aCancel, PRBool * // push selection past end of rememberedLeftBQ nsCOMPtr sNode; PRInt32 sOffset; - mHTMLEditor->GetStartNodeAndOffset(aSelection, address_of(sNode), &sOffset); + mHTMLEditor->GetStartNodeAndOffset(aSelection, getter_AddRefs(sNode), &sOffset); if (rememberedLeftBQ && ((sNode == rememberedLeftBQ) || nsEditorUtils::IsDescendantOf(sNode, rememberedLeftBQ))) { @@ -4257,7 +4257,7 @@ nsHTMLEditRules::WillOutdent(nsISelection *aSelection, PRBool *aCancel, PRBool * aSelection->Collapse(sNode, sOffset); } // and pull selection before beginning of rememberedRightBQ - mHTMLEditor->GetStartNodeAndOffset(aSelection, address_of(sNode), &sOffset); + mHTMLEditor->GetStartNodeAndOffset(aSelection, getter_AddRefs(sNode), &sOffset); if (rememberedRightBQ && ((sNode == rememberedRightBQ) || nsEditorUtils::IsDescendantOf(sNode, rememberedRightBQ))) { @@ -4419,7 +4419,7 @@ nsHTMLEditRules::CreateStyleForInsertText(nsISelection *aSelection, nsIDOMDocume PRBool weDidSometing = PR_FALSE; nsCOMPtr node, tmp; PRInt32 offset; - nsresult res = mHTMLEditor->GetStartNodeAndOffset(aSelection, address_of(node), &offset); + nsresult res = mHTMLEditor->GetStartNodeAndOffset(aSelection, getter_AddRefs(node), &offset); NS_ENSURE_SUCCESS(res, res); nsAutoPtr item; @@ -4690,7 +4690,7 @@ nsHTMLEditRules::WillAlign(nsISelection *aSelection, nsCOMPtr parent; PRInt32 offset; - res = mHTMLEditor->GetStartNodeAndOffset(aSelection, address_of(parent), &offset); + res = mHTMLEditor->GetStartNodeAndOffset(aSelection, getter_AddRefs(parent), &offset); if (!nsHTMLEditUtils::IsTableElement(parent) || nsHTMLEditUtils::IsTableCellOrCaption(parent)) emptyDiv = PR_TRUE; @@ -4701,7 +4701,7 @@ nsHTMLEditRules::WillAlign(nsISelection *aSelection, PRInt32 offset; nsCOMPtr brNode, parent, theDiv, sib; NS_NAMED_LITERAL_STRING(divType, "div"); - res = mHTMLEditor->GetStartNodeAndOffset(aSelection, address_of(parent), &offset); + res = mHTMLEditor->GetStartNodeAndOffset(aSelection, getter_AddRefs(parent), &offset); if (NS_FAILED(res)) return res; res = SplitAsNeeded(&divType, address_of(parent), &offset); if (NS_FAILED(res)) return res; @@ -7432,7 +7432,7 @@ nsHTMLEditRules::ReapplyCachedStyles() if (NS_FAILED(res)) return res; nsCOMPtr selNode; PRInt32 selOffset; - res = mHTMLEditor->GetStartNodeAndOffset(selection, address_of(selNode), &selOffset); + res = mHTMLEditor->GetStartNodeAndOffset(selection, getter_AddRefs(selNode), &selOffset); if (NS_FAILED(res)) return res; res = NS_OK; @@ -7523,7 +7523,7 @@ nsHTMLEditRules::AdjustWhitespace(nsISelection *aSelection) // get selection point nsCOMPtr selNode; PRInt32 selOffset; - nsresult res = mHTMLEditor->GetStartNodeAndOffset(aSelection, address_of(selNode), &selOffset); + nsresult res = mHTMLEditor->GetStartNodeAndOffset(aSelection, getter_AddRefs(selNode), &selOffset); if (NS_FAILED(res)) return res; // ask whitespace object to tweak nbsp's @@ -7542,7 +7542,7 @@ nsHTMLEditRules::PinSelectionToNewBlock(nsISelection *aSelection) // get the (collapsed) selection location nsCOMPtr selNode, temp; PRInt32 selOffset; - res = mHTMLEditor->GetStartNodeAndOffset(aSelection, address_of(selNode), &selOffset); + res = mHTMLEditor->GetStartNodeAndOffset(aSelection, getter_AddRefs(selNode), &selOffset); if (NS_FAILED(res)) return res; temp = selNode; @@ -7614,7 +7614,7 @@ nsHTMLEditRules::CheckInterlinePosition(nsISelection *aSelection) // get the (collapsed) selection location nsCOMPtr selNode, node; PRInt32 selOffset; - res = mHTMLEditor->GetStartNodeAndOffset(aSelection, address_of(selNode), &selOffset); + res = mHTMLEditor->GetStartNodeAndOffset(aSelection, getter_AddRefs(selNode), &selOffset); if (NS_FAILED(res)) return res; // are we after a block? If so try set caret to following content @@ -7658,7 +7658,7 @@ nsHTMLEditRules::AdjustSelection(nsISelection *aSelection, nsIEditor::EDirection // get the (collapsed) selection location nsCOMPtr selNode, temp; PRInt32 selOffset; - res = mHTMLEditor->GetStartNodeAndOffset(aSelection, address_of(selNode), &selOffset); + res = mHTMLEditor->GetStartNodeAndOffset(aSelection, getter_AddRefs(selNode), &selOffset); if (NS_FAILED(res)) return res; temp = selNode; @@ -8278,7 +8278,7 @@ nsHTMLEditRules::ConfirmSelectionInBody() // get the selection start location nsCOMPtr selNode, temp, parent; PRInt32 selOffset; - res = mHTMLEditor->GetStartNodeAndOffset(selection, address_of(selNode), &selOffset); + res = mHTMLEditor->GetStartNodeAndOffset(selection, getter_AddRefs(selNode), &selOffset); if (NS_FAILED(res)) return res; temp = selNode; @@ -8298,7 +8298,7 @@ nsHTMLEditRules::ConfirmSelectionInBody() } // get the selection end location - res = mHTMLEditor->GetEndNodeAndOffset(selection, address_of(selNode), &selOffset); + res = mHTMLEditor->GetEndNodeAndOffset(selection, getter_AddRefs(selNode), &selOffset); if (NS_FAILED(res)) return res; temp = selNode; @@ -8591,11 +8591,11 @@ nsHTMLEditRules::WillDeleteSelection(nsISelection *aSelection) nsCOMPtr selNode; PRInt32 selOffset; - nsresult res = mHTMLEditor->GetStartNodeAndOffset(aSelection, address_of(selNode), &selOffset); + nsresult res = mHTMLEditor->GetStartNodeAndOffset(aSelection, getter_AddRefs(selNode), &selOffset); if (NS_FAILED(res)) return res; res = mUtilRange->SetStart(selNode, selOffset); if (NS_FAILED(res)) return res; - res = mHTMLEditor->GetEndNodeAndOffset(aSelection, address_of(selNode), &selOffset); + res = mHTMLEditor->GetEndNodeAndOffset(aSelection, getter_AddRefs(selNode), &selOffset); if (NS_FAILED(res)) return res; res = mUtilRange->SetEnd(selNode, selOffset); if (NS_FAILED(res)) return res; @@ -8975,7 +8975,7 @@ nsHTMLEditRules::WillAbsolutePosition(nsISelection *aSelection, PRBool *aCancel, PRInt32 offset; // get selection location - res = mHTMLEditor->GetStartNodeAndOffset(aSelection, address_of(parent), &offset); + res = mHTMLEditor->GetStartNodeAndOffset(aSelection, getter_AddRefs(parent), &offset); if (NS_FAILED(res)) return res; // make sure we can put a block here res = SplitAsNeeded(&divType, address_of(parent), &offset); diff --git a/editor/libeditor/html/nsHTMLEditor.cpp b/editor/libeditor/html/nsHTMLEditor.cpp index 34554cc8f55..9da8155f45f 100644 --- a/editor/libeditor/html/nsHTMLEditor.cpp +++ b/editor/libeditor/html/nsHTMLEditor.cpp @@ -581,7 +581,7 @@ nsHTMLEditor::HandleKeyPressEvent(nsIDOMKeyEvent* aKeyEvent) NS_ENSURE_SUCCESS(rv, rv); PRInt32 offset; nsCOMPtr node, blockParent; - rv = GetStartNodeAndOffset(selection, address_of(node), &offset); + rv = GetStartNodeAndOffset(selection, getter_AddRefs(node), &offset); NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_TRUE(node, NS_ERROR_FAILURE); @@ -1546,7 +1546,7 @@ NS_IMETHODIMP nsHTMLEditor::InsertBR(nsCOMPtr *outBRNode) } nsCOMPtr selNode; PRInt32 selOffset; - res = GetStartNodeAndOffset(selection, address_of(selNode), &selOffset); + res = GetStartNodeAndOffset(selection, getter_AddRefs(selNode), &selOffset); if (NS_FAILED(res)) return res; res = CreateBR(selNode, selOffset, outBRNode); @@ -2233,7 +2233,7 @@ nsHTMLEditor::GetCSSBackgroundColorState(PRBool *aMixed, nsAString &aOutColor, P // get selection location nsCOMPtr parent; PRInt32 offset; - res = GetStartNodeAndOffset(selection, address_of(parent), &offset); + res = GetStartNodeAndOffset(selection, getter_AddRefs(parent), &offset); if (NS_FAILED(res)) return res; if (!parent) return NS_ERROR_NULL_POINTER; @@ -2458,7 +2458,7 @@ nsHTMLEditor::MakeOrChangeList(const nsAString& aListType, PRBool entireList, co nsCOMPtr node; PRInt32 offset; - res = GetStartNodeAndOffset(selection, address_of(node), &offset); + res = GetStartNodeAndOffset(selection, getter_AddRefs(node), &offset); if (!node) res = NS_ERROR_FAILURE; if (NS_FAILED(res)) return res; @@ -2602,7 +2602,7 @@ nsHTMLEditor::InsertBasicBlock(const nsAString& aBlockType) nsCOMPtr node; PRInt32 offset; - res = GetStartNodeAndOffset(selection, address_of(node), &offset); + res = GetStartNodeAndOffset(selection, getter_AddRefs(node), &offset); if (!node) res = NS_ERROR_FAILURE; if (NS_FAILED(res)) return res; @@ -2682,7 +2682,7 @@ nsHTMLEditor::Indent(const nsAString& aIndent) res = selection->GetIsCollapsed(&isCollapsed); if (NS_FAILED(res)) return res; - res = GetStartNodeAndOffset(selection, address_of(node), &offset); + res = GetStartNodeAndOffset(selection, getter_AddRefs(node), &offset); if (!node) res = NS_ERROR_FAILURE; if (NS_FAILED(res)) return res; @@ -2720,7 +2720,7 @@ nsHTMLEditor::Indent(const nsAString& aIndent) res = InsertText(NS_LITERAL_STRING(" ")); if (NS_FAILED(res)) return res; // reposition selection to before the space character - res = GetStartNodeAndOffset(selection, address_of(node), &offset); + res = GetStartNodeAndOffset(selection, getter_AddRefs(node), &offset); if (NS_FAILED(res)) return res; res = selection->Collapse(node,0); if (NS_FAILED(res)) return res; diff --git a/editor/libeditor/html/nsHTMLEditorStyle.cpp b/editor/libeditor/html/nsHTMLEditorStyle.cpp index 97dc06ea873..62ae6d5bc4f 100644 --- a/editor/libeditor/html/nsHTMLEditorStyle.cpp +++ b/editor/libeditor/html/nsHTMLEditorStyle.cpp @@ -1486,7 +1486,7 @@ nsHTMLEditor::RelativeFontChange( PRInt32 aSizeChange) // Let's see in what kind of element the selection is PRInt32 offset; nsCOMPtr selectedNode; - res = GetStartNodeAndOffset(selection, address_of(selectedNode), &offset); + res = GetStartNodeAndOffset(selection, getter_AddRefs(selectedNode), &offset); if (IsTextNode(selectedNode)) { nsCOMPtr parent; res = selectedNode->GetParentNode(getter_AddRefs(parent)); diff --git a/editor/libeditor/text/nsPlaintextEditor.cpp b/editor/libeditor/text/nsPlaintextEditor.cpp index b4836116e5c..8227bc2589c 100644 --- a/editor/libeditor/text/nsPlaintextEditor.cpp +++ b/editor/libeditor/text/nsPlaintextEditor.cpp @@ -564,7 +564,7 @@ NS_IMETHODIMP nsPlaintextEditor::InsertBR(nsCOMPtr *outBRNode) } nsCOMPtr selNode; PRInt32 selOffset; - res = GetStartNodeAndOffset(selection, address_of(selNode), &selOffset); + res = GetStartNodeAndOffset(selection, getter_AddRefs(selNode), &selOffset); if (NS_FAILED(res)) return res; res = CreateBR(selNode, selOffset, outBRNode); @@ -702,7 +702,7 @@ nsPlaintextEditor::ExtendSelectionForDelete(nsISelection *aSelection, // typed character. nsCOMPtr node; PRInt32 offset; - result = GetStartNodeAndOffset(aSelection, address_of(node), &offset); + result = GetStartNodeAndOffset(aSelection, getter_AddRefs(node), &offset); NS_ENSURE_SUCCESS(result, result); NS_ENSURE_TRUE(node, NS_ERROR_FAILURE); diff --git a/editor/libeditor/text/nsTextEditRules.cpp b/editor/libeditor/text/nsTextEditRules.cpp index 02ff60b7fbe..4f878865094 100644 --- a/editor/libeditor/text/nsTextEditRules.cpp +++ b/editor/libeditor/text/nsTextEditRules.cpp @@ -476,7 +476,7 @@ nsTextEditRules::DidInsertBreak(nsISelection *aSelection, nsresult aResult) PRInt32 selOffset; nsCOMPtr selNode; nsresult res; - res = mEditor->GetStartNodeAndOffset(aSelection, address_of(selNode), &selOffset); + res = mEditor->GetStartNodeAndOffset(aSelection, getter_AddRefs(selNode), &selOffset); if (NS_FAILED(res)) return res; // confirm we are at end of document if (selOffset == 0) return NS_OK; // can't be after a br if we are at offset 0 @@ -513,7 +513,7 @@ static inline already_AddRefed GetTextNode(nsISelection *selection, nsEditor *editor) { PRInt32 selOffset; nsCOMPtr selNode; - nsresult res = editor->GetStartNodeAndOffset(selection, address_of(selNode), &selOffset); + nsresult res = editor->GetStartNodeAndOffset(selection, getter_AddRefs(selNode), &selOffset); if (NS_FAILED(res)) return nsnull; if (!editor->IsTextNode(selNode)) { // Get an nsINode from the nsIDOMNode @@ -731,7 +731,7 @@ nsTextEditRules::WillInsertText(PRInt32 aAction, // get the (collapsed) selection location nsCOMPtr selNode; PRInt32 selOffset; - res = mEditor->GetStartNodeAndOffset(aSelection, address_of(selNode), &selOffset); + res = mEditor->GetStartNodeAndOffset(aSelection, getter_AddRefs(selNode), &selOffset); if (NS_FAILED(res)) return res; // don't put text in places that can't have it @@ -1005,7 +1005,7 @@ nsTextEditRules::WillDeleteSelection(nsISelection *aSelection, { nsCOMPtr startNode; PRInt32 startOffset; - res = mEditor->GetStartNodeAndOffset(aSelection, address_of(startNode), &startOffset); + res = mEditor->GetStartNodeAndOffset(aSelection, getter_AddRefs(startNode), &startOffset); if (NS_FAILED(res)) return res; if (!startNode) return NS_ERROR_FAILURE; @@ -1039,7 +1039,7 @@ nsTextEditRules::DidDeleteSelection(nsISelection *aSelection, { nsCOMPtr startNode; PRInt32 startOffset; - nsresult res = mEditor->GetStartNodeAndOffset(aSelection, address_of(startNode), &startOffset); + nsresult res = mEditor->GetStartNodeAndOffset(aSelection, getter_AddRefs(startNode), &startOffset); if (NS_FAILED(res)) return res; if (!startNode) return NS_ERROR_FAILURE;