This commit is contained in:
jfrancis%netscape.com 2000-05-24 23:01:09 +00:00
Родитель f8789832b8
Коммит 43f70de371
2 изменённых файлов: 34 добавлений и 42 удалений

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

@ -975,11 +975,10 @@ nsresult nsRange::SetStartBefore(nsIDOMNode* aSibling)
// Not the correct one to throw, but spec doesn't say what is
return NS_ERROR_DOM_NOT_OBJECT_ERR;
}
nsCOMPtr<nsIDOMNode>theSibling( do_QueryInterface(aSibling) );
PRInt32 indx = IndexOf(theSibling);
nsIDOMNode *nParent;
nsresult res = theSibling->GetParentNode(&nParent);
if (NS_FAILED(res)) return res;
nsCOMPtr<nsIDOMNode> nParent;
nsresult res = aSibling->GetParentNode(getter_AddRefs(nParent));
if (NS_FAILED(res) || !nParent) return NS_ERROR_DOM_RANGE_INVALID_NODE_TYPE_ERR;
PRInt32 indx = IndexOf(aSibling);
return SetStart(nParent,indx);
}
@ -989,11 +988,10 @@ nsresult nsRange::SetStartAfter(nsIDOMNode* aSibling)
// Not the correct one to throw, but spec doesn't say what is
return NS_ERROR_DOM_NOT_OBJECT_ERR;
}
nsCOMPtr<nsIDOMNode>theSibling( do_QueryInterface(aSibling) );
PRInt32 indx = IndexOf(theSibling) + 1;
nsIDOMNode *nParent;
nsresult res = theSibling->GetParentNode(&nParent);
if (NS_FAILED(res)) return res;
nsCOMPtr<nsIDOMNode> nParent;
nsresult res = aSibling->GetParentNode(getter_AddRefs(nParent));
if (NS_FAILED(res) || !nParent) return NS_ERROR_DOM_RANGE_INVALID_NODE_TYPE_ERR;
PRInt32 indx = IndexOf(aSibling) + 1;
return SetStart(nParent,indx);
}
@ -1028,11 +1026,10 @@ nsresult nsRange::SetEndBefore(nsIDOMNode* aSibling)
// Not the correct one to throw, but spec doesn't say what is
return NS_ERROR_DOM_NOT_OBJECT_ERR;
}
nsCOMPtr<nsIDOMNode>theSibling( do_QueryInterface(aSibling) );
PRInt32 indx = IndexOf(theSibling);
nsIDOMNode *nParent;
nsresult res = theSibling->GetParentNode(&nParent);
if (NS_FAILED(res)) return res;
nsCOMPtr<nsIDOMNode> nParent;
nsresult res = aSibling->GetParentNode(getter_AddRefs(nParent));
if (NS_FAILED(res) || !nParent) return NS_ERROR_DOM_RANGE_INVALID_NODE_TYPE_ERR;
PRInt32 indx = IndexOf(aSibling);
return SetEnd(nParent,indx);
}
@ -1042,11 +1039,10 @@ nsresult nsRange::SetEndAfter(nsIDOMNode* aSibling)
// Not the correct one to throw, but spec doesn't say what is
return NS_ERROR_DOM_NOT_OBJECT_ERR;
}
nsCOMPtr<nsIDOMNode>theSibling( do_QueryInterface(aSibling) );
PRInt32 indx = IndexOf(theSibling) + 1;
nsIDOMNode *nParent;
nsresult res = theSibling->GetParentNode(&nParent);
if (NS_FAILED(res)) return res;
nsCOMPtr<nsIDOMNode> nParent;
nsresult res = aSibling->GetParentNode(getter_AddRefs(nParent));
if (NS_FAILED(res) || !nParent) return NS_ERROR_DOM_RANGE_INVALID_NODE_TYPE_ERR;
PRInt32 indx = IndexOf(aSibling) + 1;
return SetEnd(nParent,indx);
}
@ -1090,7 +1086,7 @@ nsresult nsRange::SelectNode(nsIDOMNode* aN)
}
nsresult res = aN->GetParentNode(getter_AddRefs(parent));
if (NS_FAILED(res)) return res;
if (NS_FAILED(res) || !parent) return NS_ERROR_DOM_RANGE_INVALID_NODE_TYPE_ERR;
PRInt32 indx = IndexOf(theNode);
return DoSetRange(parent,indx,parent,indx+1);
}

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

@ -975,11 +975,10 @@ nsresult nsRange::SetStartBefore(nsIDOMNode* aSibling)
// Not the correct one to throw, but spec doesn't say what is
return NS_ERROR_DOM_NOT_OBJECT_ERR;
}
nsCOMPtr<nsIDOMNode>theSibling( do_QueryInterface(aSibling) );
PRInt32 indx = IndexOf(theSibling);
nsIDOMNode *nParent;
nsresult res = theSibling->GetParentNode(&nParent);
if (NS_FAILED(res)) return res;
nsCOMPtr<nsIDOMNode> nParent;
nsresult res = aSibling->GetParentNode(getter_AddRefs(nParent));
if (NS_FAILED(res) || !nParent) return NS_ERROR_DOM_RANGE_INVALID_NODE_TYPE_ERR;
PRInt32 indx = IndexOf(aSibling);
return SetStart(nParent,indx);
}
@ -989,11 +988,10 @@ nsresult nsRange::SetStartAfter(nsIDOMNode* aSibling)
// Not the correct one to throw, but spec doesn't say what is
return NS_ERROR_DOM_NOT_OBJECT_ERR;
}
nsCOMPtr<nsIDOMNode>theSibling( do_QueryInterface(aSibling) );
PRInt32 indx = IndexOf(theSibling) + 1;
nsIDOMNode *nParent;
nsresult res = theSibling->GetParentNode(&nParent);
if (NS_FAILED(res)) return res;
nsCOMPtr<nsIDOMNode> nParent;
nsresult res = aSibling->GetParentNode(getter_AddRefs(nParent));
if (NS_FAILED(res) || !nParent) return NS_ERROR_DOM_RANGE_INVALID_NODE_TYPE_ERR;
PRInt32 indx = IndexOf(aSibling) + 1;
return SetStart(nParent,indx);
}
@ -1028,11 +1026,10 @@ nsresult nsRange::SetEndBefore(nsIDOMNode* aSibling)
// Not the correct one to throw, but spec doesn't say what is
return NS_ERROR_DOM_NOT_OBJECT_ERR;
}
nsCOMPtr<nsIDOMNode>theSibling( do_QueryInterface(aSibling) );
PRInt32 indx = IndexOf(theSibling);
nsIDOMNode *nParent;
nsresult res = theSibling->GetParentNode(&nParent);
if (NS_FAILED(res)) return res;
nsCOMPtr<nsIDOMNode> nParent;
nsresult res = aSibling->GetParentNode(getter_AddRefs(nParent));
if (NS_FAILED(res) || !nParent) return NS_ERROR_DOM_RANGE_INVALID_NODE_TYPE_ERR;
PRInt32 indx = IndexOf(aSibling);
return SetEnd(nParent,indx);
}
@ -1042,11 +1039,10 @@ nsresult nsRange::SetEndAfter(nsIDOMNode* aSibling)
// Not the correct one to throw, but spec doesn't say what is
return NS_ERROR_DOM_NOT_OBJECT_ERR;
}
nsCOMPtr<nsIDOMNode>theSibling( do_QueryInterface(aSibling) );
PRInt32 indx = IndexOf(theSibling) + 1;
nsIDOMNode *nParent;
nsresult res = theSibling->GetParentNode(&nParent);
if (NS_FAILED(res)) return res;
nsCOMPtr<nsIDOMNode> nParent;
nsresult res = aSibling->GetParentNode(getter_AddRefs(nParent));
if (NS_FAILED(res) || !nParent) return NS_ERROR_DOM_RANGE_INVALID_NODE_TYPE_ERR;
PRInt32 indx = IndexOf(aSibling) + 1;
return SetEnd(nParent,indx);
}
@ -1090,7 +1086,7 @@ nsresult nsRange::SelectNode(nsIDOMNode* aN)
}
nsresult res = aN->GetParentNode(getter_AddRefs(parent));
if (NS_FAILED(res)) return res;
if (NS_FAILED(res) || !parent) return NS_ERROR_DOM_RANGE_INVALID_NODE_TYPE_ERR;
PRInt32 indx = IndexOf(theNode);
return DoSetRange(parent,indx,parent,indx+1);
}