LCOV - code coverage report
Current view: top level - dom/svg - SVGTransformableElement.h (source / functions) Hit Total Coverage
Test: output.info Lines: 5 6 83.3 %
Date: 2017-07-14 16:53:18 Functions: 3 5 60.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 SVGTransformableElement_h
       8             : #define SVGTransformableElement_h
       9             : 
      10             : #include "mozilla/Attributes.h"
      11             : #include "nsAutoPtr.h"
      12             : #include "nsSVGAnimatedTransformList.h"
      13             : #include "nsSVGElement.h"
      14             : #include "gfxMatrix.h"
      15             : #include "mozilla/gfx/Matrix.h"
      16             : 
      17             : namespace mozilla {
      18             : namespace dom {
      19             : 
      20             : class SVGAnimatedTransformList;
      21             : class SVGGraphicsElement;
      22             : class SVGMatrix;
      23             : class SVGIRect;
      24             : struct SVGBoundingBoxOptions;
      25             : 
      26             : class SVGTransformableElement : public nsSVGElement
      27             : {
      28             : public:
      29         149 :   explicit SVGTransformableElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
      30         149 :     : nsSVGElement(aNodeInfo) {}
      31           0 :   virtual ~SVGTransformableElement() {}
      32             : 
      33             :   virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
      34             :                          bool aPreallocateChildren) const override = 0;
      35             : 
      36             :   // WebIDL
      37             :   already_AddRefed<SVGAnimatedTransformList> Transform();
      38             :   nsSVGElement* GetNearestViewportElement();
      39             :   nsSVGElement* GetFarthestViewportElement();
      40             :   already_AddRefed<SVGIRect> GetBBox(const SVGBoundingBoxOptions& aOptions,
      41             :                                      ErrorResult& rv);
      42             :   already_AddRefed<SVGMatrix> GetCTM();
      43             :   already_AddRefed<SVGMatrix> GetScreenCTM();
      44             :   already_AddRefed<SVGMatrix> GetTransformToElement(SVGGraphicsElement& aElement,
      45             :                                                     ErrorResult& rv);
      46             : 
      47             :   // nsIContent interface
      48             :   NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const override;
      49             : 
      50             :   nsChangeHint GetAttributeChangeHint(const nsIAtom* aAttribute,
      51             :                                       int32_t aModType) const override;
      52             : 
      53             : 
      54             :   // nsSVGElement overrides
      55             :   virtual bool IsEventAttributeNameInternal(nsIAtom* aName) override;
      56             : 
      57             : 
      58             :   virtual gfxMatrix PrependLocalTransformsTo(
      59             :     const gfxMatrix &aMatrix,
      60             :     SVGTransformTypes aWhich = eAllTransforms) const override;
      61             :   virtual const gfx::Matrix* GetAnimateMotionTransform() const override;
      62             :   virtual void SetAnimateMotionTransform(const gfx::Matrix* aMatrix) override;
      63             : 
      64             :   virtual nsSVGAnimatedTransformList*
      65             :     GetAnimatedTransformList(uint32_t aFlags = 0) override;
      66         121 :   virtual nsIAtom* GetTransformListAttrName() const override {
      67         121 :     return nsGkAtoms::transform;
      68             :   }
      69             : 
      70          34 :   virtual bool IsTransformable() override { return true; }
      71             : 
      72             : protected:
      73             :   /**
      74             :    * Helper for overrides of PrependLocalTransformsTo.  If both arguments are
      75             :    * provided they are multiplied in the order in which the arguments appear,
      76             :    * and the result is returned.  If neither argument is provided, the identity
      77             :    * matrix is returned.  If only one argument is provided its transform is
      78             :    * returned.
      79             :    */
      80             :   static gfxMatrix GetUserToParentTransform(
      81             :                      const gfx::Matrix* aAnimateMotionTransform,
      82             :                      const nsSVGAnimatedTransformList* aTransforms);
      83             : 
      84             :   nsAutoPtr<nsSVGAnimatedTransformList> mTransforms;
      85             : 
      86             :   // XXX maybe move this to property table, to save space on un-animated elems?
      87             :   nsAutoPtr<gfx::Matrix> mAnimateMotionTransform;
      88             : };
      89             : 
      90             : } // namespace dom
      91             : } // namespace mozilla
      92             : 
      93             : #endif // SVGTransformableElement_h

Generated by: LCOV version 1.13