mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-07 11:56:51 +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
|
// call through to base class
|
||||||
return TextEditRules::DidDeleteSelection(aDir, aResult);
|
return TextEditRules::DidDeleteSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
@ -377,7 +377,7 @@ TextEditRules::DidDoAction(Selection* aSelection,
|
|||||||
|
|
||||||
switch (aInfo->action) {
|
switch (aInfo->action) {
|
||||||
case EditAction::deleteSelection:
|
case EditAction::deleteSelection:
|
||||||
return DidDeleteSelection(aInfo->collapsedAction, aResult);
|
return DidDeleteSelection();
|
||||||
case EditAction::undo:
|
case EditAction::undo:
|
||||||
return DidUndo(aResult);
|
return DidUndo(aResult);
|
||||||
case EditAction::redo:
|
case EditAction::redo:
|
||||||
@ -1081,8 +1081,7 @@ TextEditRules::WillDeleteSelection(nsIEditor::EDirection aCollapsedAction,
|
|||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
TextEditRules::DidDeleteSelection(nsIEditor::EDirection aCollapsedAction,
|
TextEditRules::DidDeleteSelection()
|
||||||
nsresult aResult)
|
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(IsEditorDataAvailable());
|
MOZ_ASSERT(IsEditorDataAvailable());
|
||||||
|
|
||||||
@ -1098,6 +1097,9 @@ TextEditRules::DidDeleteSelection(nsIEditor::EDirection aCollapsedAction,
|
|||||||
nsresult rv =
|
nsresult rv =
|
||||||
TextEditorRef().DeleteNodeWithTransaction(
|
TextEditorRef().DeleteNodeWithTransaction(
|
||||||
*selectionStartPoint.GetContainer());
|
*selectionStartPoint.GetContainer());
|
||||||
|
if (NS_WARN_IF(!CanHandleEditAction())) {
|
||||||
|
return NS_ERROR_EDITOR_DESTROYED;
|
||||||
|
}
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
@ -149,8 +149,12 @@ protected:
|
|||||||
nsresult WillDeleteSelection(nsIEditor::EDirection aCollapsedAction,
|
nsresult WillDeleteSelection(nsIEditor::EDirection aCollapsedAction,
|
||||||
bool* aCancel,
|
bool* aCancel,
|
||||||
bool* aHandled);
|
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);
|
nsresult WillSetTextProperty(bool* aCancel, bool* aHandled);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user