LCOV - code coverage report
Current view: top level - layout/svg - nsSVGMaskFrame.h (source / functions) Hit Total Coverage
Test: output.info Lines: 6 15 40.0 %
Date: 2017-07-14 16:53:18 Functions: 2 7 28.6 %
Legend: Lines: hit not hit

          Line data    Source code
       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/. */
       5             : 
       6             : #ifndef __NS_SVGMASKFRAME_H__
       7             : #define __NS_SVGMASKFRAME_H__
       8             : 
       9             : #include "mozilla/Attributes.h"
      10             : #include "mozilla/gfx/2D.h"
      11             : #include "mozilla/RefPtr.h"
      12             : #include "gfxPattern.h"
      13             : #include "gfxMatrix.h"
      14             : #include "nsSVGContainerFrame.h"
      15             : #include "nsSVGUtils.h"
      16             : 
      17             : class gfxContext;
      18             : 
      19           0 : class nsSVGMaskFrame final : public nsSVGContainerFrame
      20             : {
      21             :   friend nsIFrame*
      22             :   NS_NewSVGMaskFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
      23             : 
      24             :   typedef mozilla::gfx::Matrix Matrix;
      25             :   typedef mozilla::gfx::SourceSurface SourceSurface;
      26             :   typedef mozilla::image::imgDrawingParams imgDrawingParams;
      27             : 
      28             : protected:
      29           2 :   explicit nsSVGMaskFrame(nsStyleContext* aContext)
      30           2 :     : nsSVGContainerFrame(aContext, kClassID)
      31           2 :     , mInUse(false)
      32             :   {
      33           2 :     AddStateBits(NS_FRAME_IS_NONDISPLAY);
      34           2 :   }
      35             : 
      36             : public:
      37           4 :   NS_DECL_FRAMEARENA_HELPERS(nsSVGMaskFrame)
      38             : 
      39             :   struct MaskParams {
      40             :     gfxContext* ctx;
      41             :     nsIFrame* maskedFrame;
      42             :     const gfxMatrix& toUserSpace;
      43             :     float opacity;
      44             :     Matrix* maskTransform;
      45             :     uint8_t maskMode;
      46             :     imgDrawingParams& imgParams;
      47             : 
      48           0 :     explicit MaskParams(gfxContext* aCtx, nsIFrame* aMaskedFrame,
      49             :                         const gfxMatrix& aToUserSpace, float aOpacity,
      50             :                         Matrix* aMaskTransform, uint8_t aMaskMode,
      51             :                         imgDrawingParams& aImgParams)
      52           0 :     : ctx(aCtx), maskedFrame(aMaskedFrame), toUserSpace(aToUserSpace),
      53             :       opacity(aOpacity), maskTransform(aMaskTransform), maskMode(aMaskMode),
      54           0 :       imgParams(aImgParams)
      55           0 :     { }
      56             :   };
      57             : 
      58             :   // nsSVGMaskFrame method:
      59             : 
      60             :   /**
      61             :    * Generate a mask surface for the target frame.
      62             :    *
      63             :    * The return surface can be null, it's the caller's responsibility to
      64             :    * null-check before dereferencing.
      65             :    */
      66             :   already_AddRefed<SourceSurface>
      67             :   GetMaskForMaskedFrame(MaskParams& aParams);
      68             : 
      69             :   gfxRect
      70             :   GetMaskArea(nsIFrame* aMaskedFrame);
      71             : 
      72             :   virtual nsresult AttributeChanged(int32_t         aNameSpaceID,
      73             :                                     nsIAtom*        aAttribute,
      74             :                                     int32_t         aModType) override;
      75             : 
      76             : #ifdef DEBUG
      77             :   virtual void Init(nsIContent*       aContent,
      78             :                     nsContainerFrame* aParent,
      79             :                     nsIFrame*         aPrevInFlow) override;
      80             : #endif
      81             : 
      82           0 :   virtual void BuildDisplayList(nsDisplayListBuilder*   aBuilder,
      83             :                                 const nsRect&           aDirtyRect,
      84           0 :                                 const nsDisplayListSet& aLists) override {}
      85             : 
      86             : #ifdef DEBUG_FRAME_DUMP
      87           0 :   virtual nsresult GetFrameName(nsAString& aResult) const override
      88             :   {
      89           0 :     return MakeFrameName(NS_LITERAL_STRING("SVGMask"), aResult);
      90             :   }
      91             : #endif
      92             : 
      93             : private:
      94             :   /**
      95             :    * If the mask element transforms its children due to
      96             :    * maskContentUnits="objectBoundingBox" being set on it, this function
      97             :    * returns the resulting transform.
      98             :    */
      99             :   gfxMatrix GetMaskTransform(nsIFrame* aMaskedFrame);
     100             : 
     101             :   gfxMatrix mMatrixForChildren;
     102             :   // recursion prevention flag
     103             :   bool mInUse;
     104             : 
     105             :   // nsSVGContainerFrame methods:
     106             :   virtual gfxMatrix GetCanvasTM() override;
     107             : };
     108             : 
     109             : #endif

Generated by: LCOV version 1.13