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:
9 #include "nsSVGEffects.h"
10 #include "nsSVGFilters.h"
12 typedef nsFrame SVGFELeafFrameBase
;
15 * This frame is used by filter primitive elements that don't
16 * have special child elements that provide parameters.
18 class SVGFELeafFrame
: public SVGFELeafFrameBase
21 NS_NewSVGFELeafFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
23 explicit SVGFELeafFrame(nsStyleContext
* aContext
)
24 : SVGFELeafFrameBase(aContext
)
26 AddStateBits(NS_FRAME_SVG_LAYOUT
| NS_FRAME_IS_NONDISPLAY
);
30 NS_DECL_FRAMEARENA_HELPERS
33 virtual void Init(nsIContent
* aContent
,
34 nsContainerFrame
* aParent
,
35 nsIFrame
* aPrevInFlow
) MOZ_OVERRIDE
;
38 virtual bool IsFrameOfType(uint32_t aFlags
) const MOZ_OVERRIDE
40 return SVGFELeafFrameBase::IsFrameOfType(aFlags
& ~(nsIFrame::eSVG
));
43 #ifdef DEBUG_FRAME_DUMP
44 virtual nsresult
GetFrameName(nsAString
& aResult
) const MOZ_OVERRIDE
46 return MakeFrameName(NS_LITERAL_STRING("SVGFELeaf"), aResult
);
51 * Get the "type" of the frame
53 * @see nsGkAtoms::svgFELeafFrame
55 virtual nsIAtom
* GetType() const MOZ_OVERRIDE
;
57 virtual nsresult
AttributeChanged(int32_t aNameSpaceID
,
59 int32_t aModType
) MOZ_OVERRIDE
;
61 virtual bool UpdateOverflow() MOZ_OVERRIDE
{
62 // We don't maintain a visual overflow rect
68 NS_NewSVGFELeafFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
)
70 return new (aPresShell
) SVGFELeafFrame(aContext
);
73 NS_IMPL_FRAMEARENA_HELPERS(SVGFELeafFrame
)
77 SVGFELeafFrame::Init(nsIContent
* aContent
,
78 nsContainerFrame
* aParent
,
79 nsIFrame
* aPrevInFlow
)
81 NS_ASSERTION(aContent
->IsNodeOfType(nsINode::eFILTER
),
82 "Trying to construct an SVGFELeafFrame for a "
83 "content element that doesn't support the right interfaces");
85 SVGFELeafFrameBase::Init(aContent
, aParent
, aPrevInFlow
);
90 SVGFELeafFrame::GetType() const
92 return nsGkAtoms::svgFELeafFrame
;
96 SVGFELeafFrame::AttributeChanged(int32_t aNameSpaceID
,
100 nsSVGFE
*element
= static_cast<nsSVGFE
*>(mContent
);
101 if (element
->AttributeAffectsRendering(aNameSpaceID
, aAttribute
)) {
102 nsSVGEffects::InvalidateRenderingObservers(this);
105 return SVGFELeafFrameBase::AttributeChanged(aNameSpaceID
,
106 aAttribute
, aModType
);