Bumping manifests a=b2g-bump
[gecko.git] / layout / svg / SVGFELeafFrame.cpp
blob071f0f24c8a32304efb38ac69d3e26485c524711
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 "nsFrame.h"
8 #include "nsGkAtoms.h"
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
20 friend nsIFrame*
21 NS_NewSVGFELeafFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
22 protected:
23 explicit SVGFELeafFrame(nsStyleContext* aContext)
24 : SVGFELeafFrameBase(aContext)
26 AddStateBits(NS_FRAME_SVG_LAYOUT | NS_FRAME_IS_NONDISPLAY);
29 public:
30 NS_DECL_FRAMEARENA_HELPERS
32 #ifdef DEBUG
33 virtual void Init(nsIContent* aContent,
34 nsContainerFrame* aParent,
35 nsIFrame* aPrevInFlow) MOZ_OVERRIDE;
36 #endif
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);
48 #endif
50 /**
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,
58 nsIAtom* aAttribute,
59 int32_t aModType) MOZ_OVERRIDE;
61 virtual bool UpdateOverflow() MOZ_OVERRIDE {
62 // We don't maintain a visual overflow rect
63 return false;
67 nsIFrame*
68 NS_NewSVGFELeafFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
70 return new (aPresShell) SVGFELeafFrame(aContext);
73 NS_IMPL_FRAMEARENA_HELPERS(SVGFELeafFrame)
75 #ifdef DEBUG
76 void
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);
87 #endif /* DEBUG */
89 nsIAtom *
90 SVGFELeafFrame::GetType() const
92 return nsGkAtoms::svgFELeafFrame;
95 nsresult
96 SVGFELeafFrame::AttributeChanged(int32_t aNameSpaceID,
97 nsIAtom* aAttribute,
98 int32_t aModType)
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);