dom/events/InternalMutationEvent.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     2 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 #ifndef mozilla_MutationEvent_h__
     7 #define mozilla_MutationEvent_h__
     9 #include "mozilla/BasicEvents.h"
    10 #include "nsCOMPtr.h"
    11 #include "nsIAtom.h"
    12 #include "nsIDOMNode.h"
    14 namespace mozilla {
    16 class InternalMutationEvent : public WidgetEvent
    17 {
    18 public:
    19   virtual InternalMutationEvent* AsMutationEvent() MOZ_OVERRIDE { return this; }
    21   InternalMutationEvent(bool aIsTrusted, uint32_t aMessage) :
    22     WidgetEvent(aIsTrusted, aMessage, NS_MUTATION_EVENT),
    23     mAttrChange(0)
    24   {
    25     mFlags.mCancelable = false;
    26   }
    28   virtual WidgetEvent* Duplicate() const MOZ_OVERRIDE
    29   {
    30     MOZ_ASSERT(eventStructType == NS_MUTATION_EVENT,
    31                "Duplicate() must be overridden by sub class");
    32     InternalMutationEvent* result = new InternalMutationEvent(false, message);
    33     result->AssignMutationEventData(*this, true);
    34     result->mFlags = mFlags;
    35     return result;
    36   }
    38   nsCOMPtr<nsIDOMNode> mRelatedNode;
    39   nsCOMPtr<nsIAtom>    mAttrName;
    40   nsCOMPtr<nsIAtom>    mPrevAttrValue;
    41   nsCOMPtr<nsIAtom>    mNewAttrValue;
    42   unsigned short       mAttrChange;
    44   void AssignMutationEventData(const InternalMutationEvent& aEvent,
    45                                bool aCopyTargets)
    46   {
    47     AssignEventData(aEvent, aCopyTargets);
    49     mRelatedNode = aEvent.mRelatedNode;
    50     mAttrName = aEvent.mAttrName;
    51     mPrevAttrValue = aEvent.mPrevAttrValue;
    52     mNewAttrValue = aEvent.mNewAttrValue;
    53     mAttrChange = aEvent.mAttrChange;
    54   }
    55 };
    57 // Bits are actually checked to optimize mutation event firing.
    58 // That's why I don't number from 0x00.  The first event should
    59 // always be 0x01.
    60 #define NS_EVENT_BITS_MUTATION_SUBTREEMODIFIED                0x01
    61 #define NS_EVENT_BITS_MUTATION_NODEINSERTED                   0x02
    62 #define NS_EVENT_BITS_MUTATION_NODEREMOVED                    0x04
    63 #define NS_EVENT_BITS_MUTATION_NODEREMOVEDFROMDOCUMENT        0x08
    64 #define NS_EVENT_BITS_MUTATION_NODEINSERTEDINTODOCUMENT       0x10
    65 #define NS_EVENT_BITS_MUTATION_ATTRMODIFIED                   0x20
    66 #define NS_EVENT_BITS_MUTATION_CHARACTERDATAMODIFIED          0x40
    68 } // namespace mozilla
    70 #endif // mozilla_MutationEvent_h__

mercurial