Bug 1591417: part 2) Rename HasMutationEventListeners to MaybeHasMutationEventListeners. r=masayuki

After removing all mutation event listeners, the corresponding method
still returns `true`, so the new name is more accurate.

Differential Revision: https://phabricator.services.mozilla.com/D52342

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Mirko Brodesser 2019-11-12 15:20:20 +00:00
parent e5f7410403
commit c4342625ea
3 changed files with 9 additions and 6 deletions

View File

@ -211,7 +211,9 @@ class EditorBase : public nsIEditor,
nsPIDOMWindowInner* GetInnerWindow() const {
return mDocument ? mDocument->GetInnerWindow() : nullptr;
}
bool HasMutationEventListeners(
// @param aMutationEventType One or multiple of NS_EVENT_BITS_MUTATION_*.
// @return true, iff at least one of NS_EVENT_BITS_MUTATION_* is set.
bool MaybeHasMutationEventListeners(
uint32_t aMutationEventType = 0xFFFFFFFF) const {
if (!mIsHTMLEditorClass) {
// DOM mutation event listeners cannot catch the changes of

View File

@ -3930,7 +3930,7 @@ MoveNodeResult HTMLEditor::MoveOneHardLineContents(
NS_WARNING_ASSERTION(NS_SUCCEEDED(rvIgnored),
"DeleteNodeWithTransaction() failed, but ignored");
result.MarkAsHandled();
if (HasMutationEventListeners()) {
if (MaybeHasMutationEventListeners()) {
// Mutation event listener may make `offset` value invalid with
// removing some previous children while we call
// `DeleteNodeWithTransaction()` so that we should adjust it here.
@ -3997,7 +3997,7 @@ MoveNodeResult HTMLEditor::MoveNodeOrChildren(
if (NS_WARN_IF(NS_FAILED(rv))) {
return MoveNodeResult(rv);
}
if (HasMutationEventListeners()) {
if (MaybeHasMutationEventListeners()) {
// Mutation event listener may make `offset` value invalid with
// removing some previous children while we call
// `DeleteNodeWithTransaction()` so that we should adjust it here.

View File

@ -3235,9 +3235,10 @@ nsresult HTMLEditor::DeleteParentBlocksWithTransactionIfEmpty(
// If we have mutation event listeners, the next point is now outside of
// editing host or editing hos has been changed.
if (HasMutationEventListeners(NS_EVENT_BITS_MUTATION_NODEREMOVED |
NS_EVENT_BITS_MUTATION_NODEREMOVEDFROMDOCUMENT |
NS_EVENT_BITS_MUTATION_SUBTREEMODIFIED)) {
if (MaybeHasMutationEventListeners(
NS_EVENT_BITS_MUTATION_NODEREMOVED |
NS_EVENT_BITS_MUTATION_NODEREMOVEDFROMDOCUMENT |
NS_EVENT_BITS_MUTATION_SUBTREEMODIFIED)) {
Element* editingHost = GetActiveEditingHost();
if (NS_WARN_IF(!editingHost) ||
NS_WARN_IF(editingHost != wsObj.GetEditingHost())) {