Bumping manifests a=b2g-bump
[gecko.git] / layout / svg / nsSVGStopFrame.cpp
blob55c8318cc962b983a2227b09cff1a350e4e1f6fe
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 "nsStyleContext.h"
10 #include "nsSVGEffects.h"
12 // This is a very simple frame whose only purpose is to capture style change
13 // events and propagate them to the parent. Most of the heavy lifting is done
14 // within the nsSVGGradientFrame, which is the parent for this frame
16 typedef nsFrame nsSVGStopFrameBase;
18 class nsSVGStopFrame : public nsSVGStopFrameBase
20 friend nsIFrame*
21 NS_NewSVGStopFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
22 protected:
23 explicit nsSVGStopFrame(nsStyleContext* aContext)
24 : nsSVGStopFrameBase(aContext)
26 AddStateBits(NS_FRAME_IS_NONDISPLAY);
29 public:
30 NS_DECL_FRAMEARENA_HELPERS
32 // nsIFrame interface:
33 #ifdef DEBUG
34 virtual void Init(nsIContent* aContent,
35 nsContainerFrame* aParent,
36 nsIFrame* aPrevInFlow) MOZ_OVERRIDE;
37 #endif
39 void BuildDisplayList(nsDisplayListBuilder* aBuilder,
40 const nsRect& aDirtyRect,
41 const nsDisplayListSet& aLists) MOZ_OVERRIDE {}
43 virtual nsresult AttributeChanged(int32_t aNameSpaceID,
44 nsIAtom* aAttribute,
45 int32_t aModType) MOZ_OVERRIDE;
47 /**
48 * Get the "type" of the frame
50 * @see nsGkAtoms::svgStopFrame
52 virtual nsIAtom* GetType() const MOZ_OVERRIDE;
54 virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_OVERRIDE
56 return nsSVGStopFrameBase::IsFrameOfType(aFlags & ~(nsIFrame::eSVG));
59 #ifdef DEBUG_FRAME_DUMP
60 virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE
62 return MakeFrameName(NS_LITERAL_STRING("SVGStop"), aResult);
64 #endif
67 //----------------------------------------------------------------------
68 // Implementation
70 NS_IMPL_FRAMEARENA_HELPERS(nsSVGStopFrame)
72 //----------------------------------------------------------------------
73 // nsIFrame methods:
75 #ifdef DEBUG
76 void
77 nsSVGStopFrame::Init(nsIContent* aContent,
78 nsContainerFrame* aParent,
79 nsIFrame* aPrevInFlow)
81 NS_ASSERTION(aContent->IsSVG(nsGkAtoms::stop), "Content is not a stop element");
83 nsSVGStopFrameBase::Init(aContent, aParent, aPrevInFlow);
85 #endif /* DEBUG */
87 nsIAtom *
88 nsSVGStopFrame::GetType() const
90 return nsGkAtoms::svgStopFrame;
93 nsresult
94 nsSVGStopFrame::AttributeChanged(int32_t aNameSpaceID,
95 nsIAtom* aAttribute,
96 int32_t aModType)
98 if (aNameSpaceID == kNameSpaceID_None &&
99 aAttribute == nsGkAtoms::offset) {
100 nsSVGEffects::InvalidateRenderingObservers(this);
103 return nsSVGStopFrameBase::AttributeChanged(aNameSpaceID,
104 aAttribute, aModType);
107 // -------------------------------------------------------------------------
108 // Public functions
109 // -------------------------------------------------------------------------
111 nsIFrame* NS_NewSVGStopFrame(nsIPresShell* aPresShell,
112 nsStyleContext* aContext)
114 return new (aPresShell) nsSVGStopFrame(aContext);