From cd0b8e3f86fd62060884e2a0dab1308a9ce27b78 Mon Sep 17 00:00:00 2001 From: "jfrancis%netscape.com" Date: Wed, 18 Jun 2003 22:42:24 +0000 Subject: [PATCH] bug 140357: improving fix to handle redundant backspaces. r=brade, sr=kin --- editor/libeditor/html/nsHTMLEditRules.cpp | 27 +++++++---------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/editor/libeditor/html/nsHTMLEditRules.cpp b/editor/libeditor/html/nsHTMLEditRules.cpp index 8f4b5ccc4efb..19b150fdc9c6 100644 --- a/editor/libeditor/html/nsHTMLEditRules.cpp +++ b/editor/libeditor/html/nsHTMLEditRules.cpp @@ -343,25 +343,6 @@ nsHTMLEditRules::BeforeEdit(PRInt32 action, nsIEditor::EDirection aDirection) // clear deletion state bool mDidDeleteSelection = PR_FALSE; - // HACK: all sorts of hurt for managing typeinstate. If we are deleting, - // or doing a block operation, clear the type in state - if ((action == nsEditor::kOpDeleteText) || - (action == nsEditor::kOpDeleteSelection) || - (action == nsHTMLEditor::kOpMakeList) || - (action == nsHTMLEditor::kOpIndent) || - (action == nsHTMLEditor::kOpOutdent) || - (action == nsHTMLEditor::kOpAlign) || - (action == nsHTMLEditor::kOpMakeBasicBlock) || - (action == nsHTMLEditor::kOpRemoveList) || - (action == nsHTMLEditor::kOpMakeDefListItem) || - (action == nsHTMLEditor::kOpInsertElement) || - (action == nsHTMLEditor::kOpInsertQuotation) || - (action == nsHTMLEditor::kOpInsertBreak) || - (action == nsHTMLEditor::kOpInsertBreak)) - { - mHTMLEditor->mTypeInState->Reset(); - } - // clear out mDocChangeRange and mUtilRange nsCOMPtr nsrange; if(mDocChangeRange) @@ -7173,6 +7154,12 @@ nsHTMLEditRules::ReapplyCachedStyles() // and see if any have been removed. If so, add typeinstate // for them, so that they will be reinserted when new // content is added. + + // When we apply cahced styles to TypeInState, we always want + // to blow away prior TypeInState: + mHTMLEditor->mTypeInState->Reset(); + + // remember if we are in css mode PRBool useCSS; mHTMLEditor->GetIsCSSEnabled(&useCSS); @@ -7192,6 +7179,8 @@ nsHTMLEditRules::ReapplyCachedStyles() if (mCachedStyles[j].mPresent) { PRBool bFirst, bAny, bAll; + bFirst = bAny = bAll = PR_FALSE; + nsAutoString curValue; if (useCSS) // check computed style first in css case {