Bug 1460509 - part 68: Mark HTMLEditRules::DidMakeBasicBlock() as MOZ_MUST_USE since it may return NS_ERROR_EDITOR_DESTROYED r?m_kato
MozReview-Commit-ID: 5ZxF0ArbnLU
--- a/editor/libeditor/HTMLEditRules.cpp
+++ b/editor/libeditor/HTMLEditRules.cpp
@@ -763,19 +763,19 @@ HTMLEditRules::DidDoAction(Selection* aS
case EditAction::insertIMEText:
return NS_OK;
case EditAction::deleteSelection:
return DidDeleteSelection(aInfo->collapsedAction, aResult);
case EditAction::makeBasicBlock:
case EditAction::indent:
case EditAction::outdent:
case EditAction::align:
- return DidMakeBasicBlock(aInfo, aResult);
+ return DidMakeBasicBlock();
case EditAction::setAbsolutePosition: {
- nsresult rv = DidMakeBasicBlock(aInfo, aResult);
+ nsresult rv = DidMakeBasicBlock();
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
return DidAbsolutePosition();
}
default:
return TextEditRules::DidDoAction(aSelection, aInfo, aResult);
}
@@ -4478,18 +4478,17 @@ HTMLEditRules::MakeBasicBlock(nsAtom& bl
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
}
return NS_OK;
}
nsresult
-HTMLEditRules::DidMakeBasicBlock(RulesInfo* aInfo,
- nsresult aResult)
+HTMLEditRules::DidMakeBasicBlock()
{
MOZ_ASSERT(IsEditorDataAvailable());
// check for empty block. if so, put a moz br in it.
if (!SelectionRef().IsCollapsed()) {
return NS_OK;
}
--- a/editor/libeditor/HTMLEditRules.h
+++ b/editor/libeditor/HTMLEditRules.h
@@ -401,17 +401,23 @@ protected:
MOZ_MUST_USE nsresult
WillRelativeChangeZIndex(int32_t aChange, bool* aCancel, bool* aHandled);
nsresult WillMakeDefListItem(const nsAString* aBlockType, bool aEntireList,
bool* aCancel, bool* aHandled);
nsresult WillMakeBasicBlock(const nsAString& aBlockType,
bool* aCancel, bool* aHandled);
nsresult MakeBasicBlock(nsAtom& aBlockType);
- nsresult DidMakeBasicBlock(RulesInfo* aInfo, nsresult aResult);
+
+ /**
+ * Called after creating a basic block, indenting, outdenting or aligning
+ * contents. This method inserts moz-<br> element if start container of
+ * Selection needs it.
+ */
+ MOZ_MUST_USE nsresult DidMakeBasicBlock();
/**
* Called before changing an element to absolute positioned.
* This method only prepares the operation since DidAbsolutePosition() will
* change it actually later. mNewBlock is set to the target element and
* if necessary, some ancestor nodes of selection may be split.
*
* @param aCancel Returns true if the operation is canceled.