This commit is contained in:
jfrancis%netscape.com 1999-06-20 23:02:48 +00:00
Родитель d14ba8a859
Коммит 99b76dc78a
4 изменённых файлов: 90 добавлений и 82 удалений

Просмотреть файл

@ -314,7 +314,7 @@ nsresult nsRange::QueryInterface(const nsIID& aIID,
* Private helper routines * Private helper routines
******************************************************/ ******************************************************/
PRBool nsRange::InSameDoc(nsCOMPtr<nsIDOMNode> aNode1, nsCOMPtr<nsIDOMNode> aNode2) PRBool nsRange::InSameDoc(nsIDOMNode* aNode1, nsIDOMNode* aNode2)
{ {
nsCOMPtr<nsIContent> cN1; nsCOMPtr<nsIContent> cN1;
nsCOMPtr<nsIContent> cN2; nsCOMPtr<nsIContent> cN2;
@ -342,7 +342,7 @@ PRBool nsRange::InSameDoc(nsCOMPtr<nsIDOMNode> aNode1, nsCOMPtr<nsIDOMNode> aNod
} }
nsresult nsRange::AddToListOf(nsCOMPtr<nsIDOMNode> aNode) nsresult nsRange::AddToListOf(nsIDOMNode* aNode)
{ {
if (!aNode) if (!aNode)
return NS_ERROR_NULL_POINTER; return NS_ERROR_NULL_POINTER;
@ -358,7 +358,7 @@ nsresult nsRange::AddToListOf(nsCOMPtr<nsIDOMNode> aNode)
} }
nsresult nsRange::RemoveFromListOf(nsCOMPtr<nsIDOMNode> aNode) nsresult nsRange::RemoveFromListOf(nsIDOMNode* aNode)
{ {
if (!aNode) if (!aNode)
return NS_ERROR_NULL_POINTER; return NS_ERROR_NULL_POINTER;
@ -378,8 +378,8 @@ nsresult nsRange::RemoveFromListOf(nsCOMPtr<nsIDOMNode> aNode)
// for content notification of range ownership. // for content notification of range ownership.
// Calling DoSetRange with either parent argument null will collapse // Calling DoSetRange with either parent argument null will collapse
// the range to have both endpoints point to the other node // the range to have both endpoints point to the other node
nsresult nsRange::DoSetRange(nsCOMPtr<nsIDOMNode> aStartN, PRInt32 aStartOffset, nsresult nsRange::DoSetRange(nsIDOMNode* aStartN, PRInt32 aStartOffset,
nsCOMPtr<nsIDOMNode> aEndN, PRInt32 aEndOffset) nsIDOMNode* aEndN, PRInt32 aEndOffset)
{ {
//if only one endpoint is null, set it to the other one //if only one endpoint is null, set it to the other one
if (aStartN && !aEndN) if (aStartN && !aEndN)
@ -432,8 +432,8 @@ nsresult nsRange::DoSetRange(nsCOMPtr<nsIDOMNode> aStartN, PRInt32 aStartOffset,
} }
PRBool nsRange::IsIncreasing(nsCOMPtr<nsIDOMNode> aStartN, PRInt32 aStartOffset, PRBool nsRange::IsIncreasing(nsIDOMNode* aStartN, PRInt32 aStartOffset,
nsCOMPtr<nsIDOMNode> aEndN, PRInt32 aEndOffset) nsIDOMNode* aEndN, PRInt32 aEndOffset)
{ {
PRInt32 numStartAncestors = 0; PRInt32 numStartAncestors = 0;
PRInt32 numEndAncestors = 0; PRInt32 numEndAncestors = 0;
@ -518,7 +518,7 @@ PRBool nsRange::IsIncreasing(nsCOMPtr<nsIDOMNode> aStartN, PRInt32 aStartOffset,
} }
} }
nsresult nsRange::IsPointInRange(nsCOMPtr<nsIDOMNode> aParent, PRInt32 aOffset, PRBool* aResult) nsresult nsRange::IsPointInRange(nsIDOMNode* aParent, PRInt32 aOffset, PRBool* aResult)
{ {
PRInt32 compareResult = 0; PRInt32 compareResult = 0;
nsresult res; nsresult res;
@ -531,7 +531,7 @@ nsresult nsRange::IsPointInRange(nsCOMPtr<nsIDOMNode> aParent, PRInt32 aOffset,
} }
// returns -1 if point is before range, 0 if point is in range, 1 if point is after range // returns -1 if point is before range, 0 if point is in range, 1 if point is after range
nsresult nsRange::ComparePointToRange(nsCOMPtr<nsIDOMNode> aParent, PRInt32 aOffset, PRInt32* aResult) nsresult nsRange::ComparePointToRange(nsIDOMNode* aParent, PRInt32 aOffset, PRInt32* aResult)
{ {
// check arguments // check arguments
if (!aResult) if (!aResult)
@ -617,7 +617,7 @@ PRInt32 nsRange::IndexOf(nsIDOMNode* aChildNode)
return theIndex; return theIndex;
} }
PRInt32 nsRange::FillArrayWithAncestors(nsVoidArray* aArray, nsCOMPtr<nsIDOMNode> aNode) PRInt32 nsRange::FillArrayWithAncestors(nsVoidArray* aArray, nsIDOMNode* aNode)
{ {
PRInt32 i=0; PRInt32 i=0;
nsCOMPtr<nsIDOMNode> node(aNode); nsCOMPtr<nsIDOMNode> node(aNode);
@ -641,7 +641,7 @@ PRInt32 nsRange::FillArrayWithAncestors(nsVoidArray* aArray, nsCOMPtr<nsIDOMNode
return i; return i;
} }
PRInt32 nsRange::GetAncestorsAndOffsets(nsCOMPtr<nsIDOMNode> aNode, PRInt32 aOffset, PRInt32 nsRange::GetAncestorsAndOffsets(nsIDOMNode* aNode, PRInt32 aOffset,
nsVoidArray* aAncestorNodes, nsVoidArray* aAncestorOffsets) nsVoidArray* aAncestorNodes, nsVoidArray* aAncestorOffsets)
{ {
PRInt32 i=0; PRInt32 i=0;
@ -679,7 +679,7 @@ PRInt32 nsRange::GetAncestorsAndOffsets(nsCOMPtr<nsIDOMNode> aNode, PRInt32 aOff
return i; return i;
} }
nsCOMPtr<nsIDOMNode> nsRange::CommonParent(nsCOMPtr<nsIDOMNode> aNode1, nsCOMPtr<nsIDOMNode> aNode2) nsCOMPtr<nsIDOMNode> nsRange::CommonParent(nsIDOMNode* aNode1, nsIDOMNode* aNode2)
{ {
nsCOMPtr<nsIDOMNode> theParent; nsCOMPtr<nsIDOMNode> theParent;
@ -738,7 +738,7 @@ nsCOMPtr<nsIDOMNode> nsRange::CommonParent(nsCOMPtr<nsIDOMNode> aNode1, nsCOMPtr
return theParent; return theParent;
} }
nsresult nsRange::GetDOMNodeFromContent(nsCOMPtr<nsIContent> inContentNode, nsCOMPtr<nsIDOMNode>* outDomNode) nsresult nsRange::GetDOMNodeFromContent(nsIContent* inContentNode, nsCOMPtr<nsIDOMNode>* outDomNode)
{ {
if (!outDomNode) if (!outDomNode)
return NS_ERROR_NULL_POINTER; return NS_ERROR_NULL_POINTER;
@ -748,7 +748,7 @@ nsresult nsRange::GetDOMNodeFromContent(nsCOMPtr<nsIContent> inContentNode, nsCO
return NS_OK; return NS_OK;
} }
nsresult nsRange::GetContentFromDOMNode(nsCOMPtr<nsIDOMNode> inDomNode, nsCOMPtr<nsIContent>* outContentNode) nsresult nsRange::GetContentFromDOMNode(nsIDOMNode* inDomNode, nsCOMPtr<nsIContent>* outContentNode)
{ {
if (!outContentNode) if (!outContentNode)
return NS_ERROR_NULL_POINTER; return NS_ERROR_NULL_POINTER;
@ -758,7 +758,7 @@ nsresult nsRange::GetContentFromDOMNode(nsCOMPtr<nsIDOMNode> inDomNode, nsCOMPtr
return NS_OK; return NS_OK;
} }
nsresult nsRange::PopRanges(nsCOMPtr<nsIDOMNode> aDestNode, PRInt32 aOffset, nsCOMPtr<nsIContent> aSourceNode) nsresult nsRange::PopRanges(nsIDOMNode* aDestNode, PRInt32 aOffset, nsIContent* aSourceNode)
{ {
// utility routine to pop all the range endpoints inside the content subtree defined by // utility routine to pop all the range endpoints inside the content subtree defined by
// aSourceNode, into the node/offset represented by aDestNode/aOffset. // aSourceNode, into the node/offset represented by aDestNode/aOffset.
@ -826,7 +826,7 @@ nsresult nsRange::PopRanges(nsCOMPtr<nsIDOMNode> aDestNode, PRInt32 aOffset, nsC
// sanity check routine for content helpers. confirms that given // sanity check routine for content helpers. confirms that given
// node owns one or both range endpoints. // node owns one or both range endpoints.
nsresult nsRange::ContentOwnsUs(nsCOMPtr<nsIDOMNode> domNode) nsresult nsRange::ContentOwnsUs(nsIDOMNode* domNode)
{ {
NS_PRECONDITION(domNode, "null pointer"); NS_PRECONDITION(domNode, "null pointer");
if ((mStartParent != domNode) && (mEndParent != domNode)) if ((mStartParent != domNode) && (mEndParent != domNode))
@ -1279,10 +1279,10 @@ nsresult nsRange::ExtractContents(nsIDOMDocumentFragment** aReturn)
// - recurse to parent // - recurse to parent
// //
nsresult nsresult
nsRange::CloneSibsAndParents(nsCOMPtr<nsIDOMNode> parentNode, PRInt32 nodeOffset, nsRange::CloneSibsAndParents(nsIDOMNode* aParentNode, PRInt32 nodeOffset,
nsCOMPtr<nsIDOMNode> clonedNode, nsIDOMNode* aClonedNode,
nsCOMPtr<nsIDOMNode> commonParent, nsIDOMNode* aCommonParent,
nsCOMPtr<nsIDOMDocumentFragment> docfrag, nsIDOMDocumentFragment* docfrag,
PRBool leftP) PRBool leftP)
{ {
nsresult res; nsresult res;
@ -1291,11 +1291,15 @@ nsRange::CloneSibsAndParents(nsCOMPtr<nsIDOMNode> parentNode, PRInt32 nodeOffset
return NS_ERROR_INVALID_ARG; return NS_ERROR_INVALID_ARG;
nsCOMPtr<nsIDOMNode> parentClone; nsCOMPtr<nsIDOMNode> parentClone;
if (!parentNode) if (!aParentNode)
{ {
return NS_ERROR_INVALID_ARG; return NS_ERROR_INVALID_ARG;
} }
nsCOMPtr<nsIDOMNode> parentNode = aParentNode;
nsCOMPtr<nsIDOMNode> clonedNode = aClonedNode;
nsCOMPtr<nsIDOMNode> commonParent = aCommonParent;
// Make clone of parent: // Make clone of parent:
if (parentNode == commonParent || !parentNode) if (parentNode == commonParent || !parentNode)
{ {

Просмотреть файл

@ -122,40 +122,40 @@ public:
// helper routines // helper routines
static PRBool InSameDoc(nsCOMPtr<nsIDOMNode> aNode1, nsCOMPtr<nsIDOMNode> aNode2); static PRBool InSameDoc(nsIDOMNode* aNode1, nsIDOMNode* aNode2);
static PRInt32 IndexOf(nsIDOMNode* aNode); static PRInt32 IndexOf(nsIDOMNode* aNode);
static PRInt32 FillArrayWithAncestors(nsVoidArray* aArray,nsCOMPtr<nsIDOMNode> aNode); static PRInt32 FillArrayWithAncestors(nsVoidArray* aArray,nsIDOMNode* aNode);
static nsCOMPtr<nsIDOMNode> CommonParent(nsCOMPtr<nsIDOMNode> aNode1, nsCOMPtr<nsIDOMNode> aNode2); static nsCOMPtr<nsIDOMNode> CommonParent(nsIDOMNode* aNode1, nsIDOMNode* aNode2);
static nsresult GetDOMNodeFromContent(nsCOMPtr<nsIContent> inContentNode, nsCOMPtr<nsIDOMNode>* outDomNode); static nsresult GetDOMNodeFromContent(nsIContent* inContentNode, nsCOMPtr<nsIDOMNode>* outDomNode);
static nsresult GetContentFromDOMNode(nsCOMPtr<nsIDOMNode> inDomNode, nsCOMPtr<nsIContent>* outContentNode); static nsresult GetContentFromDOMNode(nsIDOMNode* inDomNode, nsCOMPtr<nsIContent>* outContentNode);
static nsresult PopRanges(nsCOMPtr<nsIDOMNode> aDestNode, PRInt32 aOffset, nsCOMPtr<nsIContent> aSourceNode); static nsresult PopRanges(nsIDOMNode* aDestNode, PRInt32 aOffset, nsIContent* aSourceNode);
static nsresult CloneSibsAndParents(nsCOMPtr<nsIDOMNode> parentNode, static nsresult CloneSibsAndParents(nsIDOMNode* parentNode,
PRInt32 nodeOffset, PRInt32 nodeOffset,
nsCOMPtr<nsIDOMNode> clonedNode, nsIDOMNode* clonedNode,
nsCOMPtr<nsIDOMNode> commonParent, nsIDOMNode* commonParent,
nsCOMPtr<nsIDOMDocumentFragment> docfrag, nsIDOMDocumentFragment* docfrag,
PRBool leftP); PRBool leftP);
nsresult DoSetRange(nsCOMPtr<nsIDOMNode> aStartN, PRInt32 aStartOffset, nsresult DoSetRange(nsIDOMNode* aStartN, PRInt32 aStartOffset,
nsCOMPtr<nsIDOMNode> aEndN, PRInt32 aEndOffset); nsIDOMNode* aEndN, PRInt32 aEndOffset);
PRBool IsIncreasing(nsCOMPtr<nsIDOMNode> aStartN, PRInt32 aStartOff, PRBool IsIncreasing(nsIDOMNode* aStartN, PRInt32 aStartOff,
nsCOMPtr<nsIDOMNode> aEndN, PRInt32 aEndOff); nsIDOMNode* aEndN, PRInt32 aEndOff);
nsresult IsPointInRange(nsCOMPtr<nsIDOMNode> aParent, PRInt32 aOffset, PRBool* aResult); nsresult IsPointInRange(nsIDOMNode* aParent, PRInt32 aOffset, PRBool* aResult);
nsresult ComparePointToRange(nsCOMPtr<nsIDOMNode> aParent, PRInt32 aOffset, PRInt32* aResult); nsresult ComparePointToRange(nsIDOMNode* aParent, PRInt32 aOffset, PRInt32* aResult);
PRInt32 GetAncestorsAndOffsets(nsCOMPtr<nsIDOMNode> aNode, PRInt32 aOffset, PRInt32 GetAncestorsAndOffsets(nsIDOMNode* aNode, PRInt32 aOffset,
nsVoidArray* aAncestorNodes, nsVoidArray* aAncestorOffsets); nsVoidArray* aAncestorNodes, nsVoidArray* aAncestorOffsets);
nsresult AddToListOf(nsCOMPtr<nsIDOMNode> aNode); nsresult AddToListOf(nsIDOMNode* aNode);
nsresult RemoveFromListOf(nsCOMPtr<nsIDOMNode> aNode); nsresult RemoveFromListOf(nsIDOMNode* aNode);
nsresult ContentOwnsUs(nsCOMPtr<nsIDOMNode> domNode); nsresult ContentOwnsUs(nsIDOMNode* domNode);
protected: protected:
void* mScriptObject; void* mScriptObject;

Просмотреть файл

@ -314,7 +314,7 @@ nsresult nsRange::QueryInterface(const nsIID& aIID,
* Private helper routines * Private helper routines
******************************************************/ ******************************************************/
PRBool nsRange::InSameDoc(nsCOMPtr<nsIDOMNode> aNode1, nsCOMPtr<nsIDOMNode> aNode2) PRBool nsRange::InSameDoc(nsIDOMNode* aNode1, nsIDOMNode* aNode2)
{ {
nsCOMPtr<nsIContent> cN1; nsCOMPtr<nsIContent> cN1;
nsCOMPtr<nsIContent> cN2; nsCOMPtr<nsIContent> cN2;
@ -342,7 +342,7 @@ PRBool nsRange::InSameDoc(nsCOMPtr<nsIDOMNode> aNode1, nsCOMPtr<nsIDOMNode> aNod
} }
nsresult nsRange::AddToListOf(nsCOMPtr<nsIDOMNode> aNode) nsresult nsRange::AddToListOf(nsIDOMNode* aNode)
{ {
if (!aNode) if (!aNode)
return NS_ERROR_NULL_POINTER; return NS_ERROR_NULL_POINTER;
@ -358,7 +358,7 @@ nsresult nsRange::AddToListOf(nsCOMPtr<nsIDOMNode> aNode)
} }
nsresult nsRange::RemoveFromListOf(nsCOMPtr<nsIDOMNode> aNode) nsresult nsRange::RemoveFromListOf(nsIDOMNode* aNode)
{ {
if (!aNode) if (!aNode)
return NS_ERROR_NULL_POINTER; return NS_ERROR_NULL_POINTER;
@ -378,8 +378,8 @@ nsresult nsRange::RemoveFromListOf(nsCOMPtr<nsIDOMNode> aNode)
// for content notification of range ownership. // for content notification of range ownership.
// Calling DoSetRange with either parent argument null will collapse // Calling DoSetRange with either parent argument null will collapse
// the range to have both endpoints point to the other node // the range to have both endpoints point to the other node
nsresult nsRange::DoSetRange(nsCOMPtr<nsIDOMNode> aStartN, PRInt32 aStartOffset, nsresult nsRange::DoSetRange(nsIDOMNode* aStartN, PRInt32 aStartOffset,
nsCOMPtr<nsIDOMNode> aEndN, PRInt32 aEndOffset) nsIDOMNode* aEndN, PRInt32 aEndOffset)
{ {
//if only one endpoint is null, set it to the other one //if only one endpoint is null, set it to the other one
if (aStartN && !aEndN) if (aStartN && !aEndN)
@ -432,8 +432,8 @@ nsresult nsRange::DoSetRange(nsCOMPtr<nsIDOMNode> aStartN, PRInt32 aStartOffset,
} }
PRBool nsRange::IsIncreasing(nsCOMPtr<nsIDOMNode> aStartN, PRInt32 aStartOffset, PRBool nsRange::IsIncreasing(nsIDOMNode* aStartN, PRInt32 aStartOffset,
nsCOMPtr<nsIDOMNode> aEndN, PRInt32 aEndOffset) nsIDOMNode* aEndN, PRInt32 aEndOffset)
{ {
PRInt32 numStartAncestors = 0; PRInt32 numStartAncestors = 0;
PRInt32 numEndAncestors = 0; PRInt32 numEndAncestors = 0;
@ -518,7 +518,7 @@ PRBool nsRange::IsIncreasing(nsCOMPtr<nsIDOMNode> aStartN, PRInt32 aStartOffset,
} }
} }
nsresult nsRange::IsPointInRange(nsCOMPtr<nsIDOMNode> aParent, PRInt32 aOffset, PRBool* aResult) nsresult nsRange::IsPointInRange(nsIDOMNode* aParent, PRInt32 aOffset, PRBool* aResult)
{ {
PRInt32 compareResult = 0; PRInt32 compareResult = 0;
nsresult res; nsresult res;
@ -531,7 +531,7 @@ nsresult nsRange::IsPointInRange(nsCOMPtr<nsIDOMNode> aParent, PRInt32 aOffset,
} }
// returns -1 if point is before range, 0 if point is in range, 1 if point is after range // returns -1 if point is before range, 0 if point is in range, 1 if point is after range
nsresult nsRange::ComparePointToRange(nsCOMPtr<nsIDOMNode> aParent, PRInt32 aOffset, PRInt32* aResult) nsresult nsRange::ComparePointToRange(nsIDOMNode* aParent, PRInt32 aOffset, PRInt32* aResult)
{ {
// check arguments // check arguments
if (!aResult) if (!aResult)
@ -617,7 +617,7 @@ PRInt32 nsRange::IndexOf(nsIDOMNode* aChildNode)
return theIndex; return theIndex;
} }
PRInt32 nsRange::FillArrayWithAncestors(nsVoidArray* aArray, nsCOMPtr<nsIDOMNode> aNode) PRInt32 nsRange::FillArrayWithAncestors(nsVoidArray* aArray, nsIDOMNode* aNode)
{ {
PRInt32 i=0; PRInt32 i=0;
nsCOMPtr<nsIDOMNode> node(aNode); nsCOMPtr<nsIDOMNode> node(aNode);
@ -641,7 +641,7 @@ PRInt32 nsRange::FillArrayWithAncestors(nsVoidArray* aArray, nsCOMPtr<nsIDOMNode
return i; return i;
} }
PRInt32 nsRange::GetAncestorsAndOffsets(nsCOMPtr<nsIDOMNode> aNode, PRInt32 aOffset, PRInt32 nsRange::GetAncestorsAndOffsets(nsIDOMNode* aNode, PRInt32 aOffset,
nsVoidArray* aAncestorNodes, nsVoidArray* aAncestorOffsets) nsVoidArray* aAncestorNodes, nsVoidArray* aAncestorOffsets)
{ {
PRInt32 i=0; PRInt32 i=0;
@ -679,7 +679,7 @@ PRInt32 nsRange::GetAncestorsAndOffsets(nsCOMPtr<nsIDOMNode> aNode, PRInt32 aOff
return i; return i;
} }
nsCOMPtr<nsIDOMNode> nsRange::CommonParent(nsCOMPtr<nsIDOMNode> aNode1, nsCOMPtr<nsIDOMNode> aNode2) nsCOMPtr<nsIDOMNode> nsRange::CommonParent(nsIDOMNode* aNode1, nsIDOMNode* aNode2)
{ {
nsCOMPtr<nsIDOMNode> theParent; nsCOMPtr<nsIDOMNode> theParent;
@ -738,7 +738,7 @@ nsCOMPtr<nsIDOMNode> nsRange::CommonParent(nsCOMPtr<nsIDOMNode> aNode1, nsCOMPtr
return theParent; return theParent;
} }
nsresult nsRange::GetDOMNodeFromContent(nsCOMPtr<nsIContent> inContentNode, nsCOMPtr<nsIDOMNode>* outDomNode) nsresult nsRange::GetDOMNodeFromContent(nsIContent* inContentNode, nsCOMPtr<nsIDOMNode>* outDomNode)
{ {
if (!outDomNode) if (!outDomNode)
return NS_ERROR_NULL_POINTER; return NS_ERROR_NULL_POINTER;
@ -748,7 +748,7 @@ nsresult nsRange::GetDOMNodeFromContent(nsCOMPtr<nsIContent> inContentNode, nsCO
return NS_OK; return NS_OK;
} }
nsresult nsRange::GetContentFromDOMNode(nsCOMPtr<nsIDOMNode> inDomNode, nsCOMPtr<nsIContent>* outContentNode) nsresult nsRange::GetContentFromDOMNode(nsIDOMNode* inDomNode, nsCOMPtr<nsIContent>* outContentNode)
{ {
if (!outContentNode) if (!outContentNode)
return NS_ERROR_NULL_POINTER; return NS_ERROR_NULL_POINTER;
@ -758,7 +758,7 @@ nsresult nsRange::GetContentFromDOMNode(nsCOMPtr<nsIDOMNode> inDomNode, nsCOMPtr
return NS_OK; return NS_OK;
} }
nsresult nsRange::PopRanges(nsCOMPtr<nsIDOMNode> aDestNode, PRInt32 aOffset, nsCOMPtr<nsIContent> aSourceNode) nsresult nsRange::PopRanges(nsIDOMNode* aDestNode, PRInt32 aOffset, nsIContent* aSourceNode)
{ {
// utility routine to pop all the range endpoints inside the content subtree defined by // utility routine to pop all the range endpoints inside the content subtree defined by
// aSourceNode, into the node/offset represented by aDestNode/aOffset. // aSourceNode, into the node/offset represented by aDestNode/aOffset.
@ -826,7 +826,7 @@ nsresult nsRange::PopRanges(nsCOMPtr<nsIDOMNode> aDestNode, PRInt32 aOffset, nsC
// sanity check routine for content helpers. confirms that given // sanity check routine for content helpers. confirms that given
// node owns one or both range endpoints. // node owns one or both range endpoints.
nsresult nsRange::ContentOwnsUs(nsCOMPtr<nsIDOMNode> domNode) nsresult nsRange::ContentOwnsUs(nsIDOMNode* domNode)
{ {
NS_PRECONDITION(domNode, "null pointer"); NS_PRECONDITION(domNode, "null pointer");
if ((mStartParent != domNode) && (mEndParent != domNode)) if ((mStartParent != domNode) && (mEndParent != domNode))
@ -1279,10 +1279,10 @@ nsresult nsRange::ExtractContents(nsIDOMDocumentFragment** aReturn)
// - recurse to parent // - recurse to parent
// //
nsresult nsresult
nsRange::CloneSibsAndParents(nsCOMPtr<nsIDOMNode> parentNode, PRInt32 nodeOffset, nsRange::CloneSibsAndParents(nsIDOMNode* aParentNode, PRInt32 nodeOffset,
nsCOMPtr<nsIDOMNode> clonedNode, nsIDOMNode* aClonedNode,
nsCOMPtr<nsIDOMNode> commonParent, nsIDOMNode* aCommonParent,
nsCOMPtr<nsIDOMDocumentFragment> docfrag, nsIDOMDocumentFragment* docfrag,
PRBool leftP) PRBool leftP)
{ {
nsresult res; nsresult res;
@ -1291,11 +1291,15 @@ nsRange::CloneSibsAndParents(nsCOMPtr<nsIDOMNode> parentNode, PRInt32 nodeOffset
return NS_ERROR_INVALID_ARG; return NS_ERROR_INVALID_ARG;
nsCOMPtr<nsIDOMNode> parentClone; nsCOMPtr<nsIDOMNode> parentClone;
if (!parentNode) if (!aParentNode)
{ {
return NS_ERROR_INVALID_ARG; return NS_ERROR_INVALID_ARG;
} }
nsCOMPtr<nsIDOMNode> parentNode = aParentNode;
nsCOMPtr<nsIDOMNode> clonedNode = aClonedNode;
nsCOMPtr<nsIDOMNode> commonParent = aCommonParent;
// Make clone of parent: // Make clone of parent:
if (parentNode == commonParent || !parentNode) if (parentNode == commonParent || !parentNode)
{ {

Просмотреть файл

@ -122,40 +122,40 @@ public:
// helper routines // helper routines
static PRBool InSameDoc(nsCOMPtr<nsIDOMNode> aNode1, nsCOMPtr<nsIDOMNode> aNode2); static PRBool InSameDoc(nsIDOMNode* aNode1, nsIDOMNode* aNode2);
static PRInt32 IndexOf(nsIDOMNode* aNode); static PRInt32 IndexOf(nsIDOMNode* aNode);
static PRInt32 FillArrayWithAncestors(nsVoidArray* aArray,nsCOMPtr<nsIDOMNode> aNode); static PRInt32 FillArrayWithAncestors(nsVoidArray* aArray,nsIDOMNode* aNode);
static nsCOMPtr<nsIDOMNode> CommonParent(nsCOMPtr<nsIDOMNode> aNode1, nsCOMPtr<nsIDOMNode> aNode2); static nsCOMPtr<nsIDOMNode> CommonParent(nsIDOMNode* aNode1, nsIDOMNode* aNode2);
static nsresult GetDOMNodeFromContent(nsCOMPtr<nsIContent> inContentNode, nsCOMPtr<nsIDOMNode>* outDomNode); static nsresult GetDOMNodeFromContent(nsIContent* inContentNode, nsCOMPtr<nsIDOMNode>* outDomNode);
static nsresult GetContentFromDOMNode(nsCOMPtr<nsIDOMNode> inDomNode, nsCOMPtr<nsIContent>* outContentNode); static nsresult GetContentFromDOMNode(nsIDOMNode* inDomNode, nsCOMPtr<nsIContent>* outContentNode);
static nsresult PopRanges(nsCOMPtr<nsIDOMNode> aDestNode, PRInt32 aOffset, nsCOMPtr<nsIContent> aSourceNode); static nsresult PopRanges(nsIDOMNode* aDestNode, PRInt32 aOffset, nsIContent* aSourceNode);
static nsresult CloneSibsAndParents(nsCOMPtr<nsIDOMNode> parentNode, static nsresult CloneSibsAndParents(nsIDOMNode* parentNode,
PRInt32 nodeOffset, PRInt32 nodeOffset,
nsCOMPtr<nsIDOMNode> clonedNode, nsIDOMNode* clonedNode,
nsCOMPtr<nsIDOMNode> commonParent, nsIDOMNode* commonParent,
nsCOMPtr<nsIDOMDocumentFragment> docfrag, nsIDOMDocumentFragment* docfrag,
PRBool leftP); PRBool leftP);
nsresult DoSetRange(nsCOMPtr<nsIDOMNode> aStartN, PRInt32 aStartOffset, nsresult DoSetRange(nsIDOMNode* aStartN, PRInt32 aStartOffset,
nsCOMPtr<nsIDOMNode> aEndN, PRInt32 aEndOffset); nsIDOMNode* aEndN, PRInt32 aEndOffset);
PRBool IsIncreasing(nsCOMPtr<nsIDOMNode> aStartN, PRInt32 aStartOff, PRBool IsIncreasing(nsIDOMNode* aStartN, PRInt32 aStartOff,
nsCOMPtr<nsIDOMNode> aEndN, PRInt32 aEndOff); nsIDOMNode* aEndN, PRInt32 aEndOff);
nsresult IsPointInRange(nsCOMPtr<nsIDOMNode> aParent, PRInt32 aOffset, PRBool* aResult); nsresult IsPointInRange(nsIDOMNode* aParent, PRInt32 aOffset, PRBool* aResult);
nsresult ComparePointToRange(nsCOMPtr<nsIDOMNode> aParent, PRInt32 aOffset, PRInt32* aResult); nsresult ComparePointToRange(nsIDOMNode* aParent, PRInt32 aOffset, PRInt32* aResult);
PRInt32 GetAncestorsAndOffsets(nsCOMPtr<nsIDOMNode> aNode, PRInt32 aOffset, PRInt32 GetAncestorsAndOffsets(nsIDOMNode* aNode, PRInt32 aOffset,
nsVoidArray* aAncestorNodes, nsVoidArray* aAncestorOffsets); nsVoidArray* aAncestorNodes, nsVoidArray* aAncestorOffsets);
nsresult AddToListOf(nsCOMPtr<nsIDOMNode> aNode); nsresult AddToListOf(nsIDOMNode* aNode);
nsresult RemoveFromListOf(nsCOMPtr<nsIDOMNode> aNode); nsresult RemoveFromListOf(nsIDOMNode* aNode);
nsresult ContentOwnsUs(nsCOMPtr<nsIDOMNode> domNode); nsresult ContentOwnsUs(nsIDOMNode* domNode);
protected: protected:
void* mScriptObject; void* mScriptObject;