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 "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
21 NS_NewSVGStopFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
23 explicit nsSVGStopFrame(nsStyleContext
* aContext
)
24 : nsSVGStopFrameBase(aContext
)
26 AddStateBits(NS_FRAME_IS_NONDISPLAY
);
30 NS_DECL_FRAMEARENA_HELPERS
32 // nsIFrame interface:
34 virtual void Init(nsIContent
* aContent
,
35 nsContainerFrame
* aParent
,
36 nsIFrame
* aPrevInFlow
) MOZ_OVERRIDE
;
39 void BuildDisplayList(nsDisplayListBuilder
* aBuilder
,
40 const nsRect
& aDirtyRect
,
41 const nsDisplayListSet
& aLists
) MOZ_OVERRIDE
{}
43 virtual nsresult
AttributeChanged(int32_t aNameSpaceID
,
45 int32_t aModType
) MOZ_OVERRIDE
;
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
);
67 //----------------------------------------------------------------------
70 NS_IMPL_FRAMEARENA_HELPERS(nsSVGStopFrame
)
72 //----------------------------------------------------------------------
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
);
88 nsSVGStopFrame::GetType() const
90 return nsGkAtoms::svgStopFrame
;
94 nsSVGStopFrame::AttributeChanged(int32_t aNameSpaceID
,
98 if (aNameSpaceID
== kNameSpaceID_None
&&
99 aAttribute
== nsGkAtoms::offset
) {
100 nsSVGEffects::InvalidateRenderingObservers(this);
103 return nsSVGStopFrameBase::AttributeChanged(aNameSpaceID
,
104 aAttribute
, aModType
);
107 // -------------------------------------------------------------------------
109 // -------------------------------------------------------------------------
111 nsIFrame
* NS_NewSVGStopFrame(nsIPresShell
* aPresShell
,
112 nsStyleContext
* aContext
)
114 return new (aPresShell
) nsSVGStopFrame(aContext
);