mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 00:01:50 +00:00
Fix for bug 101690: Delete key at end of line deletes a line then caret freezes
Modified WillDeleteSelection() to make sure that sibling is a TextNode before trying to join it with startNode (which is guaranteed to be a text node). r=jfrancis@netscape.com sr=sfraser@netscape.com
This commit is contained in:
parent
57dc85bacc
commit
b27b16b597
@ -1667,7 +1667,7 @@ nsHTMLEditRules::WillDeleteSelection(nsISelection *aSelection,
|
|||||||
res = nsWSRunObject::PrepareToDeleteNode(mHTMLEditor, nextNode);
|
res = nsWSRunObject::PrepareToDeleteNode(mHTMLEditor, nextNode);
|
||||||
if (NS_FAILED(res)) return res;
|
if (NS_FAILED(res)) return res;
|
||||||
}
|
}
|
||||||
// remember prior sibling to prior node, if any
|
// remember next sibling after nextNode, if any
|
||||||
nsCOMPtr<nsIDOMNode> sibling, stepbrother;
|
nsCOMPtr<nsIDOMNode> sibling, stepbrother;
|
||||||
mHTMLEditor->GetNextHTMLSibling(nextNode, address_of(sibling));
|
mHTMLEditor->GetNextHTMLSibling(nextNode, address_of(sibling));
|
||||||
// delete the break, and join like nodes if appropriate
|
// delete the break, and join like nodes if appropriate
|
||||||
@ -1681,7 +1681,7 @@ nsHTMLEditRules::WillDeleteSelection(nsISelection *aSelection,
|
|||||||
if (startNode == stepbrother)
|
if (startNode == stepbrother)
|
||||||
{
|
{
|
||||||
// are they same type?
|
// are they same type?
|
||||||
if (mHTMLEditor->IsTextNode(stepbrother))
|
if (mHTMLEditor->IsTextNode(sibling))
|
||||||
{
|
{
|
||||||
// if so, join them!
|
// if so, join them!
|
||||||
res = JoinNodesSmart(startNode, sibling, address_of(selNode), &selOffset);
|
res = JoinNodesSmart(startNode, sibling, address_of(selNode), &selOffset);
|
||||||
|
Loading…
Reference in New Issue
Block a user