Bug 867089 - Validate the playbackRate before using it. r=ehsan
[gecko.git] / layout / svg / nsSVGFilterFrame.h
blobc5b9b03e9a0e92ff2c6380c4c917970f93ff3604
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__
9 #include "nsFrame.h"
10 #include "nsQueryFrame.h"
11 #include "nsRect.h"
12 #include "nsSVGContainerFrame.h"
13 #include "nsSVGUtils.h"
15 class nsIAtom;
16 class nsIContent;
17 class nsIFrame;
18 class nsIPresShell;
19 class nsRenderingContext;
20 class nsStyleContext;
21 class nsSVGFilterPaintCallback;
22 class nsSVGIntegerPair;
23 class nsSVGLength2;
25 namespace mozilla {
26 namespace dom {
27 class SVGFilterElement;
31 typedef nsSVGContainerFrame nsSVGFilterFrameBase;
33 class nsSVGFilterFrame : public nsSVGFilterFrameBase
35 friend nsIFrame*
36 NS_NewSVGFilterFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
37 protected:
38 nsSVGFilterFrame(nsStyleContext* aContext)
39 : nsSVGFilterFrameBase(aContext),
40 mLoopFlag(false),
41 mNoHRefURI(false)
43 AddStateBits(NS_STATE_SVG_NONDISPLAY_CHILD);
46 public:
47 NS_DECL_FRAMEARENA_HELPERS
49 // nsIFrame methods:
50 virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
51 const nsRect& aDirtyRect,
52 const nsDisplayListSet& aLists) MOZ_OVERRIDE {}
54 NS_IMETHOD AttributeChanged(int32_t aNameSpaceID,
55 nsIAtom* aAttribute,
56 int32_t aModType);
58 /**
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
62 * border box).
64 nsresult PaintFilteredFrame(nsRenderingContext *aContext,
65 nsIFrame *aFilteredFrame,
66 nsSVGFilterPaintCallback *aPaintCallback,
67 const nsRect* aDirtyArea);
69 /**
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);
78 /**
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);
87 /**
88 * Returns the post-filter visual overflow rect (paint bounds) of
89 * aFilteredFrame.
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);
99 #ifdef DEBUG
100 virtual void Init(nsIContent* aContent,
101 nsIFrame* aParent,
102 nsIFrame* aPrevInFlow) MOZ_OVERRIDE;
103 #endif
106 * Get the "type" of the frame
108 * @see nsGkAtoms::svgFilterFrame
110 virtual nsIAtom* GetType() const;
112 private:
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
144 bool mLoopFlag;
145 bool mNoHRefURI;
148 #endif