Back to index

lightning-sunbird  0.9+nobinonly
nsSVGPathGeometryFrame.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is the Mozilla SVG project.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Crocodile Clips Ltd..
00019  * Portions created by the Initial Developer are Copyright (C) 2002
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *   Alex Fritze <alex.fritze@crocodile-clips.com> (original author)
00024  *
00025  * Alternatively, the contents of this file may be used under the terms of
00026  * either of the GNU General Public License Version 2 or later (the "GPL"),
00027  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00028  * in which case the provisions of the GPL or the LGPL are applicable instead
00029  * of those above. If you wish to allow use of your version of this file only
00030  * under the terms of either the GPL or the LGPL, and not to allow others to
00031  * use your version of this file under the terms of the MPL, indicate your
00032  * decision by deleting the provisions above and replace them with the notice
00033  * and other provisions required by the GPL or the LGPL. If you do not delete
00034  * the provisions above, a recipient may use your version of this file under
00035  * the terms of any one of the MPL, the GPL or the LGPL.
00036  *
00037  * ***** END LICENSE BLOCK ***** */
00038 
00039 #ifndef __NS_SVGPATHGEOMETRYFRAME_H__
00040 #define __NS_SVGPATHGEOMETRYFRAME_H__
00041 
00042 #include "nsFrame.h"
00043 #include "nsISVGChildFrame.h"
00044 #include "nsISVGPathGeometrySource.h"
00045 #include "nsISVGRendererPathGeometry.h"
00046 #include "nsWeakReference.h"
00047 #include "nsISVGValue.h"
00048 #include "nsISVGValueObserver.h"
00049 #include "nsISVGOuterSVGFrame.h"
00050 #include "nsSVGGradient.h"
00051 #include "nsLayoutAtoms.h"
00052 
00053 class nsPresContext;
00054 class nsIDOMSVGMatrix;
00055 class nsISVGRendererRegion;
00056 class nsSVGMarkerFrame;
00057 
00058 typedef nsFrame nsSVGPathGeometryFrameBase;
00059 
00060 class nsSVGPathGeometryFrame : public nsSVGPathGeometryFrameBase,
00061                                public nsISVGValueObserver,
00062                                public nsSupportsWeakReference,
00063                                public nsISVGPathGeometrySource,
00064                                public nsISVGChildFrame
00065 {
00066 protected:
00067   nsSVGPathGeometryFrame();
00068   virtual ~nsSVGPathGeometryFrame();
00069   
00070 public:
00071    // nsISupports interface:
00072   NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
00073   NS_IMETHOD_(nsrefcnt) AddRef() { return NS_OK; }
00074   NS_IMETHOD_(nsrefcnt) Release() { return NS_OK; }
00075 
00076   // nsIFrame interface:
00077   NS_IMETHOD
00078   Init(nsPresContext*  aPresContext,
00079        nsIContent*      aContent,
00080        nsIFrame*        aParent,
00081        nsStyleContext*  aContext,
00082        nsIFrame*        aPrevInFlow);
00083 
00084   NS_IMETHOD  AttributeChanged(nsIContent*     aChild,
00085                                PRInt32         aNameSpaceID,
00086                                nsIAtom*        aAttribute,
00087                                PRInt32         aModType);
00088 
00089   NS_IMETHOD DidSetStyleContext(nsPresContext* aPresContext);
00090 
00096   virtual nsIAtom* GetType() const;
00097   virtual PRBool IsFrameOfType(PRUint32 aFlags) const;
00098 
00099 #ifdef DEBUG
00100   NS_IMETHOD GetFrameName(nsAString& aResult) const
00101   {
00102     return MakeFrameName(NS_LITERAL_STRING("SVGPathGeometry"), aResult);
00103   }
00104 #endif
00105 
00106 protected:
00107   
00108   // nsISVGValueObserver
00109   NS_IMETHOD WillModifySVGObservable(nsISVGValue* observable,
00110                                      nsISVGValue::modificationType aModType);
00111   NS_IMETHOD DidModifySVGObservable (nsISVGValue* observable,
00112                                      nsISVGValue::modificationType aModType);
00113 
00114   // nsISVGChildFrame interface:
00115   NS_IMETHOD PaintSVG(nsISVGRendererCanvas* canvas, const nsRect& dirtyRectTwips);
00116   NS_IMETHOD GetFrameForPointSVG(float x, float y, nsIFrame** hit);
00117   NS_IMETHOD_(already_AddRefed<nsISVGRendererRegion>) GetCoveredRegion();
00118   NS_IMETHOD InitialUpdate();
00119   NS_IMETHOD NotifyCanvasTMChanged();
00120   NS_IMETHOD NotifyRedrawSuspended();
00121   NS_IMETHOD NotifyRedrawUnsuspended();
00122   NS_IMETHOD SetMatrixPropagation(PRBool aPropagate);
00123   NS_IMETHOD GetBBox(nsIDOMSVGRect **_retval);
00124   
00125   // nsISupportsWeakReference
00126   // implementation inherited from nsSupportsWeakReference
00127   
00128   // nsISVGGeometrySource interface: 
00129   NS_DECL_NSISVGGEOMETRYSOURCE
00130   
00131   // nsISVGPathGeometrySource interface:
00132   NS_IMETHOD GetHittestMask(PRUint16 *aHittestMask);
00133   NS_IMETHOD GetShapeRendering(PRUint16 *aShapeRendering);
00134   // to be implemented by subclass:
00135   //NS_IMETHOD ConstructPath(nsISVGRendererPathBuilder *pathBuilder) = 0;
00136   
00137 protected:
00138   NS_IMETHOD InitSVG();
00139   void UpdateGraphic(PRUint32 flags);
00140   nsISVGOuterSVGFrame *GetOuterSVGFrame();
00141   nsISVGRendererPathGeometry *GetGeometry();
00142 
00143   nsCOMPtr<nsISVGRendererRegion> mMarkerRegion;
00144 
00145 private:
00146   nsCOMPtr<nsISVGRendererPathGeometry> mGeometry;
00147   PRUint32 mUpdateFlags;
00148   PRBool mPropagateTransform;
00149   nsCOMPtr<nsISVGGradient>     mFillGradient;
00150   nsCOMPtr<nsISVGGradient>     mStrokeGradient;
00151 
00152   void GetMarkerFrames(nsSVGMarkerFrame **markerStart,
00153                        nsSVGMarkerFrame **markerMid,
00154                        nsSVGMarkerFrame **markerEnd);
00155 };
00156 
00157 #endif // __NS_SVGPATHGEOMETRYFRAME_H__