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_ISVGCHILDFRAME_H__
40 : #define __NS_ISVGCHILDFRAME_H__
41 :
42 :
43 : #include "nsQueryFrame.h"
44 : #include "nsCOMPtr.h"
45 : #include "nsRect.h"
46 : #include "gfxRect.h"
47 : #include "gfxMatrix.h"
48 :
49 : class gfxContext;
50 : class nsRenderingContext;
51 :
52 : namespace mozilla {
53 : class SVGAnimatedNumberList;
54 : class SVGNumberList;
55 : class SVGAnimatedLengthList;
56 : class SVGLengthList;
57 : class SVGUserUnitList;
58 : }
59 :
60 : /**
61 : * This class is not particularly well named. It is inherited by some, but
62 : * not all SVG frame classes that can be descendants of an
63 : * nsSVGOuterSVGFrame in the frame tree. Note specifically that SVG container
64 : * frames that do not inherit nsSVGDisplayContainerFrame do not inherit this
65 : * class (so that's classes that only inherit nsSVGContainerFrame).
66 : */
67 : class nsISVGChildFrame : public nsQueryFrame
68 0 : {
69 : public:
70 : typedef mozilla::SVGAnimatedNumberList SVGAnimatedNumberList;
71 : typedef mozilla::SVGNumberList SVGNumberList;
72 : typedef mozilla::SVGAnimatedLengthList SVGAnimatedLengthList;
73 : typedef mozilla::SVGLengthList SVGLengthList;
74 : typedef mozilla::SVGUserUnitList SVGUserUnitList;
75 :
76 : NS_DECL_QUERYFRAME_TARGET(nsISVGChildFrame)
77 :
78 : // Paint this frame - aDirtyRect is the area being redrawn, in frame
79 : // offset pixel coordinates
80 : NS_IMETHOD PaintSVG(nsRenderingContext* aContext,
81 : const nsIntRect *aDirtyRect)=0;
82 :
83 : // Check if this frame or children contain the given point,
84 : // specified in app units relative to the origin of the outer
85 : // svg frame (origin ill-defined in the case of borders - bug
86 : // 290770). See bug 290852 for foreignObject complications.
87 : NS_IMETHOD_(nsIFrame*) GetFrameForPoint(const nsPoint &aPoint)=0;
88 :
89 : // Get bounds in our gfxContext's coordinates space (in app units)
90 : NS_IMETHOD_(nsRect) GetCoveredRegion()=0;
91 : NS_IMETHOD UpdateCoveredRegion()=0;
92 :
93 : // Called once on SVG child frames except descendants of <defs>, either
94 : // when their nsSVGOuterSVGFrame receives its initial reflow (i.e. once
95 : // the SVG viewport dimensions are known), or else when they're inserted
96 : // into the frame tree (if they're inserted after the initial reflow).
97 : NS_IMETHOD InitialUpdate()=0;
98 :
99 : // Flags to pass to NotifySVGChange:
100 : //
101 : // DO_NOT_NOTIFY_RENDERING_OBSERVERS - this should only be used when
102 : // updating the descendant frames of a clipPath,
103 : // mask, pattern or marker frame (or other similar
104 : // NS_STATE_SVG_NONDISPLAY_CHILD frame) immediately
105 : // prior to painting that frame's descendants.
106 : // TRANSFORM_CHANGED - the current transform matrix for this frame has changed
107 : // COORD_CONTEXT_CHANGED - the dimensions of this frame's coordinate context has
108 : // changed (percentage lengths must be reevaluated)
109 : enum SVGChangedFlags {
110 : DO_NOT_NOTIFY_RENDERING_OBSERVERS = 0x01,
111 : TRANSFORM_CHANGED = 0x02,
112 : COORD_CONTEXT_CHANGED = 0x04
113 : };
114 : virtual void NotifySVGChanged(PRUint32 aFlags)=0;
115 : virtual void NotifyRedrawSuspended()=0;
116 : virtual void NotifyRedrawUnsuspended()=0;
117 :
118 : /**
119 : * Get this frame's contribution to the rect returned by a GetBBox() call
120 : * that occurred either on this element, or on one of its ancestors.
121 : *
122 : * SVG defines an element's bbox to be the element's fill bounds in the
123 : * userspace established by that element. By allowing callers to pass in the
124 : * transform from the userspace established by this element to the userspace
125 : * established by an an ancestor, this method allows callers to obtain this
126 : * element's fill bounds in the userspace established by that ancestor
127 : * instead. In that case, since we return the bounds in a different userspace
128 : * (the ancestor's), the bounds we return are not this element's bbox, but
129 : * rather this element's contribution to the bbox of the ancestor.
130 : *
131 : * @param aToBBoxUserspace The transform from the userspace established by
132 : * this element to the userspace established by the ancestor on which
133 : * getBBox was called. This will be the identity matrix if we are the
134 : * element on which getBBox was called.
135 : *
136 : * @param aFlags Flags indicating whether, stroke, for example, should be
137 : * included in the bbox calculation.
138 : */
139 : virtual gfxRect GetBBoxContribution(const gfxMatrix &aToBBoxUserspace,
140 : PRUint32 aFlags) = 0;
141 :
142 : // Are we a container frame?
143 : NS_IMETHOD_(bool) IsDisplayContainer()=0;
144 :
145 : // Does this frame have an current covered region in mRect (aka GetRect())?
146 : NS_IMETHOD_(bool) HasValidCoveredRect()=0;
147 : };
148 :
149 : #endif // __NS_ISVGCHILDFRAME_H__
150 :
|