mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-07 09:13:12 +00:00
fix for 67847: forward delete can make caret go to start of doc. r=kin; sr=sfraser; a=asa
This commit is contained in:
parent
e51b95f598
commit
ce1e99c63d
@ -1839,10 +1839,6 @@ nsHTMLEditRules::WillDeleteSelection(nsISelection *aSelection,
|
||||
if (endNode.get() != startNode.get())
|
||||
{
|
||||
// block parents the same? use default deletion
|
||||
if (mHTMLEditor->HasSameBlockNodeParent(startNode, endNode)) return NS_OK;
|
||||
|
||||
// deleting across blocks
|
||||
// are the blocks of same type?
|
||||
nsCOMPtr<nsIDOMNode> leftParent;
|
||||
nsCOMPtr<nsIDOMNode> rightParent;
|
||||
if (IsBlockNode(startNode))
|
||||
@ -1853,6 +1849,10 @@ nsHTMLEditRules::WillDeleteSelection(nsISelection *aSelection,
|
||||
rightParent = endNode;
|
||||
else
|
||||
rightParent = mHTMLEditor->GetBlockNodeParent(endNode);
|
||||
if (leftParent == rightParent) return NS_OK;
|
||||
|
||||
// deleting across blocks
|
||||
// are the blocks of same type?
|
||||
|
||||
// are the blocks siblings?
|
||||
nsCOMPtr<nsIDOMNode> leftBlockParent;
|
||||
|
@ -903,11 +903,7 @@ NS_IMETHODIMP nsPlaintextEditor::DeleteSelection(nsIEditor::EDirection aAction)
|
||||
break;
|
||||
case eToEndOfLine:
|
||||
result = selCont->IntraLineMove(PR_TRUE, PR_TRUE);
|
||||
// Bugs 54449/54452: the selection jumps to the wrong place
|
||||
// when deleting past a <br> and action is eNext or ePrev,
|
||||
// so setting action to eNone makes delete-to-end marginally usable.
|
||||
// aAction should really be set to eNext
|
||||
aAction = eNone;
|
||||
aAction = eNext;
|
||||
break;
|
||||
default: // avoid several compiler warnings
|
||||
result = NS_OK;
|
||||
|
@ -1839,10 +1839,6 @@ nsHTMLEditRules::WillDeleteSelection(nsISelection *aSelection,
|
||||
if (endNode.get() != startNode.get())
|
||||
{
|
||||
// block parents the same? use default deletion
|
||||
if (mHTMLEditor->HasSameBlockNodeParent(startNode, endNode)) return NS_OK;
|
||||
|
||||
// deleting across blocks
|
||||
// are the blocks of same type?
|
||||
nsCOMPtr<nsIDOMNode> leftParent;
|
||||
nsCOMPtr<nsIDOMNode> rightParent;
|
||||
if (IsBlockNode(startNode))
|
||||
@ -1853,6 +1849,10 @@ nsHTMLEditRules::WillDeleteSelection(nsISelection *aSelection,
|
||||
rightParent = endNode;
|
||||
else
|
||||
rightParent = mHTMLEditor->GetBlockNodeParent(endNode);
|
||||
if (leftParent == rightParent) return NS_OK;
|
||||
|
||||
// deleting across blocks
|
||||
// are the blocks of same type?
|
||||
|
||||
// are the blocks siblings?
|
||||
nsCOMPtr<nsIDOMNode> leftBlockParent;
|
||||
|
@ -903,11 +903,7 @@ NS_IMETHODIMP nsPlaintextEditor::DeleteSelection(nsIEditor::EDirection aAction)
|
||||
break;
|
||||
case eToEndOfLine:
|
||||
result = selCont->IntraLineMove(PR_TRUE, PR_TRUE);
|
||||
// Bugs 54449/54452: the selection jumps to the wrong place
|
||||
// when deleting past a <br> and action is eNext or ePrev,
|
||||
// so setting action to eNone makes delete-to-end marginally usable.
|
||||
// aAction should really be set to eNext
|
||||
aAction = eNone;
|
||||
aAction = eNext;
|
||||
break;
|
||||
default: // avoid several compiler warnings
|
||||
result = NS_OK;
|
||||
|
Loading…
x
Reference in New Issue
Block a user