2004-12-09 03:16:15 +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/. */
|
2004-12-09 03:16:15 +00:00
|
|
|
|
|
|
|
#ifndef __NS_SVGMARKERFRAME_H__
|
|
|
|
#define __NS_SVGMARKERFRAME_H__
|
|
|
|
|
2012-03-20 12:15:55 +00:00
|
|
|
#include "gfxMatrix.h"
|
|
|
|
#include "gfxRect.h"
|
|
|
|
#include "nsFrame.h"
|
|
|
|
#include "nsLiteralString.h"
|
|
|
|
#include "nsQueryFrame.h"
|
2006-06-09 20:40:06 +00:00
|
|
|
#include "nsSVGContainerFrame.h"
|
2012-03-18 10:32:02 +00:00
|
|
|
#include "nsSVGUtils.h"
|
2004-12-09 03:16:15 +00:00
|
|
|
|
2012-03-20 12:15:55 +00:00
|
|
|
class nsIAtom;
|
|
|
|
class nsIContent;
|
|
|
|
class nsIFrame;
|
|
|
|
class nsIPresShell;
|
2012-03-02 08:28:59 +00:00
|
|
|
class nsRenderingContext;
|
2012-03-20 12:15:55 +00:00
|
|
|
class nsStyleContext;
|
2004-12-09 03:16:15 +00:00
|
|
|
class nsSVGPathGeometryFrame;
|
2013-01-09 23:02:45 +00:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
class SVGSVGElement;
|
|
|
|
}
|
|
|
|
}
|
2012-03-20 12:15:55 +00:00
|
|
|
|
2006-06-21 15:42:28 +00:00
|
|
|
struct nsSVGMark;
|
2006-06-02 14:26:28 +00:00
|
|
|
|
2006-06-09 20:40:06 +00:00
|
|
|
typedef nsSVGContainerFrame nsSVGMarkerFrameBase;
|
|
|
|
|
2007-03-21 10:59:01 +00:00
|
|
|
class nsSVGMarkerFrame : public nsSVGMarkerFrameBase
|
2006-06-09 20:40:06 +00:00
|
|
|
{
|
|
|
|
friend nsIFrame*
|
2009-01-19 18:31:34 +00:00
|
|
|
NS_NewSVGMarkerFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
|
2007-09-07 09:30:51 +00:00
|
|
|
protected:
|
2012-03-10 19:28:06 +00:00
|
|
|
nsSVGMarkerFrame(nsStyleContext* aContext)
|
|
|
|
: nsSVGMarkerFrameBase(aContext)
|
2012-07-30 14:20:58 +00:00
|
|
|
, mMarkedFrame(nullptr)
|
2012-03-10 19:28:06 +00:00
|
|
|
, mInUse(false)
|
|
|
|
, mInUse2(false)
|
|
|
|
{
|
|
|
|
AddStateBits(NS_STATE_SVG_NONDISPLAY_CHILD);
|
|
|
|
}
|
2004-12-09 03:16:15 +00:00
|
|
|
|
2007-09-07 09:30:51 +00:00
|
|
|
public:
|
2009-09-12 16:49:24 +00:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS
|
|
|
|
|
2008-10-10 13:14:05 +00:00
|
|
|
// nsIFrame interface:
|
2009-01-19 18:31:34 +00:00
|
|
|
#ifdef DEBUG
|
|
|
|
NS_IMETHOD Init(nsIContent* aContent,
|
|
|
|
nsIFrame* aParent,
|
|
|
|
nsIFrame* aPrevInFlow);
|
|
|
|
#endif
|
|
|
|
|
2012-07-20 16:41:29 +00:00
|
|
|
NS_IMETHOD BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists) {
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
NS_IMETHOD AttributeChanged(int32_t aNameSpaceID,
|
2008-10-10 13:14:05 +00:00
|
|
|
nsIAtom* aAttribute,
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t aModType);
|
2006-06-09 20:40:06 +00:00
|
|
|
/**
|
|
|
|
* Get the "type" of the frame
|
|
|
|
*
|
2007-01-30 00:06:41 +00:00
|
|
|
* @see nsGkAtoms::svgMarkerFrame
|
2006-06-09 20:40:06 +00:00
|
|
|
*/
|
|
|
|
virtual nsIAtom* GetType() const;
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
NS_IMETHOD GetFrameName(nsAString& aResult) const
|
|
|
|
{
|
|
|
|
return MakeFrameName(NS_LITERAL_STRING("SVGMarker"), aResult);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// nsSVGMarkerFrame methods:
|
2012-03-02 08:28:59 +00:00
|
|
|
nsresult PaintMark(nsRenderingContext *aContext,
|
2006-12-07 09:32:13 +00:00
|
|
|
nsSVGPathGeometryFrame *aMarkedFrame,
|
2006-06-09 20:40:06 +00:00
|
|
|
nsSVGMark *aMark,
|
|
|
|
float aStrokeWidth);
|
|
|
|
|
2012-04-16 08:23:48 +00:00
|
|
|
SVGBBox GetMarkBBoxContribution(const gfxMatrix &aToBBoxUserspace,
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t aFlags,
|
2011-09-30 09:25:37 +00:00
|
|
|
nsSVGPathGeometryFrame *aMarkedFrame,
|
|
|
|
const nsSVGMark *aMark,
|
|
|
|
float aStrokeWidth);
|
2006-06-09 20:40:06 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
// stuff needed for callback
|
2006-12-07 09:32:13 +00:00
|
|
|
nsSVGPathGeometryFrame *mMarkedFrame;
|
2010-02-18 21:50:59 +00:00
|
|
|
float mStrokeWidth, mX, mY, mAutoAngle;
|
2006-06-09 20:40:06 +00:00
|
|
|
|
|
|
|
// nsSVGContainerFrame methods:
|
2012-08-22 15:56:38 +00:00
|
|
|
virtual gfxMatrix GetCanvasTM(uint32_t aFor);
|
2006-06-09 20:40:06 +00:00
|
|
|
|
2006-12-07 09:32:13 +00:00
|
|
|
// A helper class to allow us to paint markers safely. The helper
|
|
|
|
// automatically sets and clears the mInUse flag on the marker frame (to
|
|
|
|
// prevent nasty reference loops) as well as the reference to the marked
|
|
|
|
// frame and its coordinate context. It's easy to mess this up
|
|
|
|
// and break things, so this helper makes the code far more robust.
|
|
|
|
class AutoMarkerReferencer
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
AutoMarkerReferencer(nsSVGMarkerFrame *aFrame,
|
|
|
|
nsSVGPathGeometryFrame *aMarkedFrame);
|
|
|
|
~AutoMarkerReferencer();
|
|
|
|
private:
|
|
|
|
nsSVGMarkerFrame *mFrame;
|
|
|
|
};
|
|
|
|
|
|
|
|
// nsSVGMarkerFrame methods:
|
2013-01-09 23:02:45 +00:00
|
|
|
void SetParentCoordCtxProvider(mozilla::dom::SVGSVGElement *aContext);
|
2006-12-07 09:32:13 +00:00
|
|
|
|
2006-06-09 20:40:06 +00:00
|
|
|
// recursion prevention flag
|
2011-09-29 06:19:26 +00:00
|
|
|
bool mInUse;
|
2006-06-09 20:40:06 +00:00
|
|
|
|
|
|
|
// second recursion prevention flag, for GetCanvasTM()
|
2011-09-29 06:19:26 +00:00
|
|
|
bool mInUse2;
|
2006-06-09 20:40:06 +00:00
|
|
|
};
|
2005-11-11 14:36:26 +00:00
|
|
|
|
2004-12-09 03:16:15 +00:00
|
|
|
#endif
|