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 // Keep in (case-insensitive) order:
7 #include "nsContainerFrame.h"
10 #include "nsLiteralString.h"
11 #include "nsSVGEffects.h"
12 #include "nsSVGFilters.h"
14 typedef nsContainerFrame SVGFEContainerFrameBase
;
17 * This frame is used by filter primitive elements that
18 * have special child elements that provide parameters.
20 class SVGFEContainerFrame
: public SVGFEContainerFrameBase
23 NS_NewSVGFEContainerFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
25 explicit SVGFEContainerFrame(nsStyleContext
* aContext
)
26 : SVGFEContainerFrameBase(aContext
)
28 AddStateBits(NS_FRAME_SVG_LAYOUT
| NS_FRAME_IS_NONDISPLAY
);
32 NS_DECL_FRAMEARENA_HELPERS
34 virtual bool IsFrameOfType(uint32_t aFlags
) const MOZ_OVERRIDE
36 return SVGFEContainerFrameBase::IsFrameOfType(
37 aFlags
& ~(nsIFrame::eSVG
| nsIFrame::eSVGContainer
));
40 #ifdef DEBUG_FRAME_DUMP
41 virtual nsresult
GetFrameName(nsAString
& aResult
) const MOZ_OVERRIDE
43 return MakeFrameName(NS_LITERAL_STRING("SVGFEContainer"), aResult
);
48 virtual void Init(nsIContent
* aContent
,
49 nsContainerFrame
* aParent
,
50 nsIFrame
* aPrevInFlow
) MOZ_OVERRIDE
;
53 * Get the "type" of the frame
55 * @see nsGkAtoms::svgFEContainerFrame
57 virtual nsIAtom
* GetType() const MOZ_OVERRIDE
;
59 virtual nsresult
AttributeChanged(int32_t aNameSpaceID
,
61 int32_t aModType
) MOZ_OVERRIDE
;
63 virtual bool UpdateOverflow() MOZ_OVERRIDE
{
64 // We don't maintain a visual overflow rect
70 NS_NewSVGFEContainerFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
)
72 return new (aPresShell
) SVGFEContainerFrame(aContext
);
75 NS_IMPL_FRAMEARENA_HELPERS(SVGFEContainerFrame
)
79 SVGFEContainerFrame::Init(nsIContent
* aContent
,
80 nsContainerFrame
* aParent
,
81 nsIFrame
* aPrevInFlow
)
83 NS_ASSERTION(aContent
->IsNodeOfType(nsINode::eFILTER
),
84 "Trying to construct an SVGFEContainerFrame for a "
85 "content element that doesn't support the right interfaces");
87 SVGFEContainerFrameBase::Init(aContent
, aParent
, aPrevInFlow
);
92 SVGFEContainerFrame::GetType() const
94 return nsGkAtoms::svgFEContainerFrame
;
98 SVGFEContainerFrame::AttributeChanged(int32_t aNameSpaceID
,
102 nsSVGFE
*element
= static_cast<nsSVGFE
*>(mContent
);
103 if (element
->AttributeAffectsRendering(aNameSpaceID
, aAttribute
)) {
104 nsSVGEffects::InvalidateRenderingObservers(this);
107 return SVGFEContainerFrameBase::AttributeChanged(aNameSpaceID
,
108 aAttribute
, aModType
);