LCOV - code coverage report
Current view: top level - dom/events - MutationEvent.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 54 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 13 0.0 %
Legend: Lines: hit not hit

          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             : #include "nsCOMPtr.h"
       8             : #include "mozilla/dom/MutationEvent.h"
       9             : #include "mozilla/InternalMutationEvent.h"
      10             : 
      11             : class nsPresContext;
      12             : 
      13             : namespace mozilla {
      14             : namespace dom {
      15             : 
      16           0 : MutationEvent::MutationEvent(EventTarget* aOwner,
      17             :                              nsPresContext* aPresContext,
      18           0 :                              InternalMutationEvent* aEvent)
      19             :   : Event(aOwner, aPresContext,
      20           0 :           aEvent ? aEvent : new InternalMutationEvent(false, eVoidEvent))
      21             : {
      22           0 :   mEventIsInternal = (aEvent == nullptr);
      23           0 : }
      24             : 
      25           0 : NS_INTERFACE_MAP_BEGIN(MutationEvent)
      26           0 :   NS_INTERFACE_MAP_ENTRY(nsIDOMMutationEvent)
      27           0 : NS_INTERFACE_MAP_END_INHERITING(Event)
      28             : 
      29           0 : NS_IMPL_ADDREF_INHERITED(MutationEvent, Event)
      30           0 : NS_IMPL_RELEASE_INHERITED(MutationEvent, Event)
      31             : 
      32             : already_AddRefed<nsINode>
      33           0 : MutationEvent::GetRelatedNode()
      34             : {
      35             :   nsCOMPtr<nsINode> n =
      36           0 :     do_QueryInterface(mEvent->AsMutationEvent()->mRelatedNode);
      37           0 :   return n.forget();
      38             : }
      39             : 
      40             : NS_IMETHODIMP
      41           0 : MutationEvent::GetRelatedNode(nsIDOMNode** aRelatedNode)
      42             : {
      43           0 :   nsCOMPtr<nsINode> relatedNode = GetRelatedNode();
      44           0 :   nsCOMPtr<nsIDOMNode> relatedDOMNode = relatedNode ? relatedNode->AsDOMNode() : nullptr;
      45           0 :   relatedDOMNode.forget(aRelatedNode);
      46           0 :   return NS_OK;
      47             : }
      48             : 
      49             : NS_IMETHODIMP
      50           0 : MutationEvent::GetPrevValue(nsAString& aPrevValue)
      51             : {
      52           0 :   InternalMutationEvent* mutation = mEvent->AsMutationEvent();
      53           0 :   if (mutation->mPrevAttrValue)
      54           0 :     mutation->mPrevAttrValue->ToString(aPrevValue);
      55           0 :   return NS_OK;
      56             : }
      57             : 
      58             : NS_IMETHODIMP
      59           0 : MutationEvent::GetNewValue(nsAString& aNewValue)
      60             : {
      61           0 :   InternalMutationEvent* mutation = mEvent->AsMutationEvent();
      62           0 :   if (mutation->mNewAttrValue)
      63           0 :       mutation->mNewAttrValue->ToString(aNewValue);
      64           0 :   return NS_OK;
      65             : }
      66             : 
      67             : NS_IMETHODIMP
      68           0 : MutationEvent::GetAttrName(nsAString& aAttrName)
      69             : {
      70           0 :   InternalMutationEvent* mutation = mEvent->AsMutationEvent();
      71           0 :   if (mutation->mAttrName)
      72           0 :       mutation->mAttrName->ToString(aAttrName);
      73           0 :   return NS_OK;
      74             : }
      75             : 
      76             : uint16_t
      77           0 : MutationEvent::AttrChange()
      78             : {
      79           0 :   return mEvent->AsMutationEvent()->mAttrChange;
      80             : }
      81             : 
      82             : NS_IMETHODIMP
      83           0 : MutationEvent::GetAttrChange(uint16_t* aAttrChange)
      84             : {
      85           0 :   *aAttrChange = AttrChange();
      86           0 :   return NS_OK;
      87             : }
      88             : 
      89             : NS_IMETHODIMP
      90           0 : MutationEvent::InitMutationEvent(const nsAString& aTypeArg,
      91             :                                  bool aCanBubbleArg,
      92             :                                  bool aCancelableArg,
      93             :                                  nsIDOMNode* aRelatedNodeArg,
      94             :                                  const nsAString& aPrevValueArg,
      95             :                                  const nsAString& aNewValueArg,
      96             :                                  const nsAString& aAttrNameArg,
      97             :                                  uint16_t aAttrChangeArg)
      98             : {
      99           0 :   NS_ENSURE_TRUE(!mEvent->mFlags.mIsBeingDispatched, NS_OK);
     100             : 
     101           0 :   Event::InitEvent(aTypeArg, aCanBubbleArg, aCancelableArg);
     102             : 
     103           0 :   InternalMutationEvent* mutation = mEvent->AsMutationEvent();
     104           0 :   mutation->mRelatedNode = aRelatedNodeArg;
     105           0 :   if (!aPrevValueArg.IsEmpty())
     106           0 :     mutation->mPrevAttrValue = NS_Atomize(aPrevValueArg);
     107           0 :   if (!aNewValueArg.IsEmpty())
     108           0 :     mutation->mNewAttrValue = NS_Atomize(aNewValueArg);
     109           0 :   if (!aAttrNameArg.IsEmpty()) {
     110           0 :     mutation->mAttrName = NS_Atomize(aAttrNameArg);
     111             :   }
     112           0 :   mutation->mAttrChange = aAttrChangeArg;
     113             : 
     114           0 :   return NS_OK;
     115             : }
     116             : 
     117             : } // namespace dom
     118             : } // namespace mozilla
     119             : 
     120             : using namespace mozilla;
     121             : using namespace mozilla::dom;
     122             : 
     123             : already_AddRefed<MutationEvent>
     124           0 : NS_NewDOMMutationEvent(EventTarget* aOwner,
     125             :                        nsPresContext* aPresContext,
     126             :                        InternalMutationEvent* aEvent)
     127             : {
     128           0 :   RefPtr<MutationEvent> it = new MutationEvent(aOwner, aPresContext, aEvent);
     129           0 :   return it.forget();
     130             : }

Generated by: LCOV version 1.13