|
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_SVGFILTERFRAME_H__ |
|
7 #define __NS_SVGFILTERFRAME_H__ |
|
8 |
|
9 #include "mozilla/Attributes.h" |
|
10 #include "nsFrame.h" |
|
11 #include "nsQueryFrame.h" |
|
12 #include "nsSVGContainerFrame.h" |
|
13 #include "nsSVGUtils.h" |
|
14 |
|
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; |
|
24 |
|
25 struct nsRect; |
|
26 |
|
27 namespace mozilla { |
|
28 namespace dom { |
|
29 class SVGFilterElement; |
|
30 } |
|
31 } |
|
32 |
|
33 typedef nsSVGContainerFrame nsSVGFilterFrameBase; |
|
34 |
|
35 class nsSVGFilterFrame : public nsSVGFilterFrameBase |
|
36 { |
|
37 friend nsIFrame* |
|
38 NS_NewSVGFilterFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); |
|
39 protected: |
|
40 nsSVGFilterFrame(nsStyleContext* aContext) |
|
41 : nsSVGFilterFrameBase(aContext), |
|
42 mLoopFlag(false), |
|
43 mNoHRefURI(false) |
|
44 { |
|
45 AddStateBits(NS_FRAME_IS_NONDISPLAY); |
|
46 } |
|
47 |
|
48 public: |
|
49 NS_DECL_FRAMEARENA_HELPERS |
|
50 |
|
51 // nsIFrame methods: |
|
52 virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder, |
|
53 const nsRect& aDirtyRect, |
|
54 const nsDisplayListSet& aLists) MOZ_OVERRIDE {} |
|
55 |
|
56 virtual nsresult AttributeChanged(int32_t aNameSpaceID, |
|
57 nsIAtom* aAttribute, |
|
58 int32_t aModType) MOZ_OVERRIDE; |
|
59 |
|
60 #ifdef DEBUG |
|
61 virtual void Init(nsIContent* aContent, |
|
62 nsIFrame* aParent, |
|
63 nsIFrame* aPrevInFlow) MOZ_OVERRIDE; |
|
64 #endif |
|
65 |
|
66 /** |
|
67 * Get the "type" of the frame |
|
68 * |
|
69 * @see nsGkAtoms::svgFilterFrame |
|
70 */ |
|
71 virtual nsIAtom* GetType() const MOZ_OVERRIDE; |
|
72 |
|
73 private: |
|
74 // Parse our xlink:href and set up our nsSVGPaintingProperty if we |
|
75 // reference another filter and we don't have a property. Return |
|
76 // the referenced filter's frame if available, null otherwise. |
|
77 class AutoFilterReferencer; |
|
78 friend class nsSVGFilterInstance; |
|
79 nsSVGFilterFrame* GetReferencedFilter(); |
|
80 nsSVGFilterFrame* GetReferencedFilterIfNotInUse(); |
|
81 |
|
82 // Accessors to lookup filter attributes |
|
83 uint16_t GetEnumValue(uint32_t aIndex, nsIContent *aDefault); |
|
84 uint16_t GetEnumValue(uint32_t aIndex) |
|
85 { |
|
86 return GetEnumValue(aIndex, mContent); |
|
87 } |
|
88 const nsSVGLength2 *GetLengthValue(uint32_t aIndex, nsIContent *aDefault); |
|
89 const nsSVGLength2 *GetLengthValue(uint32_t aIndex) |
|
90 { |
|
91 return GetLengthValue(aIndex, mContent); |
|
92 } |
|
93 const mozilla::dom::SVGFilterElement *GetFilterContent(nsIContent *aDefault); |
|
94 const mozilla::dom::SVGFilterElement *GetFilterContent() |
|
95 { |
|
96 return GetFilterContent(mContent); |
|
97 } |
|
98 |
|
99 // This flag is used to detect loops in xlink:href processing |
|
100 bool mLoopFlag; |
|
101 bool mNoHRefURI; |
|
102 }; |
|
103 |
|
104 #endif |