179384 Merging blocks via forward delete sends selection to front of document

correcting snafu from prior landing.
This commit is contained in:
jfrancis%netscape.com 2002-12-22 07:48:32 +00:00
parent 33ca73d3d7
commit 4735e23c71

View File

@ -319,36 +319,35 @@ nsRangeUpdater::SelAdjDeleteNode(nsIDOMNode *aNode)
item->startOffset--; item->startOffset--;
if ((item->endNode.get() == parent) && (item->endOffset > offset)) if ((item->endNode.get() == parent) && (item->endOffset > offset))
item->endOffset--; item->endOffset--;
}
// check for range endpoints that are in aNode
if (item->startNode == aNode)
{
item->startNode = parent;
item->startOffset = offset;
}
if (item->endNode == aNode)
{
item->endNode = parent;
item->endOffset = offset;
}
// check for range endpoints that are in aNode // check for range endpoints that are in descendants of aNode
if (item->startNode == aNode) nsCOMPtr<nsIDOMNode> oldStart;
{ if (nsEditorUtils::IsDescendantOf(item->startNode, aNode))
item->startNode = parent; {
item->startOffset = offset; oldStart = item->startNode; // save for efficiency hack below.
} item->startNode = parent;
if (item->endNode == aNode) item->startOffset = offset;
{ }
item->endNode = parent;
item->endOffset = offset;
}
// check for range endpoints that are in descendants of aNode // avoid having to call IsDescendantOf() for common case of range startnode == range endnode.
nsCOMPtr<nsIDOMNode> oldStart; if ((item->endNode == oldStart) || nsEditorUtils::IsDescendantOf(item->endNode, aNode))
if (nsEditorUtils::IsDescendantOf(item->startNode, aNode)) {
{ item->endNode = parent;
oldStart = item->startNode; // save for efficiency hack below. item->endOffset = offset;
item->startNode = parent; }
item->startOffset = offset;
} }
// avoid having to call IsDescendantOf() for common case of range startnode == range endnode.
if ((item->endNode == oldStart) || nsEditorUtils::IsDescendantOf(item->endNode, aNode))
{
item->endNode = parent;
item->endOffset = offset;
}
return NS_OK; return NS_OK;
} }