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
|
|
|
|
|
|
|
#ifndef __NS_SVGPATHGEOMETRYFRAME_H__
|
|
|
|
#define __NS_SVGPATHGEOMETRYFRAME_H__
|
|
|
|
|
2012-03-20 05:15:55 -07:00
|
|
|
#include "gfxMatrix.h"
|
|
|
|
#include "gfxRect.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsFrame.h"
|
|
|
|
#include "nsISVGChildFrame.h"
|
2012-03-20 05:15:55 -07:00
|
|
|
#include "nsLiteralString.h"
|
|
|
|
#include "nsQueryFrame.h"
|
|
|
|
#include "nsRect.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsSVGGeometryFrame.h"
|
2012-03-20 05:15:55 -07:00
|
|
|
#include "nsSVGUtils.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-03-20 05:15:55 -07:00
|
|
|
class gfxContext;
|
2012-07-20 11:12:29 -07:00
|
|
|
class nsDisplaySVGPathGeometry;
|
2012-03-20 05:15:55 -07:00
|
|
|
class nsIAtom;
|
|
|
|
class nsIFrame;
|
|
|
|
class nsIPresShell;
|
2012-03-02 00:28:59 -08:00
|
|
|
class nsRenderingContext;
|
2012-03-20 05:15:55 -07:00
|
|
|
class nsStyleContext;
|
2007-03-22 10:30:00 -07:00
|
|
|
class nsSVGMarkerFrame;
|
|
|
|
class nsSVGMarkerProperty;
|
|
|
|
|
2012-03-20 05:15:55 -07:00
|
|
|
struct nsPoint;
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
typedef nsSVGGeometryFrame nsSVGPathGeometryFrameBase;
|
|
|
|
|
|
|
|
class nsSVGPathGeometryFrame : public nsSVGPathGeometryFrameBase,
|
|
|
|
public nsISVGChildFrame
|
|
|
|
{
|
2007-07-24 02:05:37 -07:00
|
|
|
friend nsIFrame*
|
2009-01-19 10:31:34 -08:00
|
|
|
NS_NewSVGPathGeometryFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
|
2012-07-20 11:12:29 -07:00
|
|
|
|
|
|
|
friend class nsDisplaySVGPathGeometry;
|
|
|
|
|
2007-07-24 02:05:37 -07:00
|
|
|
protected:
|
2012-05-16 21:05:09 -07:00
|
|
|
nsSVGPathGeometryFrame(nsStyleContext* aContext)
|
|
|
|
: nsSVGPathGeometryFrameBase(aContext)
|
|
|
|
{
|
|
|
|
AddStateBits(NS_FRAME_MAY_BE_TRANSFORMED);
|
|
|
|
}
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2007-07-24 02:05:37 -07:00
|
|
|
public:
|
2009-01-12 11:20:59 -08:00
|
|
|
NS_DECL_QUERYFRAME
|
2009-09-12 09:49:24 -07:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// nsIFrame interface:
|
|
|
|
NS_IMETHOD AttributeChanged(PRInt32 aNameSpaceID,
|
|
|
|
nsIAtom* aAttribute,
|
|
|
|
PRInt32 aModType);
|
|
|
|
|
2008-10-26 03:11:34 -07:00
|
|
|
virtual void DidSetStyleContext(nsStyleContext* aOldStyleContext);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the "type" of the frame
|
|
|
|
*
|
|
|
|
* @see nsGkAtoms::svgPathGeometryFrame
|
|
|
|
*/
|
|
|
|
virtual nsIAtom* GetType() const;
|
|
|
|
|
2012-07-30 07:20:58 -07:00
|
|
|
virtual bool IsSVGTransformed(gfxMatrix *aOwnTransforms = nullptr,
|
|
|
|
gfxMatrix *aFromParentTransforms = nullptr) const;
|
2012-05-16 21:05:09 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
#ifdef DEBUG
|
|
|
|
NS_IMETHOD GetFrameName(nsAString& aResult) const
|
|
|
|
{
|
|
|
|
return MakeFrameName(NS_LITERAL_STRING("SVGPathGeometry"), aResult);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2012-07-20 11:12:29 -07:00
|
|
|
NS_IMETHOD BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists);
|
|
|
|
|
2008-04-08 05:51:19 -07:00
|
|
|
// nsSVGGeometryFrame methods
|
2012-06-30 04:20:46 -07:00
|
|
|
gfxMatrix GetCanvasTM(PRUint32 aFor);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
protected:
|
|
|
|
// nsISVGChildFrame interface:
|
2012-03-02 00:28:59 -08:00
|
|
|
NS_IMETHOD PaintSVG(nsRenderingContext *aContext,
|
2008-10-20 01:42:03 -07:00
|
|
|
const nsIntRect *aDirtyRect);
|
2008-08-25 02:23:54 -07:00
|
|
|
NS_IMETHOD_(nsIFrame*) GetFrameForPoint(const nsPoint &aPoint);
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_IMETHOD_(nsRect) GetCoveredRegion();
|
2012-07-21 17:01:44 -07:00
|
|
|
virtual void ReflowSVG();
|
2008-01-25 01:27:03 -08:00
|
|
|
virtual void NotifySVGChanged(PRUint32 aFlags);
|
2012-04-16 01:23:48 -07:00
|
|
|
virtual SVGBBox GetBBoxContribution(const gfxMatrix &aToBBoxUserspace,
|
2011-09-30 02:25:37 -07:00
|
|
|
PRUint32 aFlags);
|
2011-09-28 23:19:26 -07:00
|
|
|
NS_IMETHOD_(bool) IsDisplayContainer() { return false; }
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
protected:
|
2012-06-24 13:12:40 -07:00
|
|
|
void GeneratePath(gfxContext *aContext, const gfxMatrix &aTransform);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
private:
|
2012-03-02 00:28:59 -08:00
|
|
|
void Render(nsRenderingContext *aContext);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2008-10-10 06:14:05 -07:00
|
|
|
struct MarkerProperties {
|
|
|
|
nsSVGMarkerProperty* mMarkerStart;
|
|
|
|
nsSVGMarkerProperty* mMarkerMid;
|
|
|
|
nsSVGMarkerProperty* mMarkerEnd;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool MarkersExist() const {
|
2008-10-10 06:14:05 -07:00
|
|
|
return mMarkerStart || mMarkerMid || mMarkerEnd;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsSVGMarkerFrame *GetMarkerStartFrame();
|
|
|
|
nsSVGMarkerFrame *GetMarkerMidFrame();
|
|
|
|
nsSVGMarkerFrame *GetMarkerEndFrame();
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param aFrame should be the first continuation
|
|
|
|
*/
|
|
|
|
static MarkerProperties GetMarkerProperties(nsSVGPathGeometryFrame *aFrame);
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // __NS_SVGPATHGEOMETRYFRAME_H__
|