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_SVGFILTERFRAME_H__
7 #define __NS_SVGFILTERFRAME_H__
10 #include "nsQueryFrame.h"
12 #include "nsSVGContainerFrame.h"
13 #include "nsSVGUtils.h"
19 class nsRenderingContext
;
21 class nsSVGFilterPaintCallback
;
22 class nsSVGIntegerPair
;
27 class SVGFilterElement
;
31 typedef nsSVGContainerFrame nsSVGFilterFrameBase
;
33 class nsSVGFilterFrame
: public nsSVGFilterFrameBase
36 NS_NewSVGFilterFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
38 nsSVGFilterFrame(nsStyleContext
* aContext
)
39 : nsSVGFilterFrameBase(aContext
),
43 AddStateBits(NS_STATE_SVG_NONDISPLAY_CHILD
);
47 NS_DECL_FRAMEARENA_HELPERS
50 virtual void BuildDisplayList(nsDisplayListBuilder
* aBuilder
,
51 const nsRect
& aDirtyRect
,
52 const nsDisplayListSet
& aLists
) MOZ_OVERRIDE
{}
54 NS_IMETHOD
AttributeChanged(int32_t aNameSpaceID
,
59 * Paint the given filtered frame.
60 * @param aDirtyArea The area than needs to be painted, in aFilteredFrame's
61 * frame space (i.e. relative to its origin, the top-left corner of its
64 nsresult
PaintFilteredFrame(nsRenderingContext
*aContext
,
65 nsIFrame
*aFilteredFrame
,
66 nsSVGFilterPaintCallback
*aPaintCallback
,
67 const nsRect
* aDirtyArea
);
70 * Returns the post-filter area that could be dirtied when the given
71 * pre-filter area of aFilteredFrame changes.
72 * @param aPreFilterDirtyRect The pre-filter area of aFilteredFrame that has
73 * changed, relative to aFilteredFrame, in app units.
75 nsRect
GetPostFilterDirtyArea(nsIFrame
*aFilteredFrame
,
76 const nsRect
& aPreFilterDirtyRect
);
79 * Returns the pre-filter area that is needed from aFilteredFrame when the
80 * given post-filter area needs to be repainted.
81 * @param aPostFilterDirtyRect The post-filter area that is dirty, relative
82 * to aFilteredFrame, in app units.
84 nsRect
GetPreFilterNeededArea(nsIFrame
*aFilteredFrame
,
85 const nsRect
& aPostFilterDirtyRect
);
88 * Returns the post-filter visual overflow rect (paint bounds) of
90 * @param aOverrideBBox A user space rect, in user units, that should be used
91 * as aFilteredFrame's bbox ('bbox' is a specific SVG term), if non-null.
92 * @param aPreFilterBounds The pre-filter visual overflow rect of
93 * aFilteredFrame, if non-null.
95 nsRect
GetPostFilterBounds(nsIFrame
*aFilteredFrame
,
96 const gfxRect
*aOverrideBBox
= nullptr,
97 const nsRect
*aPreFilterBounds
= nullptr);
100 virtual void Init(nsIContent
* aContent
,
102 nsIFrame
* aPrevInFlow
) MOZ_OVERRIDE
;
106 * Get the "type" of the frame
108 * @see nsGkAtoms::svgFilterFrame
110 virtual nsIAtom
* GetType() const;
113 // Parse our xlink:href and set up our nsSVGPaintingProperty if we
114 // reference another filter and we don't have a property. Return
115 // the referenced filter's frame if available, null otherwise.
116 class AutoFilterReferencer
;
117 friend class nsAutoFilterInstance
;
118 nsSVGFilterFrame
* GetReferencedFilter();
119 nsSVGFilterFrame
* GetReferencedFilterIfNotInUse();
121 // Accessors to lookup filter attributes
122 uint16_t GetEnumValue(uint32_t aIndex
, nsIContent
*aDefault
);
123 uint16_t GetEnumValue(uint32_t aIndex
)
125 return GetEnumValue(aIndex
, mContent
);
127 const nsSVGIntegerPair
*GetIntegerPairValue(uint32_t aIndex
, nsIContent
*aDefault
);
128 const nsSVGIntegerPair
*GetIntegerPairValue(uint32_t aIndex
)
130 return GetIntegerPairValue(aIndex
, mContent
);
132 const nsSVGLength2
*GetLengthValue(uint32_t aIndex
, nsIContent
*aDefault
);
133 const nsSVGLength2
*GetLengthValue(uint32_t aIndex
)
135 return GetLengthValue(aIndex
, mContent
);
137 const mozilla::dom::SVGFilterElement
*GetFilterContent(nsIContent
*aDefault
);
138 const mozilla::dom::SVGFilterElement
*GetFilterContent()
140 return GetFilterContent(mContent
);
143 // This flag is used to detect loops in xlink:href processing