зеркало из https://github.com/mozilla/pjs.git
fix for bug 5782 - check for null return when getting prev/next node is deletion rules; rvd floppy moose, appr chofmann
This commit is contained in:
Родитель
61ec76503b
Коммит
7fb20b8fe5
|
@ -367,6 +367,13 @@ nsHTMLEditRules::WillDeleteSelection(nsIDOMSelection *aSelection, nsIEditor::Dir
|
|||
res = GetPriorNode(node, getter_AddRefs(priorNode));
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
// if there is no prior node then cancel the deletion
|
||||
if (!priorNode)
|
||||
{
|
||||
*aCancel = PR_TRUE;
|
||||
return res;
|
||||
}
|
||||
|
||||
// XXX hackery - using this to skip empty text nodes,
|
||||
// since these are almost always non displayed preservation
|
||||
// of returns in the original html. but they could
|
||||
|
@ -423,9 +430,14 @@ nsHTMLEditRules::WillDeleteSelection(nsIDOMSelection *aSelection, nsIEditor::Dir
|
|||
nsCOMPtr<nsIDOMNode> nextNode;
|
||||
res = GetNextNode(node, getter_AddRefs(nextNode));
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (HasSameBlockNodeParent(node, nextNode)) return NS_OK;
|
||||
|
||||
// deleting across blocks
|
||||
// if there is no next node then cancel the deletion
|
||||
if (!nextNode)
|
||||
{
|
||||
*aCancel = PR_TRUE;
|
||||
return res;
|
||||
}
|
||||
|
||||
// XXX hackery - using this to skip empty text nodes,
|
||||
// since these are almost always non displayed preservation
|
||||
// of returns in the original html. but they could
|
||||
|
|
|
@ -367,6 +367,13 @@ nsHTMLEditRules::WillDeleteSelection(nsIDOMSelection *aSelection, nsIEditor::Dir
|
|||
res = GetPriorNode(node, getter_AddRefs(priorNode));
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
// if there is no prior node then cancel the deletion
|
||||
if (!priorNode)
|
||||
{
|
||||
*aCancel = PR_TRUE;
|
||||
return res;
|
||||
}
|
||||
|
||||
// XXX hackery - using this to skip empty text nodes,
|
||||
// since these are almost always non displayed preservation
|
||||
// of returns in the original html. but they could
|
||||
|
@ -423,9 +430,14 @@ nsHTMLEditRules::WillDeleteSelection(nsIDOMSelection *aSelection, nsIEditor::Dir
|
|||
nsCOMPtr<nsIDOMNode> nextNode;
|
||||
res = GetNextNode(node, getter_AddRefs(nextNode));
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (HasSameBlockNodeParent(node, nextNode)) return NS_OK;
|
||||
|
||||
// deleting across blocks
|
||||
// if there is no next node then cancel the deletion
|
||||
if (!nextNode)
|
||||
{
|
||||
*aCancel = PR_TRUE;
|
||||
return res;
|
||||
}
|
||||
|
||||
// XXX hackery - using this to skip empty text nodes,
|
||||
// since these are almost always non displayed preservation
|
||||
// of returns in the original html. but they could
|
||||
|
|
Загрузка…
Ссылка в новой задаче