Bug 920377 part.1 Get rid of nsMutationEvent r=roc

This commit is contained in:
Masayuki Nakano 2013-09-27 15:20:53 +09:00
parent 966536891f
commit ff562840ca
12 changed files with 18 additions and 19 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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();
}
}

View File

@ -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) {

View File

@ -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);

View File

@ -55,7 +55,4 @@ public:
} // namespace mozilla
// TODO: Remove following typedef
typedef mozilla::InternalMutationEvent nsMutationEvent;
#endif // mozilla_MutationEvent_h__

View File

@ -153,7 +153,8 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsDOMEvent)
static_cast<nsClipboardEvent*>(tmp->mEvent)->clipboardData = nullptr;
break;
case NS_MUTATION_EVENT:
static_cast<nsMutationEvent*>(tmp->mEvent)->mRelatedNode = nullptr;
static_cast<InternalMutationEvent*>(tmp->mEvent)->mRelatedNode =
nullptr;
break;
case NS_FOCUS_EVENT:
static_cast<nsFocusEvent*>(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<nsMutationEvent*>(tmp->mEvent)->mRelatedNode);
static_cast<InternalMutationEvent*>(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<nsMutationEvent*>(mEvent);
InternalMutationEvent* mutationEvent =
new InternalMutationEvent(false, msg);
InternalMutationEvent* oldMutationEvent =
static_cast<InternalMutationEvent*>(mEvent);
mutationEvent->AssignMutationEventData(*oldMutationEvent, true);
newEvent = mutationEvent;
break;

View File

@ -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();

View File

@ -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<nsMutationEvent*>(aEvent));
static_cast<InternalMutationEvent*>(aEvent));
case NS_GUI_EVENT:
case NS_SCROLLPORT_EVENT:
case NS_UI_EVENT:

View File

@ -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,

View File

@ -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__