LCOV - code coverage report
Current view: top level - dom/svg - nsISVGPoint.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 37 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 11 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 "nsISVGPoint.h"
       8             : #include "DOMSVGPointList.h"
       9             : #include "SVGPoint.h"
      10             : #include "nsSVGElement.h"
      11             : #include "nsError.h"
      12             : #include "mozilla/dom/SVGPointBinding.h"
      13             : 
      14             : // See the architecture comment in DOMSVGPointList.h.
      15             : 
      16             : using namespace mozilla;
      17             : 
      18             : // We could use NS_IMPL_CYCLE_COLLECTION(, except that in Unlink() we need to
      19             : // clear our list's weak ref to us to be safe. (The other option would be to
      20             : // not unlink and rely on the breaking of the other edges in the cycle, as
      21             : // NS_SVG_VAL_IMPL_CYCLE_COLLECTION does.)
      22             : NS_IMPL_CYCLE_COLLECTION_CLASS(nsISVGPoint)
      23             : 
      24           0 : NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsISVGPoint)
      25             :   // We may not belong to a list, so we must null check tmp->mList.
      26           0 :   if (tmp->mList) {
      27           0 :     tmp->mList->mItems[tmp->mListIndex] = nullptr;
      28             :   }
      29           0 : NS_IMPL_CYCLE_COLLECTION_UNLINK(mList)
      30           0 : NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
      31           0 : NS_IMPL_CYCLE_COLLECTION_UNLINK_END
      32             : 
      33           0 : NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsISVGPoint)
      34           0 : NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mList)
      35           0 : NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
      36             : 
      37           0 : NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(nsISVGPoint)
      38           0 : NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER
      39           0 : NS_IMPL_CYCLE_COLLECTION_TRACE_END
      40             : 
      41           0 : NS_IMPL_CYCLE_COLLECTING_ADDREF(nsISVGPoint)
      42           0 : NS_IMPL_CYCLE_COLLECTING_RELEASE(nsISVGPoint)
      43             : 
      44           0 : NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsISVGPoint)
      45           0 :   NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
      46           0 :   NS_INTERFACE_MAP_ENTRY(nsISVGPoint)
      47           0 :   NS_INTERFACE_MAP_ENTRY(nsISupports)
      48           0 : NS_INTERFACE_MAP_END
      49             : 
      50             : void
      51           0 : nsISVGPoint::InsertingIntoList(DOMSVGPointList *aList,
      52             :                                uint32_t aListIndex,
      53             :                                bool aIsAnimValItem)
      54             : {
      55           0 :   MOZ_ASSERT(!HasOwner(), "Inserting item that already has an owner");
      56             : 
      57           0 :   mList = aList;
      58           0 :   mListIndex = aListIndex;
      59           0 :   mIsReadonly = false;
      60           0 :   mIsAnimValItem = aIsAnimValItem;
      61             : 
      62           0 :   MOZ_ASSERT(IndexIsValid(), "Bad index for DOMSVGPoint!");
      63           0 : }
      64             : 
      65             : void
      66           0 : nsISVGPoint::RemovingFromList()
      67             : {
      68           0 :   mPt = InternalItem();
      69           0 :   mList = nullptr;
      70           0 :   MOZ_ASSERT(!mIsReadonly, "mIsReadonly set for list");
      71           0 :   mIsAnimValItem = false;
      72           0 : }
      73             : 
      74             : SVGPoint&
      75           0 : nsISVGPoint::InternalItem()
      76             : {
      77           0 :   return mList->InternalList().mItems[mListIndex];
      78             : }
      79             : 
      80             : #ifdef DEBUG
      81             : bool
      82           0 : nsISVGPoint::IndexIsValid()
      83             : {
      84           0 :   return mListIndex < mList->InternalList().Length();
      85             : }
      86             : #endif
      87             : 

Generated by: LCOV version 1.13