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_SVGPAINTSERVERFRAME_H__
7 #define __NS_SVGPAINTSERVERFRAME_H__
9 #include "mozilla/Attributes.h"
10 #include "nsCOMPtr.h"
11 #include "nsFrame.h"
12 #include "nsIFrame.h"
13 #include "nsQueryFrame.h"
14 #include "nsSVGContainerFrame.h"
15 #include "nsSVGUtils.h"
17 class gfxContext;
18 class gfxPattern;
19 class nsStyleContext;
21 struct gfxRect;
23 typedef nsSVGContainerFrame nsSVGPaintServerFrameBase;
25 class nsSVGPaintServerFrame : public nsSVGPaintServerFrameBase
26 {
27 protected:
28 nsSVGPaintServerFrame(nsStyleContext* aContext)
29 : nsSVGPaintServerFrameBase(aContext)
30 {
31 AddStateBits(NS_FRAME_IS_NONDISPLAY);
32 }
34 public:
35 NS_DECL_FRAMEARENA_HELPERS
37 /**
38 * Constructs a gfxPattern of the paint server rendering.
39 *
40 * @param aContextMatrix The transform matrix that is currently applied to
41 * the gfxContext that is being drawn to. This is needed by SVG patterns so
42 * that surfaces of the correct size can be created. (SVG gradients are
43 * vector based, so it's not used there.)
44 */
45 virtual already_AddRefed<gfxPattern>
46 GetPaintServerPattern(nsIFrame *aSource,
47 const gfxMatrix& aContextMatrix,
48 nsStyleSVGPaint nsStyleSVG::*aFillOrStroke,
49 float aOpacity,
50 const gfxRect *aOverrideBounds = nullptr) = 0;
52 /**
53 * Configure paint server prior to rendering
54 * @return false to skip rendering
55 */
56 virtual bool SetupPaintServer(gfxContext *aContext,
57 nsIFrame *aSource,
58 nsStyleSVGPaint nsStyleSVG::*aFillOrStroke,
59 float aOpacity);
61 // nsIFrame methods:
62 virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
63 const nsRect& aDirtyRect,
64 const nsDisplayListSet& aLists) MOZ_OVERRIDE {}
66 virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_OVERRIDE
67 {
68 return nsSVGPaintServerFrameBase::IsFrameOfType(aFlags & ~nsIFrame::eSVGPaintServer);
69 }
70 };
72 #endif // __NS_SVGPAINTSERVERFRAME_H__