Bug 1776680 [wpt PR 34603] - [@container] Test invalidation of font-relative units...
[gecko.git] / dom / events / InternalMutationEvent.h
blob41a20677e4653aec79f4e7db60fbff6da79d82c1
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_MutationEvent_h__
8 #define mozilla_MutationEvent_h__
10 #include "mozilla/BasicEvents.h"
11 #include "nsCOMPtr.h"
12 #include "nsAtom.h"
13 #include "nsINode.h"
15 namespace mozilla {
17 class InternalMutationEvent : public WidgetEvent {
18 public:
19 virtual InternalMutationEvent* AsMutationEvent() override { return this; }
21 InternalMutationEvent(bool aIsTrusted, EventMessage aMessage)
22 : WidgetEvent(aIsTrusted, aMessage, eMutationEventClass), mAttrChange(0) {
23 mFlags.mCancelable = false;
26 virtual WidgetEvent* Duplicate() const override {
27 MOZ_ASSERT(mClass == eMutationEventClass,
28 "Duplicate() must be overridden by sub class");
29 InternalMutationEvent* result = new InternalMutationEvent(false, mMessage);
30 result->AssignMutationEventData(*this, true);
31 result->mFlags = mFlags;
32 return result;
35 nsCOMPtr<nsINode> mRelatedNode;
36 RefPtr<nsAtom> mAttrName;
37 RefPtr<nsAtom> mPrevAttrValue;
38 RefPtr<nsAtom> mNewAttrValue;
39 unsigned short mAttrChange;
41 void AssignMutationEventData(const InternalMutationEvent& aEvent,
42 bool aCopyTargets) {
43 AssignEventData(aEvent, aCopyTargets);
45 mRelatedNode = aEvent.mRelatedNode;
46 mAttrName = aEvent.mAttrName;
47 mPrevAttrValue = aEvent.mPrevAttrValue;
48 mNewAttrValue = aEvent.mNewAttrValue;
49 mAttrChange = aEvent.mAttrChange;
53 // Bits are actually checked to optimize mutation event firing.
54 // That's why I don't number from 0x00. The first event should
55 // always be 0x01.
56 #define NS_EVENT_BITS_MUTATION_SUBTREEMODIFIED 0x01
57 #define NS_EVENT_BITS_MUTATION_NODEINSERTED 0x02
58 #define NS_EVENT_BITS_MUTATION_NODEREMOVED 0x04
59 #define NS_EVENT_BITS_MUTATION_NODEREMOVEDFROMDOCUMENT 0x08
60 #define NS_EVENT_BITS_MUTATION_NODEINSERTEDINTODOCUMENT 0x10
61 #define NS_EVENT_BITS_MUTATION_ATTRMODIFIED 0x20
62 #define NS_EVENT_BITS_MUTATION_CHARACTERDATAMODIFIED 0x40
64 } // namespace mozilla
66 #endif // mozilla_MutationEvent_h__