2004-01-12 08:25:18 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 11:12:37 +00:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2004-01-12 08:25:18 +00:00
|
|
|
|
2013-09-24 10:04:16 +00:00
|
|
|
#ifndef mozilla_MutationEvent_h__
|
|
|
|
#define mozilla_MutationEvent_h__
|
2004-05-21 21:54:32 +00:00
|
|
|
|
2013-09-24 10:04:16 +00:00
|
|
|
#include "mozilla/BasicEvents.h"
|
|
|
|
#include "nsCOMPtr.h"
|
2000-11-27 07:55:20 +00:00
|
|
|
#include "nsIAtom.h"
|
2013-09-24 10:04:16 +00:00
|
|
|
#include "nsIDOMNode.h"
|
|
|
|
|
|
|
|
namespace mozilla {
|
2004-01-12 08:25:18 +00:00
|
|
|
|
2013-09-24 10:04:16 +00:00
|
|
|
class InternalMutationEvent : public WidgetEvent
|
2005-04-28 23:48:28 +00:00
|
|
|
{
|
|
|
|
public:
|
2013-10-18 06:10:20 +00:00
|
|
|
virtual InternalMutationEvent* AsMutationEvent() MOZ_OVERRIDE { return this; }
|
|
|
|
|
2013-09-24 10:04:16 +00:00
|
|
|
InternalMutationEvent(bool aIsTrusted, uint32_t aMessage) :
|
|
|
|
WidgetEvent(aIsTrusted, aMessage, NS_MUTATION_EVENT),
|
|
|
|
mAttrChange(0)
|
2004-01-12 08:25:18 +00:00
|
|
|
{
|
2012-12-16 01:26:03 +00:00
|
|
|
mFlags.mCancelable = false;
|
2004-01-12 08:25:18 +00:00
|
|
|
}
|
|
|
|
|
2014-01-27 06:10:44 +00:00
|
|
|
virtual WidgetEvent* Duplicate() const MOZ_OVERRIDE
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(eventStructType == NS_MUTATION_EVENT,
|
|
|
|
"Duplicate() must be overridden by sub class");
|
|
|
|
InternalMutationEvent* result = new InternalMutationEvent(false, message);
|
|
|
|
result->AssignMutationEventData(*this, true);
|
|
|
|
result->mFlags = mFlags;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2000-11-27 07:55:20 +00:00
|
|
|
nsCOMPtr<nsIDOMNode> mRelatedNode;
|
2006-03-09 18:14:17 +00:00
|
|
|
nsCOMPtr<nsIAtom> mAttrName;
|
|
|
|
nsCOMPtr<nsIAtom> mPrevAttrValue;
|
|
|
|
nsCOMPtr<nsIAtom> mNewAttrValue;
|
|
|
|
unsigned short mAttrChange;
|
2013-09-03 11:45:30 +00:00
|
|
|
|
2013-09-24 10:04:16 +00:00
|
|
|
void AssignMutationEventData(const InternalMutationEvent& aEvent,
|
|
|
|
bool aCopyTargets)
|
2013-09-03 11:45:30 +00:00
|
|
|
{
|
|
|
|
AssignEventData(aEvent, aCopyTargets);
|
|
|
|
|
|
|
|
mRelatedNode = aEvent.mRelatedNode;
|
|
|
|
mAttrName = aEvent.mAttrName;
|
|
|
|
mPrevAttrValue = aEvent.mPrevAttrValue;
|
|
|
|
mNewAttrValue = aEvent.mNewAttrValue;
|
|
|
|
mAttrChange = aEvent.mAttrChange;
|
|
|
|
}
|
2000-11-27 07:55:20 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// Bits are actually checked to optimize mutation event firing.
|
|
|
|
// That's why I don't number from 0x00. The first event should
|
|
|
|
// always be 0x01.
|
|
|
|
#define NS_EVENT_BITS_MUTATION_SUBTREEMODIFIED 0x01
|
|
|
|
#define NS_EVENT_BITS_MUTATION_NODEINSERTED 0x02
|
|
|
|
#define NS_EVENT_BITS_MUTATION_NODEREMOVED 0x04
|
|
|
|
#define NS_EVENT_BITS_MUTATION_NODEREMOVEDFROMDOCUMENT 0x08
|
|
|
|
#define NS_EVENT_BITS_MUTATION_NODEINSERTEDINTODOCUMENT 0x10
|
|
|
|
#define NS_EVENT_BITS_MUTATION_ATTRMODIFIED 0x20
|
|
|
|
#define NS_EVENT_BITS_MUTATION_CHARACTERDATAMODIFIED 0x40
|
2004-05-21 21:54:32 +00:00
|
|
|
|
2013-09-24 10:04:16 +00:00
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_MutationEvent_h__
|