Bug 470455 - test_database_sync_embed_visits.js leaks, r=sdwilsh
[wine-gecko.git] / layout / svg / base / src / nsSVGMarkerFrame.h
blob48a2ca62ca26f48d599367f62fde0969c5472d95
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
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/
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.
15 * The Original Code is the Mozilla SVG project.
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.
21 * Contributor(s):
23 * Alternatively, the contents of this file may be used under the terms of
24 * either of the GNU General Public License Version 2 or later (the "GPL"),
25 * or 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.
35 * ***** END LICENSE BLOCK ***** */
37 #ifndef __NS_SVGMARKERFRAME_H__
38 #define __NS_SVGMARKERFRAME_H__
40 #include "nsSVGContainerFrame.h"
42 class gfxContext;
43 class nsSVGPathGeometryFrame;
44 class nsIURI;
45 class nsIContent;
46 struct nsSVGMark;
48 typedef nsSVGContainerFrame nsSVGMarkerFrameBase;
50 class nsSVGMarkerFrame : public nsSVGMarkerFrameBase
52 friend nsIFrame*
53 NS_NewSVGMarkerFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsStyleContext* aContext);
54 protected:
55 nsSVGMarkerFrame(nsStyleContext* aContext) :
56 nsSVGMarkerFrameBase(aContext),
57 mMarkedFrame(nsnull),
58 mInUse(PR_FALSE),
59 mInUse2(PR_FALSE) {}
61 public:
62 // nsIFrame interface:
63 NS_IMETHOD AttributeChanged(PRInt32 aNameSpaceID,
64 nsIAtom* aAttribute,
65 PRInt32 aModType);
66 /**
67 * Get the "type" of the frame
69 * @see nsGkAtoms::svgMarkerFrame
71 virtual nsIAtom* GetType() const;
73 #ifdef DEBUG
74 NS_IMETHOD GetFrameName(nsAString& aResult) const
76 return MakeFrameName(NS_LITERAL_STRING("SVGMarker"), aResult);
78 #endif
80 // nsSVGMarkerFrame methods:
81 nsresult PaintMark(nsSVGRenderState *aContext,
82 nsSVGPathGeometryFrame *aMarkedFrame,
83 nsSVGMark *aMark,
84 float aStrokeWidth);
86 nsRect RegionMark(nsSVGPathGeometryFrame *aMarkedFrame,
87 const nsSVGMark *aMark, float aStrokeWidth);
89 private:
90 // stuff needed for callback
91 nsSVGPathGeometryFrame *mMarkedFrame;
92 float mStrokeWidth, mX, mY, mAngle;
94 // nsSVGContainerFrame methods:
95 virtual already_AddRefed<nsIDOMSVGMatrix> GetCanvasTM();
97 // VC6 does not allow the inner class to access protected members
98 // of the outer class
99 class AutoMarkerReferencer;
100 friend class AutoMarkerReferencer;
102 // A helper class to allow us to paint markers safely. The helper
103 // automatically sets and clears the mInUse flag on the marker frame (to
104 // prevent nasty reference loops) as well as the reference to the marked
105 // frame and its coordinate context. It's easy to mess this up
106 // and break things, so this helper makes the code far more robust.
107 class AutoMarkerReferencer
109 public:
110 AutoMarkerReferencer(nsSVGMarkerFrame *aFrame,
111 nsSVGPathGeometryFrame *aMarkedFrame);
112 ~AutoMarkerReferencer();
113 private:
114 nsSVGMarkerFrame *mFrame;
117 // nsSVGMarkerFrame methods:
118 void SetParentCoordCtxProvider(nsSVGSVGElement *aContext);
120 // recursion prevention flag
121 PRPackedBool mInUse;
123 // second recursion prevention flag, for GetCanvasTM()
124 PRPackedBool mInUse2;
127 #endif