зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1460509 - part 15: Make HTMLEditRules::WillRemoveAbsolutePosition() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: DXzdtPQ01lo --HG-- extra : rebase_source : 1fa36a1195aa7a6b5d891f83659af155b5bb16c0
This commit is contained in:
Родитель
531991202f
Коммит
8cb4cfda65
|
@ -10232,11 +10232,21 @@ HTMLEditRules::WillRemoveAbsolutePosition(bool* aCancel,
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
AutoSelectionRestorer selectionRestorer(&SelectionRef(), &HTMLEditorRef());
|
||||
{
|
||||
AutoSelectionRestorer selectionRestorer(&SelectionRef(), &HTMLEditorRef());
|
||||
|
||||
nsresult rv = HTMLEditorRef().SetPositionToAbsoluteOrStatic(*element, false);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
nsresult rv = HTMLEditorRef().SetPositionToAbsoluteOrStatic(*element, false);
|
||||
if (NS_WARN_IF(!CanHandleEditAction())) {
|
||||
return NS_ERROR_EDITOR_DESTROYED;
|
||||
}
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
||||
// Restoring Selection might cause destroying the HTML editor.
|
||||
if (NS_WARN_IF(!CanHandleEditAction())) {
|
||||
return NS_ERROR_EDITOR_DESTROYED;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -259,7 +259,18 @@ protected:
|
|||
nsresult WillAlign(const nsAString& aAlignType,
|
||||
bool* aCancel, bool* aHandled);
|
||||
nsresult WillAbsolutePosition(bool* aCancel, bool* aHandled);
|
||||
nsresult WillRemoveAbsolutePosition(bool* aCancel, bool* aHandled);
|
||||
|
||||
/**
|
||||
* Called before changing absolute positioned element to static positioned.
|
||||
* This method actually changes the position property of nearest absolute
|
||||
* positioned element. Therefore, this might cause destroying the HTML
|
||||
* editor.
|
||||
*
|
||||
* @param aCancel Returns true if the operation is canceled.
|
||||
* @param aHandled Returns true if the edit action is handled.
|
||||
*/
|
||||
MOZ_MUST_USE nsresult
|
||||
WillRemoveAbsolutePosition(bool* aCancel, bool* aHandled);
|
||||
|
||||
/**
|
||||
* Called before changing z-index.
|
||||
|
|
Загрузка…
Ссылка в новой задаче