LCOV - app.info - layout/svg/base/src/nsSVGClipPathFrame.h

LCOV - code coverage report
| Current view: | directory - layout/svg/base/src - nsSVGClipPathFrame.h (source / functions) |  | Found | Hit | Coverage |
| Test: | app.info | Lines: | 15 | 0 | 0.0 %
| Date: | 2012-04-21 | Functions: | 6 | 0 | 0.0 %

           1                 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
           2                 : /* ***** BEGIN LICENSE BLOCK *****
           3                 :  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
           4                 :  *
           5                 :  * The contents of this file are subject to the Mozilla Public License Version
           6                 :  * 1.1 (the "License"); you may not use this file except in compliance with
           7                 :  * the License. You may obtain a copy of the License at
           8                 :  * http://www.mozilla.org/MPL/
           9                 :  *
          10                 :  * Software distributed under the License is distributed on an "AS IS" basis,
          11                 :  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
          12                 :  * for the specific language governing rights and limitations under the
          13                 :  * License.
          14                 :  *
          15                 :  * The Original Code is the Mozilla SVG project.
          16                 :  *
          17                 :  * The Initial Developer of the Original Code is IBM Corporation.
          18                 :  * Portions created by the Initial Developer are Copyright (C) 2004
          19                 :  * the Initial Developer. All Rights Reserved.
          20                 :  *
          21                 :  * Contributor(s):
          22                 :  *
          23                 :  * Alternatively, the contents of this file may be used under the terms of
          24                 :  * either the GNU General Public License Version 2 or later (the "GPL"), or
          25                 :  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
          26                 :  * in which case the provisions of the GPL or the LGPL are applicable instead
          27                 :  * of those above. If you wish to allow use of your version of this file only
          28                 :  * under the terms of either the GPL or the LGPL, and not to allow others to
          29                 :  * use your version of this file under the terms of the MPL, indicate your
          30                 :  * decision by deleting the provisions above and replace them with the notice
          31                 :  * and other provisions required by the GPL or the LGPL. If you do not delete
          32                 :  * the provisions above, a recipient may use your version of this file under
          33                 :  * the terms of any one of the MPL, the GPL or the LGPL.
          34                 :  *
          35                 :  * ***** END LICENSE BLOCK ***** */
          36                 :
          37                 : #ifndef __NS_SVGCLIPPATHFRAME_H__
          38                 : #define __NS_SVGCLIPPATHFRAME_H__
          39                 :
          40                 : #include "nsSVGContainerFrame.h"
          41                 : #include "gfxMatrix.h"
          42                 :
          43                 : class nsRenderingContext;
          44                 :
          45                 : typedef nsSVGContainerFrame nsSVGClipPathFrameBase;
          46                 :
          47                 : class nsSVGClipPathFrame : public nsSVGClipPathFrameBase
          48               0 : {
          49                 :   friend nsIFrame*
          50                 :   NS_NewSVGClipPathFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
          51                 : protected:
          52               0 :   nsSVGClipPathFrame(nsStyleContext* aContext)
          53                 :     : nsSVGClipPathFrameBase(aContext)
          54               0 :     , mInUse(false)
          55                 :   {
          56               0 :     AddStateBits(NS_STATE_SVG_NONDISPLAY_CHILD);
          57               0 :   }
          58                 :
          59                 : public:
          60                 :   NS_DECL_FRAMEARENA_HELPERS
          61                 :
          62                 :   // nsSVGClipPathFrame methods:
          63                 :   nsresult ClipPaint(nsRenderingContext* aContext,
          64                 :                      nsIFrame* aParent,
          65                 :                      const gfxMatrix &aMatrix);
          66                 :
          67                 :   bool ClipHitTest(nsIFrame* aParent,
          68                 :                      const gfxMatrix &aMatrix,
          69                 :                      const nsPoint &aPoint);
          70                 :
          71                 :   // Check if this clipPath is made up of more than one geometry object.
          72                 :   // If so, the clipping API in cairo isn't enough and we need to use
          73                 :   // mask based clipping.
          74                 :   bool IsTrivial();
          75                 :
          76                 :   bool IsValid();
          77                 :
          78                 :   // nsIFrame interface:
          79                 :   NS_IMETHOD AttributeChanged(PRInt32         aNameSpaceID,
          80                 :                               nsIAtom*        aAttribute,
          81                 :                               PRInt32         aModType);
          82                 :
          83                 :   NS_IMETHOD Init(nsIContent*      aContent,
          84                 :                   nsIFrame*        aParent,
          85                 :                   nsIFrame*        aPrevInFlow);
          86                 :
          87                 :   /**
          88                 :    * Get the "type" of the frame
          89                 :    *
          90                 :    * @see nsGkAtoms::svgClipPathFrame
          91                 :    */
          92                 :   virtual nsIAtom* GetType() const;
          93                 :
          94                 : #ifdef DEBUG
          95               0 :   NS_IMETHOD GetFrameName(nsAString& aResult) const
          96                 :   {
          97               0 :     return MakeFrameName(NS_LITERAL_STRING("SVGClipPath"), aResult);
          98                 :   }
          99                 : #endif
         100                 :
         101                 :  private:
         102                 :   // A helper class to allow us to paint clip paths safely. The helper
         103                 :   // automatically sets and clears the mInUse flag on the clip path frame
         104                 :   // (to prevent nasty reference loops). It's easy to mess this up
         105                 :   // and break things, so this helper makes the code far more robust.
         106                 :   class AutoClipPathReferencer
         107                 :   {
         108                 :   public:
         109               0 :     AutoClipPathReferencer(nsSVGClipPathFrame *aFrame)
         110               0 :        : mFrame(aFrame) {
         111               0 :       NS_ASSERTION(!mFrame->mInUse, "reference loop!");
         112               0 :       mFrame->mInUse = true;
         113               0 :     }
         114               0 :     ~AutoClipPathReferencer() {
         115               0 :       mFrame->mInUse = false;
         116               0 :     }
         117                 :   private:
         118                 :     nsSVGClipPathFrame *mFrame;
         119                 :   };
         120                 :
         121                 :   nsIFrame *mClipParent;
         122                 :   nsAutoPtr<gfxMatrix> mClipParentMatrix;
         123                 :   // recursion prevention flag
         124                 :   bool mInUse;
         125                 :
         126                 :   // nsSVGContainerFrame methods:
         127                 :   virtual gfxMatrix GetCanvasTM();
         128                 : };
         129                 :
         130                 : #endif

Generated by: LCOV version 1.7