Bug 744507 - Part a: Preparatory cleanup in GetPriorHTMLSibling/GetNextHTMLSibling; r=ehsan

This commit is contained in:
Ms2ger 2012-04-14 15:09:21 +02:00
parent 015f88e50e
commit b8f9cbba39

View File

@ -4245,16 +4245,15 @@ nsresult
nsHTMLEditor::GetPriorHTMLSibling(nsIDOMNode *inParent, PRInt32 inOffset, nsCOMPtr<nsIDOMNode> *outNode)
{
NS_ENSURE_TRUE(outNode && inParent, NS_ERROR_NULL_POINTER);
nsresult res = NS_OK;
*outNode = nsnull;
if (inOffset <= 0) {
// return null sibling if at offset zero
nsCOMPtr<nsIDOMNode> node = nsEditor::GetChildAt(inParent,inOffset-1);
if (!node) {
// return null sibling if no sibling
return NS_OK;
}
nsCOMPtr<nsIDOMNode> node = nsEditor::GetChildAt(inParent,inOffset-1);
if (node && IsEditable(node)) {
if (IsEditable(node)) {
*outNode = node;
return res;
return NS_OK;
}
// else
return GetPriorHTMLSibling(node, outNode);
@ -4302,16 +4301,15 @@ nsresult
nsHTMLEditor::GetNextHTMLSibling(nsIDOMNode *inParent, PRInt32 inOffset, nsCOMPtr<nsIDOMNode> *outNode)
{
NS_ENSURE_TRUE(outNode && inParent, NS_ERROR_NULL_POINTER);
nsresult res = NS_OK;
*outNode = nsnull;
nsCOMPtr<nsIDOMNode> node = nsEditor::GetChildAt(inParent, inOffset + 1);
if (!node) {
// return null sibling if no sibling
return NS_OK;
}
if (node && IsEditable(node)) {
if (IsEditable(node)) {
*outNode = node;
return res;
return NS_OK;
}
// else
return GetNextHTMLSibling(node, outNode);