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