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
18 : * Crocodile Clips Ltd..
19 : * Portions created by the Initial Developer are Copyright (C) 2002
20 : * the Initial Developer. All Rights Reserved.
21 : *
22 : * Contributor(s):
23 : * Alex Fritze <alex.fritze@crocodile-clips.com> (original author)
24 : *
25 : * Alternatively, the contents of this file may be used under the terms of
26 : * either of the GNU General Public License Version 2 or later (the "GPL"),
27 : * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 : * in which case the provisions of the GPL or the LGPL are applicable instead
29 : * of those above. If you wish to allow use of your version of this file only
30 : * under the terms of either the GPL or the LGPL, and not to allow others to
31 : * use your version of this file under the terms of the MPL, indicate your
32 : * decision by deleting the provisions above and replace them with the notice
33 : * and other provisions required by the GPL or the LGPL. If you do not delete
34 : * the provisions above, a recipient may use your version of this file under
35 : * the terms of any one of the MPL, the GPL or the LGPL.
36 : *
37 : * ***** END LICENSE BLOCK ***** */
38 :
39 : #ifndef __NS_SVGPATHGEOMETRYFRAME_H__
40 : #define __NS_SVGPATHGEOMETRYFRAME_H__
41 :
42 : #include "nsFrame.h"
43 : #include "nsISVGChildFrame.h"
44 : #include "nsSVGUtils.h"
45 : #include "nsGkAtoms.h"
46 : #include "nsSVGGeometryFrame.h"
47 :
48 : class nsRenderingContext;
49 : class nsSVGMarkerFrame;
50 : class nsSVGMarkerProperty;
51 :
52 : typedef nsSVGGeometryFrame nsSVGPathGeometryFrameBase;
53 :
54 : class nsSVGPathGeometryFrame : public nsSVGPathGeometryFrameBase,
55 : public nsISVGChildFrame
56 0 : {
57 : friend nsIFrame*
58 : NS_NewSVGPathGeometryFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
59 : protected:
60 0 : nsSVGPathGeometryFrame(nsStyleContext* aContext) :
61 0 : nsSVGPathGeometryFrameBase(aContext) {}
62 :
63 : public:
64 : NS_DECL_QUERYFRAME
65 : NS_DECL_FRAMEARENA_HELPERS
66 :
67 : // nsIFrame interface:
68 : NS_IMETHOD AttributeChanged(PRInt32 aNameSpaceID,
69 : nsIAtom* aAttribute,
70 : PRInt32 aModType);
71 :
72 : virtual void DidSetStyleContext(nsStyleContext* aOldStyleContext);
73 :
74 : /**
75 : * Get the "type" of the frame
76 : *
77 : * @see nsGkAtoms::svgPathGeometryFrame
78 : */
79 : virtual nsIAtom* GetType() const;
80 :
81 : #ifdef DEBUG
82 0 : NS_IMETHOD GetFrameName(nsAString& aResult) const
83 : {
84 0 : return MakeFrameName(NS_LITERAL_STRING("SVGPathGeometry"), aResult);
85 : }
86 : #endif
87 :
88 : // nsSVGGeometryFrame methods
89 : gfxMatrix GetCanvasTM();
90 :
91 : protected:
92 : // nsISVGChildFrame interface:
93 : NS_IMETHOD PaintSVG(nsRenderingContext *aContext,
94 : const nsIntRect *aDirtyRect);
95 : NS_IMETHOD_(nsIFrame*) GetFrameForPoint(const nsPoint &aPoint);
96 : NS_IMETHOD_(nsRect) GetCoveredRegion();
97 : NS_IMETHOD UpdateCoveredRegion();
98 : NS_IMETHOD InitialUpdate();
99 : virtual void NotifySVGChanged(PRUint32 aFlags);
100 : virtual void NotifyRedrawSuspended();
101 : virtual void NotifyRedrawUnsuspended();
102 : virtual gfxRect GetBBoxContribution(const gfxMatrix &aToBBoxUserspace,
103 : PRUint32 aFlags);
104 0 : NS_IMETHOD_(bool) IsDisplayContainer() { return false; }
105 0 : NS_IMETHOD_(bool) HasValidCoveredRect() {
106 0 : return !(GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD);
107 : }
108 :
109 : protected:
110 : void GeneratePath(gfxContext *aContext,
111 : const gfxMatrix *aOverrideTransform = nsnull);
112 :
113 : private:
114 : void Render(nsRenderingContext *aContext);
115 :
116 : struct MarkerProperties {
117 : nsSVGMarkerProperty* mMarkerStart;
118 : nsSVGMarkerProperty* mMarkerMid;
119 : nsSVGMarkerProperty* mMarkerEnd;
120 :
121 0 : bool MarkersExist() const {
122 0 : return mMarkerStart || mMarkerMid || mMarkerEnd;
123 : }
124 :
125 : nsSVGMarkerFrame *GetMarkerStartFrame();
126 : nsSVGMarkerFrame *GetMarkerMidFrame();
127 : nsSVGMarkerFrame *GetMarkerEndFrame();
128 : };
129 :
130 : /**
131 : * @param aFrame should be the first continuation
132 : */
133 : static MarkerProperties GetMarkerProperties(nsSVGPathGeometryFrame *aFrame);
134 : };
135 :
136 : #endif // __NS_SVGPATHGEOMETRYFRAME_H__
|