Line data Source code
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 nsStyleContext;
20 : class nsSVGLength2;
21 :
22 : struct nsRect;
23 :
24 : namespace mozilla {
25 : namespace dom {
26 : class SVGFilterElement;
27 : } // namespace dom
28 : } // namespace mozilla
29 :
30 0 : class nsSVGFilterFrame : public nsSVGContainerFrame
31 : {
32 : friend nsIFrame*
33 : NS_NewSVGFilterFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
34 : protected:
35 0 : explicit nsSVGFilterFrame(nsStyleContext* aContext)
36 0 : : nsSVGContainerFrame(aContext, kClassID)
37 : , mLoopFlag(false)
38 0 : , mNoHRefURI(false)
39 : {
40 0 : AddStateBits(NS_FRAME_IS_NONDISPLAY);
41 0 : }
42 :
43 : public:
44 0 : NS_DECL_FRAMEARENA_HELPERS(nsSVGFilterFrame)
45 :
46 : // nsIFrame methods:
47 0 : virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
48 : const nsRect& aDirtyRect,
49 0 : const nsDisplayListSet& aLists) override {}
50 :
51 : virtual nsresult AttributeChanged(int32_t aNameSpaceID,
52 : nsIAtom* aAttribute,
53 : int32_t aModType) override;
54 :
55 : #ifdef DEBUG
56 : virtual void Init(nsIContent* aContent,
57 : nsContainerFrame* aParent,
58 : nsIFrame* aPrevInFlow) override;
59 : #endif
60 :
61 : private:
62 : // Parse our xlink:href and set up our nsSVGPaintingProperty if we
63 : // reference another filter and we don't have a property. Return
64 : // the referenced filter's frame if available, null otherwise.
65 : friend class nsSVGFilterInstance;
66 : nsSVGFilterFrame* GetReferencedFilter();
67 :
68 : // Accessors to lookup filter attributes
69 : uint16_t GetEnumValue(uint32_t aIndex, nsIContent *aDefault);
70 0 : uint16_t GetEnumValue(uint32_t aIndex)
71 : {
72 0 : return GetEnumValue(aIndex, mContent);
73 : }
74 : const nsSVGLength2 *GetLengthValue(uint32_t aIndex, nsIContent *aDefault);
75 0 : const nsSVGLength2 *GetLengthValue(uint32_t aIndex)
76 : {
77 0 : return GetLengthValue(aIndex, mContent);
78 : }
79 : const mozilla::dom::SVGFilterElement *GetFilterContent(nsIContent *aDefault);
80 0 : const mozilla::dom::SVGFilterElement *GetFilterContent()
81 : {
82 0 : return GetFilterContent(mContent);
83 : }
84 :
85 : // This flag is used to detect loops in xlink:href processing
86 : bool mLoopFlag;
87 : bool mNoHRefURI;
88 : };
89 :
90 : #endif
|