зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1460509 - part 9: Make TextEditRules::WillSetText() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: 9ksPugTVVqh --HG-- extra : rebase_source : 25089af1de8fc8429118e773df25ec2788cb75b9
This commit is contained in:
Родитель
04fbe5c6c1
Коммит
d43e448993
|
@ -906,6 +906,9 @@ TextEditRules::WillSetText(bool* aCancel,
|
|||
nsresult rv =
|
||||
TextEditorRef().InsertNodeWithTransaction(
|
||||
*newNode, EditorRawDOMPoint(rootElement, 0));
|
||||
if (NS_WARN_IF(!CanHandleEditAction())) {
|
||||
return NS_ERROR_EDITOR_DESTROYED;
|
||||
}
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
@ -925,6 +928,9 @@ TextEditRules::WillSetText(bool* aCancel,
|
|||
// for performance
|
||||
nsresult rv = TextEditorRef().SetTextImpl(SelectionRef(), tString,
|
||||
*curNode->GetAsText());
|
||||
if (NS_WARN_IF(!CanHandleEditAction())) {
|
||||
return NS_ERROR_EDITOR_DESTROYED;
|
||||
}
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -139,10 +139,20 @@ protected:
|
|||
|
||||
nsresult WillInsertBreak(bool* aCancel, bool* aHandled, int32_t aMaxLength);
|
||||
|
||||
nsresult WillSetText(bool* aCancel,
|
||||
bool* aHandled,
|
||||
const nsAString* inString,
|
||||
int32_t aMaxLength);
|
||||
/**
|
||||
* Called before setting text to the text editor.
|
||||
* This method may actually set text to it. Therefore, this might cause
|
||||
* destroying the text editor.
|
||||
*
|
||||
* @param aCancel Returns true if the operation is canceled.
|
||||
* @param aHandled Returns true if the edit action is handled.
|
||||
* @param inString String to be set.
|
||||
* @param aMaxLength The maximum string length which the text editor
|
||||
* allows to set.
|
||||
*/
|
||||
MOZ_MUST_USE nsresult
|
||||
WillSetText(bool* aCancel, bool* aHandled,
|
||||
const nsAString* inString, int32_t aMaxLength);
|
||||
|
||||
void WillInsert(bool* aCancel);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче