dom/events/MutationEvent.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/events/MutationEvent.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,64 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#ifndef mozilla_dom_MutationEvent_h_
    1.10 +#define mozilla_dom_MutationEvent_h_
    1.11 +
    1.12 +#include "mozilla/EventForwards.h"
    1.13 +#include "mozilla/dom/Event.h"
    1.14 +#include "mozilla/dom/MutationEventBinding.h"
    1.15 +#include "nsIDOMMutationEvent.h"
    1.16 +#include "nsINode.h"
    1.17 +
    1.18 +namespace mozilla {
    1.19 +namespace dom {
    1.20 +
    1.21 +class MutationEvent : public Event,
    1.22 +                      public nsIDOMMutationEvent
    1.23 +{
    1.24 +public:
    1.25 +  MutationEvent(EventTarget* aOwner,
    1.26 +                nsPresContext* aPresContext,
    1.27 +                InternalMutationEvent* aEvent);
    1.28 +
    1.29 +  NS_DECL_ISUPPORTS_INHERITED
    1.30 +
    1.31 +  NS_DECL_NSIDOMMUTATIONEVENT
    1.32 +
    1.33 +  // Forward to base class
    1.34 +  NS_FORWARD_TO_EVENT
    1.35 +
    1.36 +  virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE
    1.37 +  {
    1.38 +    return MutationEventBinding::Wrap(aCx, this);
    1.39 +  }
    1.40 +
    1.41 +  // xpidl implementation
    1.42 +  // GetPrevValue(nsAString& aPrevValue);
    1.43 +  // GetNewValue(nsAString& aNewValue);
    1.44 +  // GetAttrName(nsAString& aAttrName);
    1.45 +
    1.46 +  already_AddRefed<nsINode> GetRelatedNode();
    1.47 +
    1.48 +  uint16_t AttrChange();
    1.49 +
    1.50 +  void InitMutationEvent(const nsAString& aType,
    1.51 +                         bool& aCanBubble, bool& aCancelable,
    1.52 +                         nsINode* aRelatedNode,
    1.53 +                         const nsAString& aPrevValue,
    1.54 +                         const nsAString& aNewValue,
    1.55 +                         const nsAString& aAttrName,
    1.56 +                         uint16_t& aAttrChange, ErrorResult& aRv)
    1.57 +  {
    1.58 +    aRv = InitMutationEvent(aType, aCanBubble, aCancelable,
    1.59 +                            aRelatedNode ? aRelatedNode->AsDOMNode() : nullptr,
    1.60 +                            aPrevValue, aNewValue, aAttrName, aAttrChange);
    1.61 +  }
    1.62 +};
    1.63 +
    1.64 +} // namespace dom
    1.65 +} // namespace mozilla
    1.66 +
    1.67 +#endif // mozilla_dom_MutationEvent_h_

mercurial