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
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) 2005
19 * the Initial Developer. All Rights Reserved.
22 * rocallahan@mozilla.com
24 * Alternatively, the contents of this file may be used under the terms of
25 * either of the GNU General Public License Version 2 or later (the "GPL"),
26 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
36 * ***** END LICENSE BLOCK ***** */
38 #ifndef NSSVGINTEGRATIONUTILS_H_
39 #define NSSVGINTEGRATIONUTILS_H_
46 class nsDisplayListBuilder
;
48 class nsIRenderingContext
;
49 class nsIDOMSVGMatrix
;
51 /***** Integration of SVG effects with regular frame painting *****/
53 class nsSVGIntegrationUtils
57 * Returns true if a non-SVG frame has SVG effects.
60 UsingEffectsForFrame(const nsIFrame
* aFrame
);
63 * Adjust overflow rect for effects.
64 * XXX this is a problem. We really need to compute the effects rect for
65 * a whole chain of frames for a given element at once. but we have no
66 * way to do this effectively with Gecko's current reflow architecture.
67 * See http://groups.google.com/group/mozilla.dev.tech.layout/msg/6b179066f3051f65
70 ComputeFrameEffectsRect(nsIFrame
* aFrame
, const nsRect
& aOverflowRect
);
72 * Adjust the frame's invalidation area to cover effects
75 GetInvalidAreaForChangedSource(nsIFrame
* aFrame
, const nsRect
& aInvalidRect
);
77 * Figure out which area of the source is needed given an area to
81 GetRequiredSourceForInvalidArea(nsIFrame
* aFrame
, const nsRect
& aDamageRect
);
83 * Returns true if the given point is not clipped out by effects.
84 * @param aPt in appunits relative to aFrame
87 HitTestFrameForEffects(nsIFrame
* aFrame
, const nsPoint
& aPt
);
90 * Paint non-SVG frame with SVG effects.
91 * @param aOffset the offset in appunits where aFrame should be positioned
92 * in aCtx's coordinate system
95 PaintFramesWithEffects(nsIRenderingContext
* aCtx
,
96 nsIFrame
* aEffectsFrame
, const nsRect
& aDirtyRect
,
97 nsDisplayListBuilder
* aBuilder
,
98 nsDisplayList
* aInnerList
);
100 static already_AddRefed
<nsIDOMSVGMatrix
>
101 GetInitialMatrix(nsIFrame
* aNonSVGFrame
);
103 * Returns aNonSVGFrame's rect in CSS pixel units. This is the union
104 * of all its continuations' rectangles. The top-left is always 0,0
105 * since "user space" origin for non-SVG frames is the top-left of the
106 * union of all the continuations' rectangles.
109 GetSVGRectForNonSVGFrame(nsIFrame
* aNonSVGFrame
);
111 * Returns aNonSVGFrame's bounding box in CSS units. This is the union
112 * of all its continuations' overflow areas, relative to the top-left
113 * of all the continuations' rectangles.
116 GetSVGBBoxForNonSVGFrame(nsIFrame
* aNonSVGFrame
);
119 #endif /*NSSVGINTEGRATIONUTILS_H_*/