b=200417 backspace, enter keys have no visible impact

r=jfrancis sr=sfraser a=sspitzer
This commit is contained in:
kaie%netscape.com 2003-05-14 13:17:32 +00:00
Родитель 7f65f9ebed
Коммит 684cee26a8
1 изменённых файлов: 37 добавлений и 9 удалений

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

@ -4519,23 +4519,51 @@ nsHTMLEditRules::CheckForInvisibleBR(nsIDOMNode *aBlock,
nsCOMPtr<nsIDOMNode> *outBRNode,
PRInt32 aOffset)
{
// for now I'm relying on fact that user has scrubbed any invisible whitespace
// in the vicinity, so we don't need more complicated code here to check for that.
if (!aBlock || !outBRNode) return NS_ERROR_NULL_POINTER;
*outBRNode = nsnull;
nsCOMPtr<nsIDOMNode> testNode;
PRInt32 testOffset = 0;
PRBool runTest = PR_FALSE;
if (aWhere == kBlockEnd)
{
nsCOMPtr<nsIDOMNode> node = mHTMLEditor->GetRightmostChild(aBlock, PR_TRUE);
if (nsTextEditUtils::IsBreak(node))
*outBRNode = node;
nsCOMPtr<nsIDOMNode> rightmostNode;
rightmostNode = mHTMLEditor->GetRightmostChild(aBlock, PR_TRUE); // no block crossing
if (rightmostNode)
{
nsCOMPtr<nsIDOMNode> nodeParent;
PRInt32 nodeOffset;
if (NS_SUCCEEDED(nsEditor::GetNodeLocation(rightmostNode,
address_of(nodeParent),
&nodeOffset)))
{
runTest = PR_TRUE;
testNode = nodeParent;
// use offset + 1, because we want the last node included in our evaluation
testOffset = nodeOffset + 1;
}
}
}
else if (aOffset)
{
nsCOMPtr<nsIDOMNode> prevItem;
mHTMLEditor->GetPriorHTMLNode(aBlock, aOffset, address_of(prevItem), PR_TRUE);
if (nsTextEditUtils::IsBreak(prevItem))
*outBRNode = prevItem;
runTest = PR_TRUE;
testNode = aBlock;
// we'll check everything to the left of the input position
testOffset = aOffset;
}
if (runTest)
{
nsWSRunObject wsTester(mHTMLEditor, testNode, testOffset);
if (nsWSRunObject::eBreak == wsTester.mStartReason)
{
*outBRNode = wsTester.mStartReasonNode;
}
}
return NS_OK;
}