Bumping manifests a=b2g-bump
[gecko.git] / layout / svg / SVGFELeafFrame.cpp
blob0aa9333e8583697640fd40f0d877ff2447b1122b
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"
8 #include "nsFrame.h"
9 #include "nsGkAtoms.h"
10 #include "nsSVGEffects.h"
11 #include "nsSVGFilters.h"
13 typedef nsFrame SVGFELeafFrameBase;
16 * This frame is used by filter primitive elements that don't
17 * have special child elements that provide parameters.
19 class SVGFELeafFrame : public SVGFELeafFrameBase
21 friend nsIFrame*
22 NS_NewSVGFELeafFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
23 protected:
24 explicit SVGFELeafFrame(nsStyleContext* aContext)
25 : SVGFELeafFrameBase(aContext)
27 AddStateBits(NS_FRAME_SVG_LAYOUT | NS_FRAME_IS_NONDISPLAY);
30 public:
31 NS_DECL_FRAMEARENA_HELPERS
33 #ifdef DEBUG
34 virtual void Init(nsIContent* aContent,
35 nsContainerFrame* aParent,
36 nsIFrame* aPrevInFlow) MOZ_OVERRIDE;
37 #endif
39 virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_OVERRIDE
41 return SVGFELeafFrameBase::IsFrameOfType(aFlags & ~(nsIFrame::eSVG));
44 #ifdef DEBUG_FRAME_DUMP
45 virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE
47 return MakeFrameName(NS_LITERAL_STRING("SVGFELeaf"), aResult);
49 #endif
51 /**
52 * Get the "type" of the frame
54 * @see nsGkAtoms::svgFELeafFrame
56 virtual nsIAtom* GetType() const MOZ_OVERRIDE;
58 virtual nsresult AttributeChanged(int32_t aNameSpaceID,
59 nsIAtom* aAttribute,
60 int32_t aModType) MOZ_OVERRIDE;
62 virtual bool UpdateOverflow() MOZ_OVERRIDE {
63 // We don't maintain a visual overflow rect
64 return false;
68 nsIFrame*
69 NS_NewSVGFELeafFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
71 return new (aPresShell) SVGFELeafFrame(aContext);
74 NS_IMPL_FRAMEARENA_HELPERS(SVGFELeafFrame)
76 #ifdef DEBUG
77 void
78 SVGFELeafFrame::Init(nsIContent* aContent,
79 nsContainerFrame* aParent,
80 nsIFrame* aPrevInFlow)
82 NS_ASSERTION(aContent->IsNodeOfType(nsINode::eFILTER),
83 "Trying to construct an SVGFELeafFrame for a "
84 "content element that doesn't support the right interfaces");
86 SVGFELeafFrameBase::Init(aContent, aParent, aPrevInFlow);
88 #endif /* DEBUG */
90 nsIAtom *
91 SVGFELeafFrame::GetType() const
93 return nsGkAtoms::svgFELeafFrame;
96 nsresult
97 SVGFELeafFrame::AttributeChanged(int32_t aNameSpaceID,
98 nsIAtom* aAttribute,
99 int32_t aModType)
101 nsSVGFE *element = static_cast<nsSVGFE*>(mContent);
102 if (element->AttributeAffectsRendering(aNameSpaceID, aAttribute)) {
103 MOZ_ASSERT(GetParent()->GetType() == nsGkAtoms::svgFilterFrame,
104 "Observers observe the filter, so that's what we must invalidate");
105 nsSVGEffects::InvalidateDirectRenderingObservers(GetParent());
108 return SVGFELeafFrameBase::AttributeChanged(aNameSpaceID,
109 aAttribute, aModType);