Tue, 06 Jan 2015 21:39:09 +0100
Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef __NS_ISVGCHILDFRAME_H__
7 #define __NS_ISVGCHILDFRAME_H__
9 #include "gfxRect.h"
10 #include "nsQueryFrame.h"
12 class nsIFrame;
13 class nsRenderingContext;
15 struct nsPoint;
16 class SVGBBox;
17 struct nsRect;
18 struct nsIntRect;
20 namespace mozilla {
21 class SVGAnimatedLengthList;
22 class SVGAnimatedNumberList;
23 class SVGLengthList;
24 class SVGNumberList;
25 class SVGUserUnitList;
27 namespace gfx {
28 class Matrix;
29 }
30 }
32 /**
33 * This class is not particularly well named. It is inherited by some, but
34 * not all SVG frame classes that can be descendants of an
35 * nsSVGOuterSVGFrame in the frame tree. Note specifically that SVG container
36 * frames that do not inherit nsSVGDisplayContainerFrame do not inherit this
37 * class (so that's classes that only inherit nsSVGContainerFrame).
38 */
39 class nsISVGChildFrame : public nsQueryFrame
40 {
41 public:
42 typedef mozilla::SVGAnimatedNumberList SVGAnimatedNumberList;
43 typedef mozilla::SVGNumberList SVGNumberList;
44 typedef mozilla::SVGAnimatedLengthList SVGAnimatedLengthList;
45 typedef mozilla::SVGLengthList SVGLengthList;
46 typedef mozilla::SVGUserUnitList SVGUserUnitList;
48 NS_DECL_QUERYFRAME_TARGET(nsISVGChildFrame)
50 // Paint this frame.
51 // aDirtyRect is the area being redrawn, in frame offset pixel coordinates.
52 // aTransformRoot (if non-null) is the frame at which we stop looking up
53 // transforms, when painting content that is part of an SVG glyph. (See
54 // bug 875329.)
55 // For normal SVG graphics using display-list rendering, any transforms on
56 // the element or its parents will have already been set up in the context
57 // before PaintSVG is called. When painting SVG glyphs, this is not the case,
58 // so the element's full transform needs to be applied; but we don't want to
59 // apply transforms from outside the actual glyph element, so we need to know
60 // how far up the ancestor chain to go.
61 virtual nsresult PaintSVG(nsRenderingContext* aContext,
62 const nsIntRect *aDirtyRect,
63 nsIFrame* aTransformRoot = nullptr) = 0;
65 // Check if this frame or children contain the given point,
66 // specified in app units relative to the origin of the outer
67 // svg frame (origin ill-defined in the case of borders - bug
68 // 290770). See bug 290852 for foreignObject complications.
69 virtual nsIFrame* GetFrameForPoint(const nsPoint &aPoint)=0;
71 // Get bounds in our nsSVGOuterSVGFrame's coordinates space (in app units)
72 virtual nsRect GetCoveredRegion()=0;
74 // Called on SVG child frames (except NS_FRAME_IS_NONDISPLAY frames)
75 // to update and then invalidate their cached bounds. This method is not
76 // called until after the nsSVGOuterSVGFrame has had its initial reflow
77 // (i.e. once the SVG viewport dimensions are known). It should also only
78 // be called by nsSVGOuterSVGFrame during its reflow.
79 virtual void ReflowSVG()=0;
81 /**
82 * Flags used to specify to GetCanvasTM what it's being called for so that it
83 * knows how far up the tree the "canvas" is. When display lists are being
84 * used for painting or hit-testing of SVG, the "canvas" is simply user
85 * space.
86 */
87 enum RequestingCanvasTMFor {
88 FOR_PAINTING = 1,
89 FOR_HIT_TESTING,
90 FOR_OUTERSVG_TM
91 };
93 // Flags to pass to NotifySVGChange:
94 //
95 // DO_NOT_NOTIFY_RENDERING_OBSERVERS - this should only be used when
96 // updating the descendant frames of a clipPath,
97 // mask, pattern or marker frame (or other similar
98 // NS_FRAME_IS_NONDISPLAY frame) immediately
99 // prior to painting that frame's descendants.
100 // TRANSFORM_CHANGED - the current transform matrix for this frame has changed
101 // COORD_CONTEXT_CHANGED - the dimensions of this frame's coordinate context has
102 // changed (percentage lengths must be reevaluated)
103 enum SVGChangedFlags {
104 TRANSFORM_CHANGED = 0x01,
105 COORD_CONTEXT_CHANGED = 0x02,
106 FULL_ZOOM_CHANGED = 0x04
107 };
108 /**
109 * This is called on a frame when there has been a change to one of its
110 * ancestors that might affect the frame too. SVGChangedFlags are passed
111 * to indicate what changed.
112 *
113 * Implementations do not need to invalidate, since the caller will
114 * invalidate the entire area of the ancestor that changed. However, they
115 * may need to update their bounds.
116 */
117 virtual void NotifySVGChanged(uint32_t aFlags)=0;
119 /**
120 * Get this frame's contribution to the rect returned by a GetBBox() call
121 * that occurred either on this element, or on one of its ancestors.
122 *
123 * SVG defines an element's bbox to be the element's fill bounds in the
124 * userspace established by that element. By allowing callers to pass in the
125 * transform from the userspace established by this element to the userspace
126 * established by an an ancestor, this method allows callers to obtain this
127 * element's fill bounds in the userspace established by that ancestor
128 * instead. In that case, since we return the bounds in a different userspace
129 * (the ancestor's), the bounds we return are not this element's bbox, but
130 * rather this element's contribution to the bbox of the ancestor.
131 *
132 * @param aToBBoxUserspace The transform from the userspace established by
133 * this element to the userspace established by the ancestor on which
134 * getBBox was called. This will be the identity matrix if we are the
135 * element on which getBBox was called.
136 *
137 * @param aFlags Flags indicating whether, stroke, for example, should be
138 * included in the bbox calculation.
139 */
140 virtual SVGBBox GetBBoxContribution(const mozilla::gfx::Matrix &aToBBoxUserspace,
141 uint32_t aFlags) = 0;
143 // Are we a container frame?
144 virtual bool IsDisplayContainer()=0;
145 };
147 #endif // __NS_ISVGCHILDFRAME_H__