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