mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 03:45:46 +00:00
16706: Call the rules code to delete the bogus node before inserting html, to fix the new mail reply code. r=jfrancis
This commit is contained in:
parent
864bb2e148
commit
2d47aab79e
@ -1272,11 +1272,27 @@ NS_IMETHODIMP nsHTMLEditor::InsertHTML(const nsString& aInputString)
|
||||
nsAutoEditBatch beginBatching(this);
|
||||
|
||||
nsresult res;
|
||||
|
||||
nsCOMPtr<nsIDOMSelection>selection;
|
||||
|
||||
// Call the rules code in case there's anything we need to do first
|
||||
// (e.g. delete the bogus node):
|
||||
// Call the rules code in case there's anything we need to do first
|
||||
// (e.g. delete the bogus node):
|
||||
if (!mRules) return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
res = GetSelection(getter_AddRefs(selection));
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
nsTextRulesInfo ruleInfo(nsHTMLEditRules::kInsertElement);
|
||||
PRBool cancel, handled;
|
||||
res = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> parentNode;
|
||||
PRInt32 offsetOfNewNode;
|
||||
res = DeleteSelectionAndPrepareToCreateNode(parentNode, offsetOfNewNode);
|
||||
|
||||
nsCOMPtr<nsIDOMSelection>selection;
|
||||
res = GetSelection(getter_AddRefs(selection));
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!selection) return NS_ERROR_NULL_POINTER;
|
||||
|
@ -1272,11 +1272,27 @@ NS_IMETHODIMP nsHTMLEditor::InsertHTML(const nsString& aInputString)
|
||||
nsAutoEditBatch beginBatching(this);
|
||||
|
||||
nsresult res;
|
||||
|
||||
nsCOMPtr<nsIDOMSelection>selection;
|
||||
|
||||
// Call the rules code in case there's anything we need to do first
|
||||
// (e.g. delete the bogus node):
|
||||
// Call the rules code in case there's anything we need to do first
|
||||
// (e.g. delete the bogus node):
|
||||
if (!mRules) return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
res = GetSelection(getter_AddRefs(selection));
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
nsTextRulesInfo ruleInfo(nsHTMLEditRules::kInsertElement);
|
||||
PRBool cancel, handled;
|
||||
res = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> parentNode;
|
||||
PRInt32 offsetOfNewNode;
|
||||
res = DeleteSelectionAndPrepareToCreateNode(parentNode, offsetOfNewNode);
|
||||
|
||||
nsCOMPtr<nsIDOMSelection>selection;
|
||||
res = GetSelection(getter_AddRefs(selection));
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!selection) return NS_ERROR_NULL_POINTER;
|
||||
|
Loading…
Reference in New Issue
Block a user