LCOV - code coverage report
Current view: top level - dom/svg - DOMSVGPoint.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 31 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 9 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             : #ifndef MOZILLA_DOMSVGPOINT_H__
       8             : #define MOZILLA_DOMSVGPOINT_H__
       9             : 
      10             : #include "DOMSVGPointList.h"
      11             : #include "mozilla/gfx/2D.h"
      12             : #include "nsDebug.h"
      13             : #include "nsISVGPoint.h"
      14             : #include "SVGPoint.h"
      15             : #include "mozilla/Attributes.h"
      16             : #include "mozilla/FloatingPoint.h"
      17             : 
      18             : class nsSVGElement;
      19             : 
      20             : namespace mozilla {
      21             : 
      22             : namespace dom {
      23             : class SVGMatrix;
      24             : } // namespace dom
      25             : 
      26             : /**
      27             :  * Class DOMSVGPoint
      28             :  *
      29             :  * This class creates the DOM objects that wrap internal SVGPoint objects that
      30             :  * are in an SVGPointList. It is also used to create the objects returned by
      31             :  * SVGSVGElement.createSVGPoint() and other functions that return DOM SVGPoint
      32             :  * objects.
      33             :  *
      34             :  * See the architecture comment in DOMSVGPointList.h for an overview of the
      35             :  * important points regarding these DOM wrapper structures.
      36             :  *
      37             :  * See the architecture comment in DOMSVGLength.h (yes, LENGTH) for an overview
      38             :  * of the important points regarding how this specific class works.
      39             :  */
      40           0 : class DOMSVGPoint final : public nsISVGPoint
      41             : {
      42             :   friend class AutoChangePointNotifier;
      43             : 
      44             :   typedef mozilla::gfx::Point Point;
      45             : 
      46             : public:
      47             :   /**
      48             :    * Generic ctor for DOMSVGPoint objects that are created for an attribute.
      49             :    */
      50           0 :   DOMSVGPoint(DOMSVGPointList *aList,
      51             :               uint32_t aListIndex,
      52             :               bool aIsAnimValItem)
      53           0 :     : nsISVGPoint()
      54             :   {
      55           0 :     mList = aList;
      56           0 :     mListIndex = aListIndex;
      57           0 :     mIsAnimValItem = aIsAnimValItem;
      58             : 
      59             :     // These shifts are in sync with the members.
      60           0 :     MOZ_ASSERT(aList && aListIndex <= MaxListIndex(), "bad arg");
      61             : 
      62           0 :     MOZ_ASSERT(IndexIsValid(), "Bad index for DOMSVGPoint!");
      63           0 :   }
      64             : 
      65           0 :   explicit DOMSVGPoint(const DOMSVGPoint *aPt = nullptr)
      66           0 :     : nsISVGPoint()
      67             :   {
      68           0 :     if (aPt) {
      69           0 :       mPt = aPt->ToSVGPoint();
      70             :     }
      71           0 :   }
      72             : 
      73           0 :   DOMSVGPoint(float aX, float aY)
      74           0 :     : nsISVGPoint()
      75             :   {
      76           0 :     mPt.mX = aX;
      77           0 :     mPt.mY = aY;
      78           0 :   }
      79             : 
      80           0 :   explicit DOMSVGPoint(const Point& aPt)
      81           0 :     : nsISVGPoint()
      82             :   {
      83           0 :     mPt.mX = aPt.x;
      84           0 :     mPt.mY = aPt.y;
      85           0 :     NS_ASSERTION(IsFinite(mPt.mX) && IsFinite(mPt.mX),
      86             :                  "DOMSVGPoint coords are not finite");
      87           0 :   }
      88             : 
      89             : 
      90             :   // WebIDL
      91             :   virtual float X() override;
      92             :   virtual void SetX(float aX, ErrorResult& rv) override;
      93             :   virtual float Y() override;
      94             :   virtual void SetY(float aY, ErrorResult& rv) override;
      95             :   virtual already_AddRefed<nsISVGPoint> MatrixTransform(dom::SVGMatrix& matrix) override;
      96           0 :   nsISupports* GetParentObject() override {
      97           0 :     return mList;
      98             :   }
      99             : 
     100           0 :   virtual DOMSVGPoint* Copy() override {
     101           0 :     return new DOMSVGPoint(this);
     102             :   }
     103             : 
     104             : protected:
     105             : 
     106           0 :   nsSVGElement* Element() {
     107           0 :     return mList->Element();
     108             :   }
     109             : };
     110             : 
     111             : } // namespace mozilla
     112             : 
     113             : #endif // MOZILLA_DOMSVGPOINT_H__

Generated by: LCOV version 1.13