From ff562840ca61636bce1b931430a493577c2b6459 Mon Sep 17 00:00:00 2001 From: Masayuki Nakano Date: Fri, 27 Sep 2013 15:20:53 +0900 Subject: [PATCH] Bug 920377 part.1 Get rid of nsMutationEvent r=roc --- content/base/src/Element.cpp | 4 ++-- content/base/src/FragmentOrElement.cpp | 2 +- content/base/src/nsContentUtils.cpp | 2 +- content/base/src/nsDocument.cpp | 2 +- content/base/src/nsGenericDOMDataNode.cpp | 2 +- content/base/src/nsINode.cpp | 2 +- content/events/public/MutationEvent.h | 3 --- content/events/src/nsDOMEvent.cpp | 12 +++++++----- content/events/src/nsDOMMutationEvent.h | 3 ++- content/events/src/nsEventDispatcher.cpp | 2 +- dom/interfaces/events/nsIDOMEvent.idl | 2 +- widget/EventForwards.h | 1 - 12 files changed, 18 insertions(+), 19 deletions(-) diff --git a/content/base/src/Element.cpp b/content/base/src/Element.cpp index 6a1bf632ed19..9479e395ba6e 100644 --- a/content/base/src/Element.cpp +++ b/content/base/src/Element.cpp @@ -1730,7 +1730,7 @@ Element::SetAttrAndNotify(int32_t aNamespaceID, } if (aFireMutation) { - nsMutationEvent mutation(true, NS_MUTATION_ATTRMODIFIED); + InternalMutationEvent mutation(true, NS_MUTATION_ATTRMODIFIED); nsAutoString ns; nsContentUtils::NameSpaceManager()->GetNameSpaceURI(aNamespaceID, ns); @@ -1911,7 +1911,7 @@ Element::UnsetAttr(int32_t aNameSpaceID, nsIAtom* aName, } if (hasMutationListeners) { - nsMutationEvent mutation(true, NS_MUTATION_ATTRMODIFIED); + InternalMutationEvent mutation(true, NS_MUTATION_ATTRMODIFIED); mutation.mRelatedNode = attrNode; mutation.mAttrName = aName; diff --git a/content/base/src/FragmentOrElement.cpp b/content/base/src/FragmentOrElement.cpp index 8d0dbd219ebd..bf0d8cf833fa 100644 --- a/content/base/src/FragmentOrElement.cpp +++ b/content/base/src/FragmentOrElement.cpp @@ -1021,7 +1021,7 @@ FragmentOrElement::FireNodeInserted(nsIDocument* aDoc, if (nsContentUtils::HasMutationListeners(childContent, NS_EVENT_BITS_MUTATION_NODEINSERTED, aParent)) { - nsMutationEvent mutation(true, NS_MUTATION_NODEINSERTED); + InternalMutationEvent mutation(true, NS_MUTATION_NODEINSERTED); mutation.mRelatedNode = do_QueryInterface(aParent); mozAutoSubtreeModified subtree(aDoc, aParent); diff --git a/content/base/src/nsContentUtils.cpp b/content/base/src/nsContentUtils.cpp index d7b18d8c6ba7..646e4bf1c4db 100644 --- a/content/base/src/nsContentUtils.cpp +++ b/content/base/src/nsContentUtils.cpp @@ -3708,7 +3708,7 @@ nsContentUtils::MaybeFireNodeRemoved(nsINode* aChild, nsINode* aParent, if (HasMutationListeners(aChild, NS_EVENT_BITS_MUTATION_NODEREMOVED, aParent)) { - nsMutationEvent mutation(true, NS_MUTATION_NODEREMOVED); + InternalMutationEvent mutation(true, NS_MUTATION_NODEREMOVED); mutation.mRelatedNode = do_QueryInterface(aParent); mozAutoSubtreeModified subtree(aOwnerDoc, aParent); diff --git a/content/base/src/nsDocument.cpp b/content/base/src/nsDocument.cpp index 61f4364e6dc6..51c9f0eb0abd 100644 --- a/content/base/src/nsDocument.cpp +++ b/content/base/src/nsDocument.cpp @@ -8194,7 +8194,7 @@ nsDocument::MutationEventDispatched(nsINode* aTarget) int32_t realTargetCount = realTargets.Count(); for (int32_t k = 0; k < realTargetCount; ++k) { - nsMutationEvent mutation(true, NS_MUTATION_SUBTREEMODIFIED); + InternalMutationEvent mutation(true, NS_MUTATION_SUBTREEMODIFIED); (new nsAsyncDOMEvent(realTargets[k], mutation))->RunDOMEventWhenSafe(); } } diff --git a/content/base/src/nsGenericDOMDataNode.cpp b/content/base/src/nsGenericDOMDataNode.cpp index 52cba268f1cb..21677055e0fb 100644 --- a/content/base/src/nsGenericDOMDataNode.cpp +++ b/content/base/src/nsGenericDOMDataNode.cpp @@ -363,7 +363,7 @@ nsGenericDOMDataNode::SetTextInternal(uint32_t aOffset, uint32_t aCount, nsNodeUtils::CharacterDataChanged(this, &info); if (haveMutationListeners) { - nsMutationEvent mutation(true, NS_MUTATION_CHARACTERDATAMODIFIED); + InternalMutationEvent mutation(true, NS_MUTATION_CHARACTERDATAMODIFIED); mutation.mPrevAttrValue = oldValue; if (aLength > 0) { diff --git a/content/base/src/nsINode.cpp b/content/base/src/nsINode.cpp index cf4a72fe5fc1..497de8896677 100644 --- a/content/base/src/nsINode.cpp +++ b/content/base/src/nsINode.cpp @@ -1405,7 +1405,7 @@ nsINode::doInsertChildAt(nsIContent* aKid, uint32_t aIndex, if (nsContentUtils::HasMutationListeners(aKid, NS_EVENT_BITS_MUTATION_NODEINSERTED, this)) { - nsMutationEvent mutation(true, NS_MUTATION_NODEINSERTED); + InternalMutationEvent mutation(true, NS_MUTATION_NODEINSERTED); mutation.mRelatedNode = do_QueryInterface(this); mozAutoSubtreeModified subtree(OwnerDoc(), this); diff --git a/content/events/public/MutationEvent.h b/content/events/public/MutationEvent.h index a57f6e4614d4..d1b275a95fc6 100644 --- a/content/events/public/MutationEvent.h +++ b/content/events/public/MutationEvent.h @@ -55,7 +55,4 @@ public: } // namespace mozilla -// TODO: Remove following typedef -typedef mozilla::InternalMutationEvent nsMutationEvent; - #endif // mozilla_MutationEvent_h__ diff --git a/content/events/src/nsDOMEvent.cpp b/content/events/src/nsDOMEvent.cpp index 7f297de29aee..00b14b53d564 100644 --- a/content/events/src/nsDOMEvent.cpp +++ b/content/events/src/nsDOMEvent.cpp @@ -153,7 +153,8 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsDOMEvent) static_cast(tmp->mEvent)->clipboardData = nullptr; break; case NS_MUTATION_EVENT: - static_cast(tmp->mEvent)->mRelatedNode = nullptr; + static_cast(tmp->mEvent)->mRelatedNode = + nullptr; break; case NS_FOCUS_EVENT: static_cast(tmp->mEvent)->relatedTarget = nullptr; @@ -198,7 +199,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsDOMEvent) case NS_MUTATION_EVENT: NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mEvent->mRelatedNode"); cb.NoteXPCOMChild( - static_cast(tmp->mEvent)->mRelatedNode); + static_cast(tmp->mEvent)->mRelatedNode); break; case NS_FOCUS_EVENT: NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mEvent->relatedTarget"); @@ -635,9 +636,10 @@ nsDOMEvent::DuplicatePrivateData() } case NS_MUTATION_EVENT: { - nsMutationEvent* mutationEvent = new nsMutationEvent(false, msg); - nsMutationEvent* oldMutationEvent = - static_cast(mEvent); + InternalMutationEvent* mutationEvent = + new InternalMutationEvent(false, msg); + InternalMutationEvent* oldMutationEvent = + static_cast(mEvent); mutationEvent->AssignMutationEventData(*oldMutationEvent, true); newEvent = mutationEvent; break; diff --git a/content/events/src/nsDOMMutationEvent.h b/content/events/src/nsDOMMutationEvent.h index 662024313167..c40dd654e06b 100644 --- a/content/events/src/nsDOMMutationEvent.h +++ b/content/events/src/nsDOMMutationEvent.h @@ -17,7 +17,8 @@ class nsDOMMutationEvent : public nsDOMEvent, { public: nsDOMMutationEvent(mozilla::dom::EventTarget* aOwner, - nsPresContext* aPresContext, nsMutationEvent* aEvent); + nsPresContext* aPresContext, + mozilla::InternalMutationEvent* aEvent); virtual ~nsDOMMutationEvent(); diff --git a/content/events/src/nsEventDispatcher.cpp b/content/events/src/nsEventDispatcher.cpp index 0c67cc0e406b..1de38cab1c28 100644 --- a/content/events/src/nsEventDispatcher.cpp +++ b/content/events/src/nsEventDispatcher.cpp @@ -690,7 +690,7 @@ nsEventDispatcher::CreateEvent(mozilla::dom::EventTarget* aOwner, switch(aEvent->eventStructType) { case NS_MUTATION_EVENT: return NS_NewDOMMutationEvent(aDOMEvent, aOwner, aPresContext, - static_cast(aEvent)); + static_cast(aEvent)); case NS_GUI_EVENT: case NS_SCROLLPORT_EVENT: case NS_UI_EVENT: diff --git a/dom/interfaces/events/nsIDOMEvent.idl b/dom/interfaces/events/nsIDOMEvent.idl index be6eb5ff2b5d..c5fd4c493bd8 100644 --- a/dom/interfaces/events/nsIDOMEvent.idl +++ b/dom/interfaces/events/nsIDOMEvent.idl @@ -283,7 +283,7 @@ nsresult NS_NewDOMMutationEvent(nsIDOMEvent** aResult, mozilla::dom::EventTarget* aOwner, nsPresContext* aPresContext, - nsMutationEvent* aEvent); + mozilla::InternalMutationEvent* aEvent); nsresult NS_NewDOMDeviceMotionEvent(nsIDOMEvent** aResult, mozilla::dom::EventTarget* aOwner, diff --git a/widget/EventForwards.h b/widget/EventForwards.h index 58e5b5fd2de0..25b83a5f505a 100644 --- a/widget/EventForwards.h +++ b/widget/EventForwards.h @@ -139,6 +139,5 @@ typedef mozilla::InternalAnimationEvent nsAnimationEvent; typedef mozilla::WidgetContentCommandEvent nsContentCommandEvent; typedef mozilla::WidgetCommandEvent nsCommandEvent; typedef mozilla::WidgetPluginEvent nsPluginEvent; -typedef mozilla::InternalMutationEvent nsMutationEvent; #endif // mozilla_EventForwards_h__