Line data Source code
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/. */
6 :
7 : #ifndef mozilla_dom_MutationEvent_h_
8 : #define mozilla_dom_MutationEvent_h_
9 :
10 : #include "mozilla/EventForwards.h"
11 : #include "mozilla/dom/Event.h"
12 : #include "mozilla/dom/MutationEventBinding.h"
13 : #include "nsIDOMMutationEvent.h"
14 : #include "nsINode.h"
15 :
16 : namespace mozilla {
17 : namespace dom {
18 :
19 : class MutationEvent : public Event,
20 : public nsIDOMMutationEvent
21 : {
22 : public:
23 : MutationEvent(EventTarget* aOwner,
24 : nsPresContext* aPresContext,
25 : InternalMutationEvent* aEvent);
26 :
27 : NS_DECL_ISUPPORTS_INHERITED
28 :
29 : NS_DECL_NSIDOMMUTATIONEVENT
30 :
31 : // Forward to base class
32 0 : NS_FORWARD_TO_EVENT
33 :
34 0 : virtual JSObject* WrapObjectInternal(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override
35 : {
36 0 : return MutationEventBinding::Wrap(aCx, this, aGivenProto);
37 : }
38 :
39 : // xpidl implementation
40 : // GetPrevValue(nsAString& aPrevValue);
41 : // GetNewValue(nsAString& aNewValue);
42 : // GetAttrName(nsAString& aAttrName);
43 :
44 : already_AddRefed<nsINode> GetRelatedNode();
45 :
46 : uint16_t AttrChange();
47 :
48 0 : void InitMutationEvent(const nsAString& aType,
49 : bool& aCanBubble, bool& aCancelable,
50 : nsINode* aRelatedNode,
51 : const nsAString& aPrevValue,
52 : const nsAString& aNewValue,
53 : const nsAString& aAttrName,
54 : uint16_t& aAttrChange, ErrorResult& aRv)
55 : {
56 0 : aRv = InitMutationEvent(aType, aCanBubble, aCancelable,
57 0 : aRelatedNode ? aRelatedNode->AsDOMNode() : nullptr,
58 0 : aPrevValue, aNewValue, aAttrName, aAttrChange);
59 0 : }
60 :
61 : protected:
62 0 : ~MutationEvent() {}
63 : };
64 :
65 : } // namespace dom
66 : } // namespace mozilla
67 :
68 : already_AddRefed<mozilla::dom::MutationEvent>
69 : NS_NewDOMMutationEvent(mozilla::dom::EventTarget* aOwner,
70 : nsPresContext* aPresContext,
71 : mozilla::InternalMutationEvent* aEvent);
72 :
73 : #endif // mozilla_dom_MutationEvent_h_
|