From 17efdd55c011a2b40bea81654b11f7fb14174e1c Mon Sep 17 00:00:00 2001 From: "jfrancis%netscape.com" Date: Mon, 8 Mar 1999 01:20:02 +0000 Subject: [PATCH] bug fixes + changing broken "dont_QueryInterface" additions to "do_QueryInterface" --- content/base/src/nsContentIterator.cpp | 45 ++++++++++++++------------ content/base/src/nsRange.cpp | 43 +++++++++++------------- layout/base/src/nsContentIterator.cpp | 45 ++++++++++++++------------ layout/base/src/nsRange.cpp | 43 +++++++++++------------- 4 files changed, 86 insertions(+), 90 deletions(-) diff --git a/content/base/src/nsContentIterator.cpp b/content/base/src/nsContentIterator.cpp index ff28ee787aaf..30eeb5b9b842 100644 --- a/content/base/src/nsContentIterator.cpp +++ b/content/base/src/nsContentIterator.cpp @@ -173,7 +173,7 @@ nsresult nsContentIterator::Init(nsIContent* aRoot) if (!aRoot) return NS_ERROR_NULL_POINTER; - nsCOMPtr root( dont_QueryInterface(aRoot) ); + nsCOMPtr root( do_QueryInterface(aRoot) ); mFirst = GetDeepFirstChild(root); mLast = root; mCommonParent = root; @@ -349,6 +349,7 @@ nsresult nsContentIterator::GetNextSibling(nsCOMPtr aNode, nsCOMPtr< if (!NS_SUCCEEDED(aNode->GetParent(*getter_AddRefs(parent)))) return NS_ERROR_FAILURE; + if (!NS_SUCCEEDED(parent->IndexOf(aNode, indx))) return NS_ERROR_FAILURE; @@ -358,7 +359,7 @@ nsresult nsContentIterator::GetNextSibling(nsCOMPtr aNode, nsCOMPtr< } else if (parent != mCommonParent) { - GetNextSibling(parent, aSibling); + return GetNextSibling(parent, aSibling); } else { @@ -382,6 +383,7 @@ nsresult nsContentIterator::GetPrevSibling(nsCOMPtr aNode, nsCOMPtr< if (!NS_SUCCEEDED(aNode->GetParent(*getter_AddRefs(parent)))) return NS_ERROR_FAILURE; + if (!NS_SUCCEEDED(parent->IndexOf(aNode, indx))) return NS_ERROR_FAILURE; @@ -391,7 +393,7 @@ nsresult nsContentIterator::GetPrevSibling(nsCOMPtr aNode, nsCOMPtr< } else if (parent != mCommonParent) { - GetPrevSibling(parent, aSibling); + return GetPrevSibling(parent, aSibling); } else { @@ -612,7 +614,7 @@ nsresult nsContentSubtreeIterator::Init(nsIDOMRange* aRange) if (!aRange) return NS_ERROR_NULL_POINTER; - mRange = dont_QueryInterface(aRange); + mRange = do_QueryInterface(aRange); // get the start node and offset, convert to nsIContent nsCOMPtr commonParent; @@ -621,7 +623,8 @@ nsresult nsContentSubtreeIterator::Init(nsIDOMRange* aRange) nsCOMPtr cStartP; nsCOMPtr cEndP; nsCOMPtr cN; - nsCOMPtr candidate; + nsCOMPtr firstCandidate; + nsCOMPtr lastCandidate; // get common content parent if (!NS_SUCCEEDED(aRange->GetCommonParent(getter_AddRefs(commonParent))) || !commonParent) @@ -646,7 +649,7 @@ nsresult nsContentSubtreeIterator::Init(nsIDOMRange* aRange) PRInt32 numChildren; cStartP->ChildCount(numChildren); - if (numChildren) // no children, must be a text node + if (!numChildren) // no children, must be a text node { cN = cStartP; } @@ -659,28 +662,28 @@ nsresult nsContentSubtreeIterator::Init(nsIDOMRange* aRange) } else { - candidate = cChild; + firstCandidate = cChild; } } - if (!candidate) + if (!firstCandidate) { - // then candidate is next node after cN - if (!NS_SUCCEEDED(GetNextSibling(cN, &candidate))) + // then firstCandidate is next node after cN + if (!NS_SUCCEEDED(GetNextSibling(cN, &firstCandidate))) { MakeEmpty(); return NS_OK; } } - candidate = GetDeepFirstChild(candidate); + firstCandidate = GetDeepFirstChild(firstCandidate); // confirm that this first possible contained node // is indeed contained. Else we have a range that // does not fully contain any node. PRBool nodeBefore, nodeAfter; - if (!NS_SUCCEEDED(CompareNodeToRange(candidate, aRange, &nodeBefore, &nodeAfter))) + if (!NS_SUCCEEDED(CompareNodeToRange(firstCandidate, aRange, &nodeBefore, &nodeAfter))) return NS_ERROR_FAILURE; if (nodeBefore || nodeAfter) { @@ -691,7 +694,7 @@ nsresult nsContentSubtreeIterator::Init(nsIDOMRange* aRange) // cool, we have the first node in the range. Now we walk // up it's ancestors to find the most senior that is still // in the range. That's the real first node. - if (!NS_SUCCEEDED(GetTopAncestorInRange(candidate, &mFirst))) + if (!NS_SUCCEEDED(GetTopAncestorInRange(firstCandidate, &mFirst))) return NS_ERROR_FAILURE; @@ -706,7 +709,7 @@ nsresult nsContentSubtreeIterator::Init(nsIDOMRange* aRange) { cEndP->ChildCount(numChildren); - if (numChildren) // no children, must be a text node + if (!numChildren) // no children, must be a text node { cN = cEndP; } @@ -720,28 +723,28 @@ nsresult nsContentSubtreeIterator::Init(nsIDOMRange* aRange) } else { - candidate = cChild; + lastCandidate = cChild; } } } - if (!candidate) + if (!lastCandidate) { - // then candidate is prev node before cN - if (!NS_SUCCEEDED(GetPrevSibling(cN, &candidate))) + // then lastCandidate is prev node before cN + if (!NS_SUCCEEDED(GetPrevSibling(cN, &lastCandidate))) { MakeEmpty(); return NS_OK; } } - candidate = GetDeepLastChild(candidate); + lastCandidate = GetDeepLastChild(lastCandidate); // confirm that this first possible contained node // is indeed contained. Else we have a range that // does not fully contain any node. - if (!NS_SUCCEEDED(CompareNodeToRange(candidate, aRange, &nodeBefore, &nodeAfter))) + if (!NS_SUCCEEDED(CompareNodeToRange(lastCandidate, aRange, &nodeBefore, &nodeAfter))) return NS_ERROR_FAILURE; if (nodeBefore || nodeAfter) { @@ -752,7 +755,7 @@ nsresult nsContentSubtreeIterator::Init(nsIDOMRange* aRange) // cool, we have the last node in the range. Now we walk // up it's ancestors to find the most senior that is still // in the range. That's the real first node. - if (!NS_SUCCEEDED(GetTopAncestorInRange(candidate, &mLast))) + if (!NS_SUCCEEDED(GetTopAncestorInRange(lastCandidate, &mLast))) return NS_ERROR_FAILURE; mCurNode = mFirst; diff --git a/content/base/src/nsRange.cpp b/content/base/src/nsRange.cpp index 53220309d758..183867298c7a 100644 --- a/content/base/src/nsRange.cpp +++ b/content/base/src/nsRange.cpp @@ -648,17 +648,12 @@ nsCOMPtr nsRange::CommonParent(nsCOMPtr aNode1, nsCOMPtr // no null nodes please if (!aNode1 || !aNode2) - return nsCOMPtr(); // moral equiv or nsnull + return nsCOMPtr(); // moral equiv of nsnull // shortcut for common case - both nodes are the same if (aNode1 == aNode2) { - // should be able to remove this error check later - nsresult res = aNode1->GetParentNode(getter_AddRefs(theParent)); - if (!NS_SUCCEEDED(res)) - return nsCOMPtr(); // moral equiv or nsnull - - return theParent; + return aNode1; } // otherwise traverse the tree for the common ancestor @@ -673,7 +668,7 @@ nsCOMPtr nsRange::CommonParent(nsCOMPtr aNode1, nsCOMPtr NS_NOTREACHED("nsRange::CommonParent"); delete array1; delete array2; - return nsCOMPtr(); + return nsCOMPtr(); // moral equiv of nsnull } // get ancestors of each node @@ -686,7 +681,7 @@ nsCOMPtr nsRange::CommonParent(nsCOMPtr aNode1, nsCOMPtr NS_NOTREACHED("nsRange::CommonParent"); delete array1; delete array2; - return nsCOMPtr(); + return nsCOMPtr(); // moral equiv of nsnull } // sanity test (for now) - the end of each array @@ -696,7 +691,7 @@ nsCOMPtr nsRange::CommonParent(nsCOMPtr aNode1, nsCOMPtr NS_NOTREACHED("nsRange::CommonParent"); delete array1; delete array2; - return nsCOMPtr(); + return nsCOMPtr(); // moral equiv of nsnull } // back through the ancestors, starting from the root, until @@ -881,7 +876,7 @@ nsresult nsRange::SetStart(nsIDOMNode* aParent, PRInt32 aOffset) if (!aParent) return NS_ERROR_NULL_POINTER; - nsCOMPtrtheParent( dont_QueryInterface(aParent) ); + nsCOMPtrtheParent( do_QueryInterface(aParent) ); // must be in same document as endpoint, else // endpoint is collapsed to new start. @@ -902,7 +897,7 @@ nsresult nsRange::SetStart(nsIDOMNode* aParent, PRInt32 aOffset) nsresult nsRange::SetStartBefore(nsIDOMNode* aSibling) { - nsCOMPtrtheSibling( dont_QueryInterface(aSibling) ); + nsCOMPtrtheSibling( do_QueryInterface(aSibling) ); PRInt32 indx = IndexOf(theSibling); nsIDOMNode *nParent; theSibling->GetParentNode(&nParent); @@ -911,7 +906,7 @@ nsresult nsRange::SetStartBefore(nsIDOMNode* aSibling) nsresult nsRange::SetStartAfter(nsIDOMNode* aSibling) { - nsCOMPtrtheSibling( dont_QueryInterface(aSibling) ); + nsCOMPtrtheSibling( do_QueryInterface(aSibling) ); PRInt32 indx = IndexOf(theSibling) + 1; nsIDOMNode *nParent; theSibling->GetParentNode(&nParent); @@ -924,7 +919,7 @@ nsresult nsRange::SetEnd(nsIDOMNode* aParent, PRInt32 aOffset) if (!aParent) return NS_ERROR_NULL_POINTER; - nsCOMPtrtheParent( dont_QueryInterface(aParent) ); + nsCOMPtrtheParent( do_QueryInterface(aParent) ); // must be in same document as startpoint, else // endpoint is collapsed to new end. @@ -945,7 +940,7 @@ nsresult nsRange::SetEnd(nsIDOMNode* aParent, PRInt32 aOffset) nsresult nsRange::SetEndBefore(nsIDOMNode* aSibling) { - nsCOMPtrtheSibling( dont_QueryInterface(aSibling) ); + nsCOMPtrtheSibling( do_QueryInterface(aSibling) ); PRInt32 indx = IndexOf(theSibling); nsIDOMNode *nParent; theSibling->GetParentNode(&nParent); @@ -954,7 +949,7 @@ nsresult nsRange::SetEndBefore(nsIDOMNode* aSibling) nsresult nsRange::SetEndAfter(nsIDOMNode* aSibling) { - nsCOMPtrtheSibling( dont_QueryInterface(aSibling) ); + nsCOMPtrtheSibling( do_QueryInterface(aSibling) ); PRInt32 indx = IndexOf(theSibling) + 1; nsIDOMNode *nParent; theSibling->GetParentNode(&nParent); @@ -985,7 +980,7 @@ nsresult nsRange::Unposition() nsresult nsRange::SelectNode(nsIDOMNode* aN) { nsCOMPtr parent; - nsCOMPtr theNode( dont_QueryInterface(aN) ); + nsCOMPtr theNode( do_QueryInterface(aN) ); nsresult res = aN->GetParentNode(getter_AddRefs(parent)); if (!NS_SUCCEEDED(res)) @@ -997,7 +992,7 @@ nsresult nsRange::SelectNode(nsIDOMNode* aN) nsresult nsRange::SelectNodeContents(nsIDOMNode* aN) { - nsCOMPtr theNode( dont_QueryInterface(aN) ); + nsCOMPtr theNode( do_QueryInterface(aN) ); nsCOMPtr aChildNodes; nsresult res = aN->GetChildNodes(getter_AddRefs(aChildNodes)); @@ -1503,7 +1498,7 @@ nsresult nsRange::OwnerChildInserted(nsIContent* aParentNode, PRInt32 aOffset) // sanity check - null nodes shouldn't have enclosed ranges if (!aParentNode) return NS_ERROR_UNEXPECTED; - nsCOMPtr parent( dont_QueryInterface(aParentNode) ); + nsCOMPtr parent( do_QueryInterface(aParentNode) ); // quick return if no range list nsVoidArray *theRangeList; parent->GetRangeList(theRangeList); @@ -1548,8 +1543,8 @@ nsresult nsRange::OwnerChildRemoved(nsIContent* aParentNode, PRInt32 aOffset, ns // sanity check - null nodes shouldn't have enclosed ranges if (!aParentNode) return NS_ERROR_UNEXPECTED; - nsCOMPtr parent( dont_QueryInterface(aParentNode) ); - nsCOMPtr removed( dont_QueryInterface(aRemovedNode) ); + nsCOMPtr parent( do_QueryInterface(aParentNode) ); + nsCOMPtr removed( do_QueryInterface(aRemovedNode) ); // quick return if no range list nsVoidArray *theRangeList; parent->GetRangeList(theRangeList); @@ -1606,8 +1601,8 @@ nsresult nsRange::OwnerChildReplaced(nsIContent* aParentNode, PRInt32 aOffset, n // but we do need to pop out any range endpoints inside the subtree // rooted by aReplacedNode. - nsCOMPtr parent( dont_QueryInterface(aParentNode) ); - nsCOMPtr replaced( dont_QueryInterface(aReplacedNode) ); + nsCOMPtr parent( do_QueryInterface(aParentNode) ); + nsCOMPtr replaced( do_QueryInterface(aReplacedNode) ); nsCOMPtr parentDomNode; nsresult res; @@ -1626,7 +1621,7 @@ nsresult nsRange::TextOwnerChanged(nsIContent* aTextNode, PRInt32 aStartChanged, // sanity check - null nodes shouldn't have enclosed ranges if (!aTextNode) return NS_ERROR_UNEXPECTED; - nsCOMPtr textNode( dont_QueryInterface(aTextNode) ); + nsCOMPtr textNode( do_QueryInterface(aTextNode) ); nsVoidArray *theRangeList; aTextNode->GetRangeList(theRangeList); // the caller already checked to see if there was a range list diff --git a/layout/base/src/nsContentIterator.cpp b/layout/base/src/nsContentIterator.cpp index ff28ee787aaf..30eeb5b9b842 100644 --- a/layout/base/src/nsContentIterator.cpp +++ b/layout/base/src/nsContentIterator.cpp @@ -173,7 +173,7 @@ nsresult nsContentIterator::Init(nsIContent* aRoot) if (!aRoot) return NS_ERROR_NULL_POINTER; - nsCOMPtr root( dont_QueryInterface(aRoot) ); + nsCOMPtr root( do_QueryInterface(aRoot) ); mFirst = GetDeepFirstChild(root); mLast = root; mCommonParent = root; @@ -349,6 +349,7 @@ nsresult nsContentIterator::GetNextSibling(nsCOMPtr aNode, nsCOMPtr< if (!NS_SUCCEEDED(aNode->GetParent(*getter_AddRefs(parent)))) return NS_ERROR_FAILURE; + if (!NS_SUCCEEDED(parent->IndexOf(aNode, indx))) return NS_ERROR_FAILURE; @@ -358,7 +359,7 @@ nsresult nsContentIterator::GetNextSibling(nsCOMPtr aNode, nsCOMPtr< } else if (parent != mCommonParent) { - GetNextSibling(parent, aSibling); + return GetNextSibling(parent, aSibling); } else { @@ -382,6 +383,7 @@ nsresult nsContentIterator::GetPrevSibling(nsCOMPtr aNode, nsCOMPtr< if (!NS_SUCCEEDED(aNode->GetParent(*getter_AddRefs(parent)))) return NS_ERROR_FAILURE; + if (!NS_SUCCEEDED(parent->IndexOf(aNode, indx))) return NS_ERROR_FAILURE; @@ -391,7 +393,7 @@ nsresult nsContentIterator::GetPrevSibling(nsCOMPtr aNode, nsCOMPtr< } else if (parent != mCommonParent) { - GetPrevSibling(parent, aSibling); + return GetPrevSibling(parent, aSibling); } else { @@ -612,7 +614,7 @@ nsresult nsContentSubtreeIterator::Init(nsIDOMRange* aRange) if (!aRange) return NS_ERROR_NULL_POINTER; - mRange = dont_QueryInterface(aRange); + mRange = do_QueryInterface(aRange); // get the start node and offset, convert to nsIContent nsCOMPtr commonParent; @@ -621,7 +623,8 @@ nsresult nsContentSubtreeIterator::Init(nsIDOMRange* aRange) nsCOMPtr cStartP; nsCOMPtr cEndP; nsCOMPtr cN; - nsCOMPtr candidate; + nsCOMPtr firstCandidate; + nsCOMPtr lastCandidate; // get common content parent if (!NS_SUCCEEDED(aRange->GetCommonParent(getter_AddRefs(commonParent))) || !commonParent) @@ -646,7 +649,7 @@ nsresult nsContentSubtreeIterator::Init(nsIDOMRange* aRange) PRInt32 numChildren; cStartP->ChildCount(numChildren); - if (numChildren) // no children, must be a text node + if (!numChildren) // no children, must be a text node { cN = cStartP; } @@ -659,28 +662,28 @@ nsresult nsContentSubtreeIterator::Init(nsIDOMRange* aRange) } else { - candidate = cChild; + firstCandidate = cChild; } } - if (!candidate) + if (!firstCandidate) { - // then candidate is next node after cN - if (!NS_SUCCEEDED(GetNextSibling(cN, &candidate))) + // then firstCandidate is next node after cN + if (!NS_SUCCEEDED(GetNextSibling(cN, &firstCandidate))) { MakeEmpty(); return NS_OK; } } - candidate = GetDeepFirstChild(candidate); + firstCandidate = GetDeepFirstChild(firstCandidate); // confirm that this first possible contained node // is indeed contained. Else we have a range that // does not fully contain any node. PRBool nodeBefore, nodeAfter; - if (!NS_SUCCEEDED(CompareNodeToRange(candidate, aRange, &nodeBefore, &nodeAfter))) + if (!NS_SUCCEEDED(CompareNodeToRange(firstCandidate, aRange, &nodeBefore, &nodeAfter))) return NS_ERROR_FAILURE; if (nodeBefore || nodeAfter) { @@ -691,7 +694,7 @@ nsresult nsContentSubtreeIterator::Init(nsIDOMRange* aRange) // cool, we have the first node in the range. Now we walk // up it's ancestors to find the most senior that is still // in the range. That's the real first node. - if (!NS_SUCCEEDED(GetTopAncestorInRange(candidate, &mFirst))) + if (!NS_SUCCEEDED(GetTopAncestorInRange(firstCandidate, &mFirst))) return NS_ERROR_FAILURE; @@ -706,7 +709,7 @@ nsresult nsContentSubtreeIterator::Init(nsIDOMRange* aRange) { cEndP->ChildCount(numChildren); - if (numChildren) // no children, must be a text node + if (!numChildren) // no children, must be a text node { cN = cEndP; } @@ -720,28 +723,28 @@ nsresult nsContentSubtreeIterator::Init(nsIDOMRange* aRange) } else { - candidate = cChild; + lastCandidate = cChild; } } } - if (!candidate) + if (!lastCandidate) { - // then candidate is prev node before cN - if (!NS_SUCCEEDED(GetPrevSibling(cN, &candidate))) + // then lastCandidate is prev node before cN + if (!NS_SUCCEEDED(GetPrevSibling(cN, &lastCandidate))) { MakeEmpty(); return NS_OK; } } - candidate = GetDeepLastChild(candidate); + lastCandidate = GetDeepLastChild(lastCandidate); // confirm that this first possible contained node // is indeed contained. Else we have a range that // does not fully contain any node. - if (!NS_SUCCEEDED(CompareNodeToRange(candidate, aRange, &nodeBefore, &nodeAfter))) + if (!NS_SUCCEEDED(CompareNodeToRange(lastCandidate, aRange, &nodeBefore, &nodeAfter))) return NS_ERROR_FAILURE; if (nodeBefore || nodeAfter) { @@ -752,7 +755,7 @@ nsresult nsContentSubtreeIterator::Init(nsIDOMRange* aRange) // cool, we have the last node in the range. Now we walk // up it's ancestors to find the most senior that is still // in the range. That's the real first node. - if (!NS_SUCCEEDED(GetTopAncestorInRange(candidate, &mLast))) + if (!NS_SUCCEEDED(GetTopAncestorInRange(lastCandidate, &mLast))) return NS_ERROR_FAILURE; mCurNode = mFirst; diff --git a/layout/base/src/nsRange.cpp b/layout/base/src/nsRange.cpp index 53220309d758..183867298c7a 100644 --- a/layout/base/src/nsRange.cpp +++ b/layout/base/src/nsRange.cpp @@ -648,17 +648,12 @@ nsCOMPtr nsRange::CommonParent(nsCOMPtr aNode1, nsCOMPtr // no null nodes please if (!aNode1 || !aNode2) - return nsCOMPtr(); // moral equiv or nsnull + return nsCOMPtr(); // moral equiv of nsnull // shortcut for common case - both nodes are the same if (aNode1 == aNode2) { - // should be able to remove this error check later - nsresult res = aNode1->GetParentNode(getter_AddRefs(theParent)); - if (!NS_SUCCEEDED(res)) - return nsCOMPtr(); // moral equiv or nsnull - - return theParent; + return aNode1; } // otherwise traverse the tree for the common ancestor @@ -673,7 +668,7 @@ nsCOMPtr nsRange::CommonParent(nsCOMPtr aNode1, nsCOMPtr NS_NOTREACHED("nsRange::CommonParent"); delete array1; delete array2; - return nsCOMPtr(); + return nsCOMPtr(); // moral equiv of nsnull } // get ancestors of each node @@ -686,7 +681,7 @@ nsCOMPtr nsRange::CommonParent(nsCOMPtr aNode1, nsCOMPtr NS_NOTREACHED("nsRange::CommonParent"); delete array1; delete array2; - return nsCOMPtr(); + return nsCOMPtr(); // moral equiv of nsnull } // sanity test (for now) - the end of each array @@ -696,7 +691,7 @@ nsCOMPtr nsRange::CommonParent(nsCOMPtr aNode1, nsCOMPtr NS_NOTREACHED("nsRange::CommonParent"); delete array1; delete array2; - return nsCOMPtr(); + return nsCOMPtr(); // moral equiv of nsnull } // back through the ancestors, starting from the root, until @@ -881,7 +876,7 @@ nsresult nsRange::SetStart(nsIDOMNode* aParent, PRInt32 aOffset) if (!aParent) return NS_ERROR_NULL_POINTER; - nsCOMPtrtheParent( dont_QueryInterface(aParent) ); + nsCOMPtrtheParent( do_QueryInterface(aParent) ); // must be in same document as endpoint, else // endpoint is collapsed to new start. @@ -902,7 +897,7 @@ nsresult nsRange::SetStart(nsIDOMNode* aParent, PRInt32 aOffset) nsresult nsRange::SetStartBefore(nsIDOMNode* aSibling) { - nsCOMPtrtheSibling( dont_QueryInterface(aSibling) ); + nsCOMPtrtheSibling( do_QueryInterface(aSibling) ); PRInt32 indx = IndexOf(theSibling); nsIDOMNode *nParent; theSibling->GetParentNode(&nParent); @@ -911,7 +906,7 @@ nsresult nsRange::SetStartBefore(nsIDOMNode* aSibling) nsresult nsRange::SetStartAfter(nsIDOMNode* aSibling) { - nsCOMPtrtheSibling( dont_QueryInterface(aSibling) ); + nsCOMPtrtheSibling( do_QueryInterface(aSibling) ); PRInt32 indx = IndexOf(theSibling) + 1; nsIDOMNode *nParent; theSibling->GetParentNode(&nParent); @@ -924,7 +919,7 @@ nsresult nsRange::SetEnd(nsIDOMNode* aParent, PRInt32 aOffset) if (!aParent) return NS_ERROR_NULL_POINTER; - nsCOMPtrtheParent( dont_QueryInterface(aParent) ); + nsCOMPtrtheParent( do_QueryInterface(aParent) ); // must be in same document as startpoint, else // endpoint is collapsed to new end. @@ -945,7 +940,7 @@ nsresult nsRange::SetEnd(nsIDOMNode* aParent, PRInt32 aOffset) nsresult nsRange::SetEndBefore(nsIDOMNode* aSibling) { - nsCOMPtrtheSibling( dont_QueryInterface(aSibling) ); + nsCOMPtrtheSibling( do_QueryInterface(aSibling) ); PRInt32 indx = IndexOf(theSibling); nsIDOMNode *nParent; theSibling->GetParentNode(&nParent); @@ -954,7 +949,7 @@ nsresult nsRange::SetEndBefore(nsIDOMNode* aSibling) nsresult nsRange::SetEndAfter(nsIDOMNode* aSibling) { - nsCOMPtrtheSibling( dont_QueryInterface(aSibling) ); + nsCOMPtrtheSibling( do_QueryInterface(aSibling) ); PRInt32 indx = IndexOf(theSibling) + 1; nsIDOMNode *nParent; theSibling->GetParentNode(&nParent); @@ -985,7 +980,7 @@ nsresult nsRange::Unposition() nsresult nsRange::SelectNode(nsIDOMNode* aN) { nsCOMPtr parent; - nsCOMPtr theNode( dont_QueryInterface(aN) ); + nsCOMPtr theNode( do_QueryInterface(aN) ); nsresult res = aN->GetParentNode(getter_AddRefs(parent)); if (!NS_SUCCEEDED(res)) @@ -997,7 +992,7 @@ nsresult nsRange::SelectNode(nsIDOMNode* aN) nsresult nsRange::SelectNodeContents(nsIDOMNode* aN) { - nsCOMPtr theNode( dont_QueryInterface(aN) ); + nsCOMPtr theNode( do_QueryInterface(aN) ); nsCOMPtr aChildNodes; nsresult res = aN->GetChildNodes(getter_AddRefs(aChildNodes)); @@ -1503,7 +1498,7 @@ nsresult nsRange::OwnerChildInserted(nsIContent* aParentNode, PRInt32 aOffset) // sanity check - null nodes shouldn't have enclosed ranges if (!aParentNode) return NS_ERROR_UNEXPECTED; - nsCOMPtr parent( dont_QueryInterface(aParentNode) ); + nsCOMPtr parent( do_QueryInterface(aParentNode) ); // quick return if no range list nsVoidArray *theRangeList; parent->GetRangeList(theRangeList); @@ -1548,8 +1543,8 @@ nsresult nsRange::OwnerChildRemoved(nsIContent* aParentNode, PRInt32 aOffset, ns // sanity check - null nodes shouldn't have enclosed ranges if (!aParentNode) return NS_ERROR_UNEXPECTED; - nsCOMPtr parent( dont_QueryInterface(aParentNode) ); - nsCOMPtr removed( dont_QueryInterface(aRemovedNode) ); + nsCOMPtr parent( do_QueryInterface(aParentNode) ); + nsCOMPtr removed( do_QueryInterface(aRemovedNode) ); // quick return if no range list nsVoidArray *theRangeList; parent->GetRangeList(theRangeList); @@ -1606,8 +1601,8 @@ nsresult nsRange::OwnerChildReplaced(nsIContent* aParentNode, PRInt32 aOffset, n // but we do need to pop out any range endpoints inside the subtree // rooted by aReplacedNode. - nsCOMPtr parent( dont_QueryInterface(aParentNode) ); - nsCOMPtr replaced( dont_QueryInterface(aReplacedNode) ); + nsCOMPtr parent( do_QueryInterface(aParentNode) ); + nsCOMPtr replaced( do_QueryInterface(aReplacedNode) ); nsCOMPtr parentDomNode; nsresult res; @@ -1626,7 +1621,7 @@ nsresult nsRange::TextOwnerChanged(nsIContent* aTextNode, PRInt32 aStartChanged, // sanity check - null nodes shouldn't have enclosed ranges if (!aTextNode) return NS_ERROR_UNEXPECTED; - nsCOMPtr textNode( dont_QueryInterface(aTextNode) ); + nsCOMPtr textNode( do_QueryInterface(aTextNode) ); nsVoidArray *theRangeList; aTextNode->GetRangeList(theRangeList); // the caller already checked to see if there was a range list