From 14e8c3744e1ff4bfe5410b9d70bf7203ecbd9433 Mon Sep 17 00:00:00 2001 From: "daniel%glazman.org" Date: Wed, 13 Sep 2006 08:27:04 +0000 Subject: [PATCH] Merging two paragraphs using delete or backspace left an unwanted BR element; b=322207; r=neil@httml.net, sr=bzbarsky@mit.edu git-svn-id: svn://10.0.0.236/trunk@210009 18797224-902f-48f8-a5cc-f745e15eee43 --- .../editor/libeditor/html/nsHTMLEditRules.cpp | 25 +++++-------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/mozilla/editor/libeditor/html/nsHTMLEditRules.cpp b/mozilla/editor/libeditor/html/nsHTMLEditRules.cpp index d7c73e44c32..833c8171c61 100644 --- a/mozilla/editor/libeditor/html/nsHTMLEditRules.cpp +++ b/mozilla/editor/libeditor/html/nsHTMLEditRules.cpp @@ -7050,22 +7050,8 @@ nsHTMLEditRules::JoinNodesSmart( nsIDOMNode *aNodeLeft, if (NS_FAILED(res)) return res; // separate join rules for differing blocks - if (nsHTMLEditUtils::IsParagraph(aNodeLeft)) - { - // for para's, merge deep & add a
after merging - res = mHTMLEditor->JoinNodeDeep(aNodeLeft, aNodeRight, aOutMergeParent, aOutMergeOffset); - if (NS_FAILED(res)) return res; - // now we need to insert a br. - nsCOMPtr brNode; - res = mHTMLEditor->CreateBR(*aOutMergeParent, *aOutMergeOffset, address_of(brNode)); - if (NS_FAILED(res)) return res; - res = nsEditor::GetNodeLocation(brNode, aOutMergeParent, aOutMergeOffset); - if (NS_FAILED(res)) return res; - (*aOutMergeOffset)++; - return res; - } - else if (nsHTMLEditUtils::IsList(aNodeLeft) - || mHTMLEditor->IsTextNode(aNodeLeft)) + if (nsHTMLEditUtils::IsList(aNodeLeft) || + mHTMLEditor->IsTextNode(aNodeLeft)) { // for list's, merge shallow (wouldn't want to combine list items) res = mHTMLEditor->JoinNodes(aNodeLeft, aNodeRight, parent); @@ -7085,10 +7071,11 @@ nsHTMLEditRules::JoinNodesSmart( nsIDOMNode *aNodeLeft, res = mHTMLEditor->JoinNodes(aNodeLeft, aNodeRight, parent); if (NS_FAILED(res)) return res; - if (lastLeft && firstRight && mHTMLEditor->NodesSameType(lastLeft, firstRight)) - { + if (lastLeft && firstRight && + mHTMLEditor->NodesSameType(lastLeft, firstRight) && + (nsEditor::IsTextNode(lastLeft) || + mHTMLEditor->mHTMLCSSUtils->ElementsSameStyle(lastLeft, firstRight))) return JoinNodesSmart(lastLeft, firstRight, aOutMergeParent, aOutMergeOffset); - } } return res; }