From 6d1d67ffa03e6180eff5625e16a9d88bdb4f3260 Mon Sep 17 00:00:00 2001 From: Aryeh Gregor Date: Tue, 22 May 2012 12:37:17 +0300 Subject: [PATCH] Bug 748307 part 2 - Make WillDoAction take an nsTypedSelection; r=ehsan --- editor/libeditor/base/nsEditRules.h | 3 +- editor/libeditor/html/nsHTMLAbsPosition.cpp | 12 ++---- editor/libeditor/html/nsHTMLDataTransfer.cpp | 25 ++++-------- editor/libeditor/html/nsHTMLEditRules.cpp | 2 +- editor/libeditor/html/nsHTMLEditRules.h | 3 +- editor/libeditor/html/nsHTMLEditor.cpp | 43 ++++++-------------- editor/libeditor/html/nsHTMLEditorStyle.cpp | 16 +++----- editor/libeditor/text/nsPlaintextEditor.cpp | 36 ++++++---------- editor/libeditor/text/nsTextEditRules.cpp | 2 +- editor/libeditor/text/nsTextEditRules.h | 3 +- 10 files changed, 51 insertions(+), 94 deletions(-) diff --git a/editor/libeditor/base/nsEditRules.h b/editor/libeditor/base/nsEditRules.h index e9181fd2c4f1..db361fb403b2 100644 --- a/editor/libeditor/base/nsEditRules.h +++ b/editor/libeditor/base/nsEditRules.h @@ -46,7 +46,8 @@ public: nsIEditor::EDirection aDirection) = 0; NS_IMETHOD AfterEdit(nsEditor::OperationID action, nsIEditor::EDirection aDirection) = 0; - NS_IMETHOD WillDoAction(nsISelection *aSelection, nsRulesInfo *aInfo, bool *aCancel, bool *aHandled)=0; + NS_IMETHOD WillDoAction(nsTypedSelection* aSelection, nsRulesInfo* aInfo, + bool* aCancel, bool* aHandled) = 0; NS_IMETHOD DidDoAction(nsISelection *aSelection, nsRulesInfo *aInfo, nsresult aResult)=0; NS_IMETHOD DocumentIsEmpty(bool *aDocumentIsEmpty)=0; NS_IMETHOD DocumentModified()=0; diff --git a/editor/libeditor/html/nsHTMLAbsPosition.cpp b/editor/libeditor/html/nsHTMLAbsPosition.cpp index 498dd419e47a..2642debf8565 100644 --- a/editor/libeditor/html/nsHTMLAbsPosition.cpp +++ b/editor/libeditor/html/nsHTMLAbsPosition.cpp @@ -46,15 +46,13 @@ nsHTMLEditor::AbsolutePositionSelection(bool aEnabled) // the line below does not match the code; should it be removed? // Find out if the selection is collapsed: - nsCOMPtr selection; - nsresult res = GetSelection(getter_AddRefs(selection)); - NS_ENSURE_SUCCESS(res, res); + nsRefPtr selection = GetTypedSelection(); NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER); nsTextRulesInfo ruleInfo(aEnabled ? kOpSetAbsolutePosition : kOpRemoveAbsolutePosition); bool cancel, handled; - res = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled); + nsresult res = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled); if (NS_FAILED(res) || cancel) return res; @@ -161,14 +159,12 @@ nsHTMLEditor::RelativeChangeZIndex(PRInt32 aChange) // brade: can we get rid of this comment? // Find out if the selection is collapsed: - nsCOMPtr selection; - nsresult res = GetSelection(getter_AddRefs(selection)); - NS_ENSURE_SUCCESS(res, res); + nsRefPtr selection = GetTypedSelection(); NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER); nsTextRulesInfo ruleInfo(aChange < 0 ? kOpDecreaseZIndex : kOpIncreaseZIndex); bool cancel, handled; - res = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled); + nsresult res = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled); if (cancel || NS_FAILED(res)) return res; diff --git a/editor/libeditor/html/nsHTMLDataTransfer.cpp b/editor/libeditor/html/nsHTMLDataTransfer.cpp index 4720704eec36..8ae41b908e74 100644 --- a/editor/libeditor/html/nsHTMLDataTransfer.cpp +++ b/editor/libeditor/html/nsHTMLDataTransfer.cpp @@ -153,13 +153,12 @@ NS_IMETHODIMP nsHTMLEditor::LoadHTML(const nsAString & aInputString) nsAutoRules beginRulesSniffing(this, kOpLoadHTML, nsIEditor::eNext); // Get selection - nsCOMPtrselection; - nsresult rv = GetSelection(getter_AddRefs(selection)); - NS_ENSURE_SUCCESS(rv, rv); + nsRefPtr selection = GetTypedSelection(); + NS_ENSURE_STATE(selection); nsTextRulesInfo ruleInfo(kOpLoadHTML); bool cancel, handled; - rv = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled); + nsresult rv = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled); NS_ENSURE_SUCCESS(rv, rv); if (cancel) { return NS_OK; // rules canceled the operation @@ -1725,15 +1724,13 @@ NS_IMETHODIMP nsHTMLEditor::PasteAsCitedQuotation(const nsAString & aCitation, nsAutoRules beginRulesSniffing(this, kOpInsertQuotation, nsIEditor::eNext); // get selection - nsCOMPtr selection; - nsresult rv = GetSelection(getter_AddRefs(selection)); - NS_ENSURE_SUCCESS(rv, rv); + nsRefPtr selection = GetTypedSelection(); NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER); // give rules a chance to handle or cancel nsTextRulesInfo ruleInfo(kOpInsertElement); bool cancel, handled; - rv = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled); + nsresult rv = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled); NS_ENSURE_SUCCESS(rv, rv); if (cancel || handled) { return NS_OK; // rules canceled the operation @@ -1924,9 +1921,7 @@ nsHTMLEditor::InsertAsPlaintextQuotation(const nsAString & aQuotedText, nsCOMPtr newNode; // get selection - nsCOMPtr selection; - nsresult rv = GetSelection(getter_AddRefs(selection)); - NS_ENSURE_SUCCESS(rv, rv); + nsRefPtr selection = GetTypedSelection(); NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER); nsAutoEditBatch beginBatching(this); @@ -1935,7 +1930,7 @@ nsHTMLEditor::InsertAsPlaintextQuotation(const nsAString & aQuotedText, // give rules a chance to handle or cancel nsTextRulesInfo ruleInfo(kOpInsertElement); bool cancel, handled; - rv = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled); + nsresult rv = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled); NS_ENSURE_SUCCESS(rv, rv); if (cancel || handled) { return NS_OK; // rules canceled the operation @@ -2018,9 +2013,7 @@ nsHTMLEditor::InsertAsCitedQuotation(const nsAString & aQuotedText, nsCOMPtr newNode; // get selection - nsCOMPtr selection; - nsresult rv = GetSelection(getter_AddRefs(selection)); - NS_ENSURE_SUCCESS(rv, rv); + nsRefPtr selection = GetTypedSelection(); NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER); nsAutoEditBatch beginBatching(this); @@ -2029,7 +2022,7 @@ nsHTMLEditor::InsertAsCitedQuotation(const nsAString & aQuotedText, // give rules a chance to handle or cancel nsTextRulesInfo ruleInfo(kOpInsertElement); bool cancel, handled; - rv = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled); + nsresult rv = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled); NS_ENSURE_SUCCESS(rv, rv); if (cancel || handled) { return NS_OK; // rules canceled the operation diff --git a/editor/libeditor/html/nsHTMLEditRules.cpp b/editor/libeditor/html/nsHTMLEditRules.cpp index 9d7683b6ea78..28f57068189b 100644 --- a/editor/libeditor/html/nsHTMLEditRules.cpp +++ b/editor/libeditor/html/nsHTMLEditRules.cpp @@ -515,7 +515,7 @@ nsHTMLEditRules::AfterEditInner(nsEditor::OperationID action, NS_IMETHODIMP -nsHTMLEditRules::WillDoAction(nsISelection *aSelection, +nsHTMLEditRules::WillDoAction(nsTypedSelection *aSelection, nsRulesInfo *aInfo, bool *aCancel, bool *aHandled) diff --git a/editor/libeditor/html/nsHTMLEditRules.h b/editor/libeditor/html/nsHTMLEditRules.h index c60ba590e2e9..236ad7ae7806 100644 --- a/editor/libeditor/html/nsHTMLEditRules.h +++ b/editor/libeditor/html/nsHTMLEditRules.h @@ -60,7 +60,8 @@ public: nsIEditor::EDirection aDirection); NS_IMETHOD AfterEdit(nsEditor::OperationID action, nsIEditor::EDirection aDirection); - NS_IMETHOD WillDoAction(nsISelection *aSelection, nsRulesInfo *aInfo, bool *aCancel, bool *aHandled); + NS_IMETHOD WillDoAction(nsTypedSelection* aSelection, nsRulesInfo* aInfo, + bool* aCancel, bool* aHandled); NS_IMETHOD DidDoAction(nsISelection *aSelection, nsRulesInfo *aInfo, nsresult aResult); NS_IMETHOD DocumentModified(); diff --git a/editor/libeditor/html/nsHTMLEditor.cpp b/editor/libeditor/html/nsHTMLEditor.cpp index 361b3e16a82b..f09772245ed5 100644 --- a/editor/libeditor/html/nsHTMLEditor.cpp +++ b/editor/libeditor/html/nsHTMLEditor.cpp @@ -1699,10 +1699,10 @@ nsHTMLEditor::InsertElementAtSelection(nsIDOMElement* aElement, bool aDeleteSele nsAutoEditBatch beginBatching(this); nsAutoRules beginRulesSniffing(this, kOpInsertElement, nsIEditor::eNext); - nsCOMPtrselection; - res = GetSelection(getter_AddRefs(selection)); - if (NS_FAILED(res) || !selection) + nsRefPtr selection = GetTypedSelection(); + if (!selection) { return NS_ERROR_FAILURE; + } // hand off to the rules system, see if it has anything to say about this bool cancel, handled; @@ -2178,15 +2178,13 @@ nsHTMLEditor::MakeOrChangeList(const nsAString& aListType, bool entireList, cons // Protect the edit rules object from dying nsCOMPtr kungFuDeathGrip(mRules); - nsCOMPtr selection; bool cancel, handled; nsAutoEditBatch beginBatching(this); nsAutoRules beginRulesSniffing(this, kOpMakeList, nsIEditor::eNext); // pre-process - res = GetSelection(getter_AddRefs(selection)); - NS_ENSURE_SUCCESS(res, res); + nsRefPtr selection = GetTypedSelection(); NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER); nsTextRulesInfo ruleInfo(kOpMakeList); @@ -2256,15 +2254,13 @@ nsHTMLEditor::RemoveList(const nsAString& aListType) // Protect the edit rules object from dying nsCOMPtr kungFuDeathGrip(mRules); - nsCOMPtr selection; bool cancel, handled; nsAutoEditBatch beginBatching(this); nsAutoRules beginRulesSniffing(this, kOpRemoveList, nsIEditor::eNext); // pre-process - res = GetSelection(getter_AddRefs(selection)); - NS_ENSURE_SUCCESS(res, res); + nsRefPtr selection = GetTypedSelection(); NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER); nsTextRulesInfo ruleInfo(kOpRemoveList); @@ -2289,15 +2285,13 @@ nsHTMLEditor::MakeDefinitionItem(const nsAString& aItemType) // Protect the edit rules object from dying nsCOMPtr kungFuDeathGrip(mRules); - nsCOMPtr selection; bool cancel, handled; nsAutoEditBatch beginBatching(this); nsAutoRules beginRulesSniffing(this, kOpMakeDefListItem, nsIEditor::eNext); // pre-process - res = GetSelection(getter_AddRefs(selection)); - NS_ENSURE_SUCCESS(res, res); + nsRefPtr selection = GetTypedSelection(); NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER); nsTextRulesInfo ruleInfo(kOpMakeDefListItem); ruleInfo.blockType = &aItemType; @@ -2322,15 +2316,13 @@ nsHTMLEditor::InsertBasicBlock(const nsAString& aBlockType) // Protect the edit rules object from dying nsCOMPtr kungFuDeathGrip(mRules); - nsCOMPtr selection; bool cancel, handled; nsAutoEditBatch beginBatching(this); nsAutoRules beginRulesSniffing(this, kOpMakeBasicBlock, nsIEditor::eNext); // pre-process - res = GetSelection(getter_AddRefs(selection)); - NS_ENSURE_SUCCESS(res, res); + nsRefPtr selection = GetTypedSelection(); NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER); nsTextRulesInfo ruleInfo(kOpMakeBasicBlock); ruleInfo.blockType = &aBlockType; @@ -2404,9 +2396,7 @@ nsHTMLEditor::Indent(const nsAString& aIndent) nsAutoRules beginRulesSniffing(this, opID, nsIEditor::eNext); // pre-process - nsCOMPtr selection; - res = GetSelection(getter_AddRefs(selection)); - NS_ENSURE_SUCCESS(res, res); + nsRefPtr selection = GetTypedSelection(); NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER); nsTextRulesInfo ruleInfo(opID); @@ -2483,13 +2473,11 @@ nsHTMLEditor::Align(const nsAString& aAlignType) bool cancel, handled; // Find out if the selection is collapsed: - nsCOMPtr selection; - nsresult res = GetSelection(getter_AddRefs(selection)); - NS_ENSURE_SUCCESS(res, res); + nsRefPtr selection = GetTypedSelection(); NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER); nsTextRulesInfo ruleInfo(kOpAlign); ruleInfo.alignType = &aAlignType; - res = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled); + nsresult res = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled); if (cancel || NS_FAILED(res)) return res; @@ -4896,12 +4884,7 @@ nsHTMLEditor::SetCSSBackgroundColor(const nsAString& aColor) // Protect the edit rules object from dying nsCOMPtr kungFuDeathGrip(mRules); - nsresult res; - nsCOMPtrselection; - res = GetSelection(getter_AddRefs(selection)); - NS_ENSURE_SUCCESS(res, res); - NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER); - nsCOMPtr selPriv(do_QueryInterface(selection)); + nsRefPtr selection = GetTypedSelection(); bool isCollapsed = selection->Collapsed(); @@ -4912,13 +4895,13 @@ nsHTMLEditor::SetCSSBackgroundColor(const nsAString& aColor) bool cancel, handled; nsTextRulesInfo ruleInfo(kOpSetTextProperty); - res = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled); + nsresult res = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled); NS_ENSURE_SUCCESS(res, res); if (!cancel && !handled) { // get selection range enumerator nsCOMPtr enumerator; - res = selPriv->GetEnumerator(getter_AddRefs(enumerator)); + res = selection->GetEnumerator(getter_AddRefs(enumerator)); NS_ENSURE_SUCCESS(res, res); NS_ENSURE_TRUE(enumerator, NS_ERROR_FAILURE); diff --git a/editor/libeditor/html/nsHTMLEditorStyle.cpp b/editor/libeditor/html/nsHTMLEditorStyle.cpp index 36b3da82579c..73aee4f68ddb 100644 --- a/editor/libeditor/html/nsHTMLEditorStyle.cpp +++ b/editor/libeditor/html/nsHTMLEditorStyle.cpp @@ -88,11 +88,8 @@ nsHTMLEditor::SetInlineProperty(nsIAtom *aProperty, } ForceCompositionEnd(); - nsCOMPtr selection; - nsresult res = GetSelection(getter_AddRefs(selection)); - NS_ENSURE_SUCCESS(res, res); + nsRefPtr selection = GetTypedSelection(); NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER); - nsCOMPtr selPriv(do_QueryInterface(selection)); if (selection->Collapsed()) { // manipulating text attributes on a collapsed selection only sets state @@ -108,12 +105,12 @@ nsHTMLEditor::SetInlineProperty(nsIAtom *aProperty, bool cancel, handled; nsTextRulesInfo ruleInfo(kOpSetTextProperty); - res = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled); + nsresult res = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled); NS_ENSURE_SUCCESS(res, res); if (!cancel && !handled) { // get selection range enumerator nsCOMPtr enumerator; - res = selPriv->GetEnumerator(getter_AddRefs(enumerator)); + res = selection->GetEnumerator(getter_AddRefs(enumerator)); NS_ENSURE_SUCCESS(res, res); NS_ENSURE_TRUE(enumerator, NS_ERROR_FAILURE); @@ -1295,11 +1292,8 @@ nsresult nsHTMLEditor::RemoveInlinePropertyImpl(nsIAtom *aProperty, const nsAStr ForceCompositionEnd(); nsresult res; - nsCOMPtrselection; - res = GetSelection(getter_AddRefs(selection)); - NS_ENSURE_SUCCESS(res, res); + nsRefPtr selection = GetTypedSelection(); NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER); - nsCOMPtr selPriv(do_QueryInterface(selection)); bool useCSS = IsCSSEnabled(); if (selection->Collapsed()) { @@ -1331,7 +1325,7 @@ nsresult nsHTMLEditor::RemoveInlinePropertyImpl(nsIAtom *aProperty, const nsAStr { // get selection range enumerator nsCOMPtr enumerator; - res = selPriv->GetEnumerator(getter_AddRefs(enumerator)); + res = selection->GetEnumerator(getter_AddRefs(enumerator)); NS_ENSURE_SUCCESS(res, res); NS_ENSURE_TRUE(enumerator, NS_ERROR_FAILURE); diff --git a/editor/libeditor/text/nsPlaintextEditor.cpp b/editor/libeditor/text/nsPlaintextEditor.cpp index 54665d4672fd..14d8e94245b4 100644 --- a/editor/libeditor/text/nsPlaintextEditor.cpp +++ b/editor/libeditor/text/nsPlaintextEditor.cpp @@ -718,9 +718,7 @@ nsPlaintextEditor::DeleteSelection(EDirection aAction, nsAutoRules beginRulesSniffing(this, kOpDeleteSelection, aAction); // pre-process - nsCOMPtr selection; - result = GetSelection(getter_AddRefs(selection)); - NS_ENSURE_SUCCESS(result, result); + nsRefPtr selection = GetTypedSelection(); NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER); // If there is an existing selection when an extended delete is requested, @@ -778,9 +776,7 @@ NS_IMETHODIMP nsPlaintextEditor::InsertText(const nsAString &aStringToInsert) nsAutoRules beginRulesSniffing(this, opID, nsIEditor::eNext); // pre-process - nsCOMPtr selection; - nsresult result = GetSelection(getter_AddRefs(selection)); - NS_ENSURE_SUCCESS(result, result); + nsRefPtr selection = GetTypedSelection(); NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER); nsAutoString resultString; // XXX can we trust instring to outlive ruleInfo, @@ -792,8 +788,8 @@ NS_IMETHODIMP nsPlaintextEditor::InsertText(const nsAString &aStringToInsert) ruleInfo.maxLength = mMaxTextLength; bool cancel, handled; - result = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled); - NS_ENSURE_SUCCESS(result, result); + nsresult res = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled); + NS_ENSURE_SUCCESS(res, res); if (!cancel && !handled) { // we rely on rules code for now - no default implementation @@ -801,9 +797,9 @@ NS_IMETHODIMP nsPlaintextEditor::InsertText(const nsAString &aStringToInsert) if (!cancel) { // post-process - result = mRules->DidDoAction(selection, &ruleInfo, result); + res = mRules->DidDoAction(selection, &ruleInfo, res); } - return result; + return res; } NS_IMETHODIMP nsPlaintextEditor::InsertLineBreak() @@ -817,10 +813,7 @@ NS_IMETHODIMP nsPlaintextEditor::InsertLineBreak() nsAutoRules beginRulesSniffing(this, kOpInsertBreak, nsIEditor::eNext); // pre-process - nsCOMPtr selection; - nsresult res; - res = GetSelection(getter_AddRefs(selection)); - NS_ENSURE_SUCCESS(res, res); + nsRefPtr selection = GetTypedSelection(); NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER); // Batching the selection and moving nodes out from under the caret causes @@ -832,7 +825,7 @@ NS_IMETHODIMP nsPlaintextEditor::InsertLineBreak() nsTextRulesInfo ruleInfo(kOpInsertBreak); ruleInfo.maxLength = mMaxTextLength; bool cancel, handled; - res = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled); + nsresult res = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled); NS_ENSURE_SUCCESS(res, res); if (!cancel && !handled) { @@ -876,8 +869,7 @@ NS_IMETHODIMP nsPlaintextEditor::InsertLineBreak() // We want the caret to stick to whatever is past the break. This is // because the break is on the same line we were on, but the next content // will be on the following line. - nsCOMPtr selPriv(do_QueryInterface(selection)); - selPriv->SetInterlinePosition(true); + selection->SetInterlinePosition(true); } } } @@ -1169,8 +1161,7 @@ nsPlaintextEditor::Undo(PRUint32 aCount) nsAutoRules beginRulesSniffing(this, kOpUndo, nsIEditor::eNone); nsTextRulesInfo ruleInfo(kOpUndo); - nsCOMPtr selection; - GetSelection(getter_AddRefs(selection)); + nsRefPtr selection = GetTypedSelection(); bool cancel, handled; nsresult result = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled); @@ -1199,8 +1190,7 @@ nsPlaintextEditor::Redo(PRUint32 aCount) nsAutoRules beginRulesSniffing(this, kOpRedo, nsIEditor::eNone); nsTextRulesInfo ruleInfo(kOpRedo); - nsCOMPtr selection; - GetSelection(getter_AddRefs(selection)); + nsRefPtr selection = GetTypedSelection(); bool cancel, handled; nsresult result = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled); @@ -1474,9 +1464,7 @@ nsPlaintextEditor::InsertAsQuotation(const nsAString& aQuotedText, quotedStuff.Append(PRUnichar('\n')); // get selection - nsCOMPtr selection; - rv = GetSelection(getter_AddRefs(selection)); - NS_ENSURE_SUCCESS(rv, rv); + nsRefPtr selection = GetTypedSelection(); NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER); nsAutoEditBatch beginBatching(this); diff --git a/editor/libeditor/text/nsTextEditRules.cpp b/editor/libeditor/text/nsTextEditRules.cpp index cc27f7d8ffe5..527f651a8443 100644 --- a/editor/libeditor/text/nsTextEditRules.cpp +++ b/editor/libeditor/text/nsTextEditRules.cpp @@ -209,7 +209,7 @@ nsTextEditRules::AfterEdit(nsEditor::OperationID action, NS_IMETHODIMP -nsTextEditRules::WillDoAction(nsISelection *aSelection, +nsTextEditRules::WillDoAction(nsTypedSelection* aSelection, nsRulesInfo *aInfo, bool *aCancel, bool *aHandled) diff --git a/editor/libeditor/text/nsTextEditRules.h b/editor/libeditor/text/nsTextEditRules.h index adba5e1dd4a9..8b06ded748f2 100644 --- a/editor/libeditor/text/nsTextEditRules.h +++ b/editor/libeditor/text/nsTextEditRules.h @@ -42,7 +42,8 @@ public: nsIEditor::EDirection aDirection); NS_IMETHOD AfterEdit(nsEditor::OperationID action, nsIEditor::EDirection aDirection); - NS_IMETHOD WillDoAction(nsISelection *aSelection, nsRulesInfo *aInfo, bool *aCancel, bool *aHandled); + NS_IMETHOD WillDoAction(nsTypedSelection* aSelection, nsRulesInfo* aInfo, + bool* aCancel, bool* aHandled); NS_IMETHOD DidDoAction(nsISelection *aSelection, nsRulesInfo *aInfo, nsresult aResult); NS_IMETHOD DocumentIsEmpty(bool *aDocumentIsEmpty); NS_IMETHOD DocumentModified();