LCOV - code coverage report
Current view: top level - layout/svg - nsSVGMarkerFrame.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 23 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 13 0.0 %
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_SVGMARKERFRAME_H__
       7             : #define __NS_SVGMARKERFRAME_H__
       8             : 
       9             : #include "mozilla/Attributes.h"
      10             : #include "gfxMatrix.h"
      11             : #include "gfxRect.h"
      12             : #include "nsFrame.h"
      13             : #include "nsLiteralString.h"
      14             : #include "nsQueryFrame.h"
      15             : #include "nsSVGContainerFrame.h"
      16             : #include "nsSVGUtils.h"
      17             : 
      18             : class gfxContext;
      19             : 
      20             : namespace mozilla {
      21             : class SVGGeometryFrame;
      22             : namespace dom {
      23             : class SVGSVGElement;
      24             : } // namespace dom
      25             : } // namespace mozilla
      26             : 
      27             : struct nsSVGMark;
      28             : 
      29           0 : class nsSVGMarkerFrame final : public nsSVGContainerFrame
      30             : {
      31             :   typedef mozilla::image::imgDrawingParams imgDrawingParams;
      32             : 
      33             :   friend class nsSVGMarkerAnonChildFrame;
      34             :   friend nsContainerFrame*
      35             :   NS_NewSVGMarkerFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
      36             : protected:
      37           0 :   explicit nsSVGMarkerFrame(nsStyleContext* aContext)
      38           0 :     : nsSVGContainerFrame(aContext, kClassID)
      39             :     , mMarkedFrame(nullptr)
      40             :     , mInUse(false)
      41           0 :     , mInUse2(false)
      42             :   {
      43           0 :     AddStateBits(NS_FRAME_IS_NONDISPLAY);
      44           0 :   }
      45             : 
      46             : public:
      47           0 :   NS_DECL_FRAMEARENA_HELPERS(nsSVGMarkerFrame)
      48             : 
      49             :   // nsIFrame interface:
      50             : #ifdef DEBUG
      51             :   virtual void Init(nsIContent*       aContent,
      52             :                     nsContainerFrame* aParent,
      53             :                     nsIFrame*         aPrevInFlow) override;
      54             : #endif
      55             : 
      56           0 :   virtual void BuildDisplayList(nsDisplayListBuilder*   aBuilder,
      57             :                                 const nsRect&           aDirtyRect,
      58           0 :                                 const nsDisplayListSet& aLists) override {}
      59             : 
      60             :   virtual nsresult AttributeChanged(int32_t         aNameSpaceID,
      61             :                                     nsIAtom*        aAttribute,
      62             :                                     int32_t         aModType) override;
      63             : 
      64             : #ifdef DEBUG_FRAME_DUMP
      65           0 :   virtual nsresult GetFrameName(nsAString& aResult) const override
      66             :   {
      67           0 :     return MakeFrameName(NS_LITERAL_STRING("SVGMarker"), aResult);
      68             :   }
      69             : #endif
      70             : 
      71           0 :   virtual nsContainerFrame* GetContentInsertionFrame() override {
      72             :     // Any children must be added to our single anonymous inner frame kid.
      73           0 :     MOZ_ASSERT(PrincipalChildList().FirstChild() &&
      74             :                PrincipalChildList().FirstChild()->IsSVGMarkerAnonChildFrame(),
      75             :                "Where is our anonymous child?");
      76           0 :     return PrincipalChildList().FirstChild()->GetContentInsertionFrame();
      77             :   }
      78             : 
      79             :   // nsSVGMarkerFrame methods:
      80             :   void PaintMark(gfxContext& aContext,
      81             :                  const gfxMatrix& aToMarkedFrameUserSpace,
      82             :                  mozilla::SVGGeometryFrame* aMarkedFrame,
      83             :                  const nsSVGMark& aMark,
      84             :                  float aStrokeWidth,
      85             :                  imgDrawingParams& aImgParams);
      86             : 
      87             :   SVGBBox GetMarkBBoxContribution(const Matrix& aToBBoxUserspace,
      88             :                                   uint32_t aFlags,
      89             :                                   mozilla::SVGGeometryFrame* aMarkedFrame,
      90             :                                   const nsSVGMark& aMark,
      91             :                                   float aStrokeWidth);
      92             : 
      93             :   // Return our anonymous box child.
      94             :   void AppendDirectlyOwnedAnonBoxes(nsTArray<OwnedAnonBox>& aResult) override;
      95             : 
      96             : private:
      97             :   // stuff needed for callback
      98             :   mozilla::SVGGeometryFrame *mMarkedFrame;
      99             :   Matrix mMarkerTM;
     100             : 
     101             :   // nsSVGContainerFrame methods:
     102             :   virtual gfxMatrix GetCanvasTM() override;
     103             : 
     104             :   // A helper class to allow us to paint markers safely. The helper
     105             :   // automatically sets and clears the mInUse flag on the marker frame (to
     106             :   // prevent nasty reference loops) as well as the reference to the marked
     107             :   // frame and its coordinate context. It's easy to mess this up
     108             :   // and break things, so this helper makes the code far more robust.
     109             :   class MOZ_RAII AutoMarkerReferencer
     110             :   {
     111             :   public:
     112             :     AutoMarkerReferencer(nsSVGMarkerFrame *aFrame,
     113             :                          mozilla::SVGGeometryFrame *aMarkedFrame
     114             :                          MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
     115             :     ~AutoMarkerReferencer();
     116             :   private:
     117             :     nsSVGMarkerFrame *mFrame;
     118             :     MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
     119             :   };
     120             : 
     121             :   // nsSVGMarkerFrame methods:
     122             :   void SetParentCoordCtxProvider(mozilla::dom::SVGSVGElement *aContext);
     123             : 
     124             :   // recursion prevention flag
     125             :   bool mInUse;
     126             : 
     127             :   // second recursion prevention flag, for GetCanvasTM()
     128             :   bool mInUse2;
     129             : };
     130             : 
     131             : ////////////////////////////////////////////////////////////////////////
     132             : // nsMarkerAnonChildFrame class
     133             : 
     134           0 : class nsSVGMarkerAnonChildFrame final : public nsSVGDisplayContainerFrame
     135             : {
     136             :   friend nsContainerFrame*
     137             :   NS_NewSVGMarkerAnonChildFrame(nsIPresShell* aPresShell,
     138             :                                 nsStyleContext* aContext);
     139             : 
     140           0 :   explicit nsSVGMarkerAnonChildFrame(nsStyleContext* aContext)
     141           0 :     : nsSVGDisplayContainerFrame(aContext, kClassID)
     142           0 :   {}
     143             : 
     144             : public:
     145           0 :   NS_DECL_FRAMEARENA_HELPERS(nsSVGMarkerAnonChildFrame)
     146             : 
     147             : #ifdef DEBUG
     148             :   virtual void Init(nsIContent*       aContent,
     149             :                     nsContainerFrame* aParent,
     150             :                     nsIFrame*         aPrevInFlow) override;
     151             : #endif
     152             : 
     153             : #ifdef DEBUG_FRAME_DUMP
     154           0 :   virtual nsresult GetFrameName(nsAString& aResult) const override {
     155           0 :     return MakeFrameName(NS_LITERAL_STRING("SVGMarkerAnonChild"), aResult);
     156             :   }
     157             : #endif
     158             : 
     159             :   // nsSVGContainerFrame methods:
     160           0 :   virtual gfxMatrix GetCanvasTM() override
     161             :   {
     162           0 :     return static_cast<nsSVGMarkerFrame*>(GetParent())->GetCanvasTM();
     163             :   }
     164             : };
     165             : #endif

Generated by: LCOV version 1.13