layout/svg/nsSVGPaintServerFrame.h

branch
TOR_BUG_9701
changeset 15
b8a032363ba2
equal deleted inserted replaced
-1:000000000000 0:590b47288bfb
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/. */
5
6 #ifndef __NS_SVGPAINTSERVERFRAME_H__
7 #define __NS_SVGPAINTSERVERFRAME_H__
8
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"
16
17 class gfxContext;
18 class gfxPattern;
19 class nsStyleContext;
20
21 struct gfxRect;
22
23 typedef nsSVGContainerFrame nsSVGPaintServerFrameBase;
24
25 class nsSVGPaintServerFrame : public nsSVGPaintServerFrameBase
26 {
27 protected:
28 nsSVGPaintServerFrame(nsStyleContext* aContext)
29 : nsSVGPaintServerFrameBase(aContext)
30 {
31 AddStateBits(NS_FRAME_IS_NONDISPLAY);
32 }
33
34 public:
35 NS_DECL_FRAMEARENA_HELPERS
36
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;
51
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);
60
61 // nsIFrame methods:
62 virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
63 const nsRect& aDirtyRect,
64 const nsDisplayListSet& aLists) MOZ_OVERRIDE {}
65
66 virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_OVERRIDE
67 {
68 return nsSVGPaintServerFrameBase::IsFrameOfType(aFlags & ~nsIFrame::eSVGPaintServer);
69 }
70 };
71
72 #endif // __NS_SVGPAINTSERVERFRAME_H__

mercurial