2015-05-03 22:32:37 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-05-21 15:12:37 +04: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 11:25:18 +03:00
|
|
|
|
2013-09-24 14:04:16 +04:00
|
|
|
#ifndef mozilla_MutationEvent_h__
|
|
|
|
#define mozilla_MutationEvent_h__
|
2004-05-22 01:54:32 +04:00
|
|
|
|
2013-09-24 14:04:16 +04:00
|
|
|
#include "mozilla/BasicEvents.h"
|
|
|
|
#include "nsCOMPtr.h"
|
2017-10-03 01:05:19 +03:00
|
|
|
#include "nsAtom.h"
|
2018-05-30 05:58:49 +03:00
|
|
|
#include "nsINode.h"
|
2013-09-24 14:04:16 +04:00
|
|
|
|
|
|
|
namespace mozilla {
|
2004-01-12 11:25:18 +03:00
|
|
|
|
2013-09-24 14:04:16 +04:00
|
|
|
class InternalMutationEvent : public WidgetEvent {
|
2005-04-29 03:48:28 +04:00
|
|
|
public:
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual InternalMutationEvent* AsMutationEvent() override { return this; }
|
2013-10-18 10:10:20 +04:00
|
|
|
|
2015-08-26 15:56:59 +03:00
|
|
|
InternalMutationEvent(bool aIsTrusted, EventMessage aMessage)
|
2014-08-04 09:28:57 +04:00
|
|
|
: WidgetEvent(aIsTrusted, aMessage, eMutationEventClass), mAttrChange(0) {
|
2012-12-16 05:26:03 +04:00
|
|
|
mFlags.mCancelable = false;
|
2004-01-12 11:25:18 +03:00
|
|
|
}
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual WidgetEvent* Duplicate() const override {
|
2014-08-04 09:28:57 +04:00
|
|
|
MOZ_ASSERT(mClass == eMutationEventClass,
|
2014-01-27 10:10:44 +04:00
|
|
|
"Duplicate() must be overridden by sub class");
|
2015-08-22 04:34:51 +03:00
|
|
|
InternalMutationEvent* result = new InternalMutationEvent(false, mMessage);
|
2014-01-27 10:10:44 +04:00
|
|
|
result->AssignMutationEventData(*this, true);
|
|
|
|
result->mFlags = mFlags;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2018-05-30 05:58:49 +03:00
|
|
|
nsCOMPtr<nsINode> mRelatedNode;
|
2017-10-03 01:05:19 +03:00
|
|
|
RefPtr<nsAtom> mAttrName;
|
|
|
|
RefPtr<nsAtom> mPrevAttrValue;
|
|
|
|
RefPtr<nsAtom> mNewAttrValue;
|
2006-03-09 21:14:17 +03:00
|
|
|
unsigned short mAttrChange;
|
2013-09-03 15:45:30 +04:00
|
|
|
|
2013-09-24 14:04:16 +04:00
|
|
|
void AssignMutationEventData(const InternalMutationEvent& aEvent,
|
|
|
|
bool aCopyTargets) {
|
2013-09-03 15:45:30 +04:00
|
|
|
AssignEventData(aEvent, aCopyTargets);
|
|
|
|
|
|
|
|
mRelatedNode = aEvent.mRelatedNode;
|
|
|
|
mAttrName = aEvent.mAttrName;
|
|
|
|
mPrevAttrValue = aEvent.mPrevAttrValue;
|
|
|
|
mNewAttrValue = aEvent.mNewAttrValue;
|
|
|
|
mAttrChange = aEvent.mAttrChange;
|
|
|
|
}
|
2000-11-27 10:55:20 +03: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-22 01:54:32 +04:00
|
|
|
|
2013-09-24 14:04:16 +04:00
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_MutationEvent_h__
|