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_dom_MutationEvent_h_
8 #define mozilla_dom_MutationEvent_h_
10 #include "mozilla/EventForwards.h"
11 #include "mozilla/dom/Event.h"
12 #include "mozilla/dom/MutationEventBinding.h"
15 namespace mozilla::dom
{
17 class MutationEvent
: public Event
{
19 MutationEvent(EventTarget
* aOwner
, nsPresContext
* aPresContext
,
20 InternalMutationEvent
* aEvent
);
22 NS_INLINE_DECL_REFCOUNTING_INHERITED(MutationEvent
, Event
)
24 virtual JSObject
* WrapObjectInternal(
25 JSContext
* aCx
, JS::Handle
<JSObject
*> aGivenProto
) override
{
26 return MutationEvent_Binding::Wrap(aCx
, this, aGivenProto
);
29 void GetPrevValue(nsAString
& aPrevValue
) const;
30 void GetNewValue(nsAString
& aNewValue
) const;
31 void GetAttrName(nsAString
& aAttrName
) const;
33 nsINode
* GetRelatedNode();
35 uint16_t AttrChange();
37 void InitMutationEvent(const nsAString
& aType
, bool aCanBubble
,
38 bool aCancelable
, nsINode
* aRelatedNode
,
39 const nsAString
& aPrevValue
,
40 const nsAString
& aNewValue
, const nsAString
& aAttrName
,
41 uint16_t& aAttrChange
, ErrorResult
& aRv
);
44 ~MutationEvent() = default;
47 } // namespace mozilla::dom
49 already_AddRefed
<mozilla::dom::MutationEvent
> NS_NewDOMMutationEvent(
50 mozilla::dom::EventTarget
* aOwner
, nsPresContext
* aPresContext
,
51 mozilla::InternalMutationEvent
* aEvent
);
53 #endif // mozilla_dom_MutationEvent_h_