2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 04:12:37 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-03-26 04:58:59 -07:00
|
|
|
// Keep in (case-insensitive) order:
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsFrame.h"
|
|
|
|
#include "nsGkAtoms.h"
|
2012-03-26 04:58:59 -07:00
|
|
|
#include "nsStyleContext.h"
|
2008-09-30 17:51:05 -07:00
|
|
|
#include "nsSVGEffects.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// This is a very simple frame whose only purpose is to capture style change
|
|
|
|
// events and propagate them to the parent. Most of the heavy lifting is done
|
|
|
|
// within the nsSVGGradientFrame, which is the parent for this frame
|
|
|
|
|
|
|
|
typedef nsFrame nsSVGStopFrameBase;
|
|
|
|
|
|
|
|
class nsSVGStopFrame : public nsSVGStopFrameBase
|
|
|
|
{
|
2007-07-25 02:16:02 -07:00
|
|
|
friend nsIFrame*
|
2009-01-19 10:31:34 -08:00
|
|
|
NS_NewSVGStopFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
|
2007-07-25 02:16:02 -07:00
|
|
|
protected:
|
2012-12-21 02:00:39 -08:00
|
|
|
nsSVGStopFrame(nsStyleContext* aContext)
|
|
|
|
: nsSVGStopFrameBase(aContext)
|
|
|
|
{
|
|
|
|
AddStateBits(NS_STATE_SVG_NONDISPLAY_CHILD);
|
|
|
|
}
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2007-07-25 02:16:02 -07:00
|
|
|
public:
|
2009-09-12 09:49:24 -07:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
// nsIFrame interface:
|
2009-01-19 10:31:34 -08:00
|
|
|
#ifdef DEBUG
|
|
|
|
NS_IMETHOD Init(nsIContent* aContent,
|
|
|
|
nsIFrame* aParent,
|
|
|
|
nsIFrame* aPrevInFlow);
|
|
|
|
#endif
|
|
|
|
|
2013-02-14 03:12:27 -08:00
|
|
|
void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists) MOZ_OVERRIDE {}
|
2012-07-20 09:41:29 -07:00
|
|
|
|
2008-10-26 03:11:34 -07:00
|
|
|
virtual void DidSetStyleContext(nsStyleContext* aOldStyleContext);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
NS_IMETHOD AttributeChanged(int32_t aNameSpaceID,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsIAtom* aAttribute,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t aModType);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the "type" of the frame
|
|
|
|
*
|
|
|
|
* @see nsGkAtoms::svgStopFrame
|
|
|
|
*/
|
|
|
|
virtual nsIAtom* GetType() const;
|
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
virtual bool IsFrameOfType(uint32_t aFlags) const
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
return nsSVGStopFrameBase::IsFrameOfType(aFlags & ~(nsIFrame::eSVG));
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
NS_IMETHOD GetFrameName(nsAString& aResult) const
|
|
|
|
{
|
|
|
|
return MakeFrameName(NS_LITERAL_STRING("SVGStop"), aResult);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// Implementation
|
|
|
|
|
2009-09-12 09:49:24 -07:00
|
|
|
NS_IMPL_FRAMEARENA_HELPERS(nsSVGStopFrame)
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// nsIFrame methods:
|
|
|
|
|
2009-01-19 10:31:34 -08:00
|
|
|
#ifdef DEBUG
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSVGStopFrame::Init(nsIContent* aContent,
|
|
|
|
nsIFrame* aParent,
|
|
|
|
nsIFrame* aPrevInFlow)
|
|
|
|
{
|
2013-02-02 12:23:18 -08:00
|
|
|
NS_ASSERTION(aContent->IsSVG(nsGkAtoms::stop), "Content is not a stop element");
|
2009-01-19 10:31:34 -08:00
|
|
|
|
|
|
|
return nsSVGStopFrameBase::Init(aContent, aParent, aPrevInFlow);
|
|
|
|
}
|
|
|
|
#endif /* DEBUG */
|
|
|
|
|
2008-10-13 15:03:28 -07:00
|
|
|
/* virtual */ void
|
2008-10-26 03:11:34 -07:00
|
|
|
nsSVGStopFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2008-10-26 03:11:34 -07:00
|
|
|
nsSVGStopFrameBase::DidSetStyleContext(aOldStyleContext);
|
2008-09-30 17:51:05 -07:00
|
|
|
nsSVGEffects::InvalidateRenderingObservers(this);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
nsIAtom *
|
|
|
|
nsSVGStopFrame::GetType() const
|
|
|
|
{
|
|
|
|
return nsGkAtoms::svgStopFrame;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2012-08-22 08:56:38 -07:00
|
|
|
nsSVGStopFrame::AttributeChanged(int32_t aNameSpaceID,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsIAtom* aAttribute,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t aModType)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
if (aNameSpaceID == kNameSpaceID_None &&
|
|
|
|
aAttribute == nsGkAtoms::offset) {
|
2008-09-30 17:51:05 -07:00
|
|
|
nsSVGEffects::InvalidateRenderingObservers(this);
|
|
|
|
}
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
return nsSVGStopFrameBase::AttributeChanged(aNameSpaceID,
|
|
|
|
aAttribute, aModType);
|
|
|
|
}
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
// Public functions
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
nsIFrame* NS_NewSVGStopFrame(nsIPresShell* aPresShell,
|
|
|
|
nsStyleContext* aContext)
|
|
|
|
{
|
|
|
|
return new (aPresShell) nsSVGStopFrame(aContext);
|
|
|
|
}
|