mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-06 00:10:25 +00:00
Bug 1460509 - part 7: Make TextEditRules::DidDeleteSelection() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
And also this patch removes unnecessary arguments from the method. MozReview-Commit-ID: UKscK4vFVX --HG-- extra : rebase_source : 7f6b9405824a3f175f165a2d7d75a293108278f3
This commit is contained in:
parent
d6057a85d0
commit
b2219367ca
@ -3707,7 +3707,7 @@ HTMLEditRules::DidDeleteSelection(nsIEditor::EDirection aDir,
|
||||
}
|
||||
|
||||
// call through to base class
|
||||
return TextEditRules::DidDeleteSelection(aDir, aResult);
|
||||
return TextEditRules::DidDeleteSelection();
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -377,7 +377,7 @@ TextEditRules::DidDoAction(Selection* aSelection,
|
||||
|
||||
switch (aInfo->action) {
|
||||
case EditAction::deleteSelection:
|
||||
return DidDeleteSelection(aInfo->collapsedAction, aResult);
|
||||
return DidDeleteSelection();
|
||||
case EditAction::undo:
|
||||
return DidUndo(aResult);
|
||||
case EditAction::redo:
|
||||
@ -1081,8 +1081,7 @@ TextEditRules::WillDeleteSelection(nsIEditor::EDirection aCollapsedAction,
|
||||
}
|
||||
|
||||
nsresult
|
||||
TextEditRules::DidDeleteSelection(nsIEditor::EDirection aCollapsedAction,
|
||||
nsresult aResult)
|
||||
TextEditRules::DidDeleteSelection()
|
||||
{
|
||||
MOZ_ASSERT(IsEditorDataAvailable());
|
||||
|
||||
@ -1098,6 +1097,9 @@ TextEditRules::DidDeleteSelection(nsIEditor::EDirection aCollapsedAction,
|
||||
nsresult rv =
|
||||
TextEditorRef().DeleteNodeWithTransaction(
|
||||
*selectionStartPoint.GetContainer());
|
||||
if (NS_WARN_IF(!CanHandleEditAction())) {
|
||||
return NS_ERROR_EDITOR_DESTROYED;
|
||||
}
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
@ -149,8 +149,12 @@ protected:
|
||||
nsresult WillDeleteSelection(nsIEditor::EDirection aCollapsedAction,
|
||||
bool* aCancel,
|
||||
bool* aHandled);
|
||||
nsresult DidDeleteSelection(nsIEditor::EDirection aCollapsedAction,
|
||||
nsresult aResult);
|
||||
/**
|
||||
* Called after deleted selected content.
|
||||
* This method may remove empty text node and makes guarantee that caret
|
||||
* is never at left of <br> element.
|
||||
*/
|
||||
MOZ_MUST_USE nsresult DidDeleteSelection();
|
||||
|
||||
nsresult WillSetTextProperty(bool* aCancel, bool* aHandled);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user