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-09-14 09:10:08 -07:00
|
|
|
#include "mozilla/Attributes.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:
|
2013-01-03 20:26:00 -08:00
|
|
|
NS_DECL_QUERYFRAME_TARGET(nsSVGPathGeometryFrame)
|
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:
|
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::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
|
|
|
|
|
2013-02-14 03:12:27 -08:00
|
|
|
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists) MOZ_OVERRIDE;
|
2012-07-20 11:12:29 -07:00
|
|
|
|
2008-04-08 05:51:19 -07:00
|
|
|
// nsSVGGeometryFrame methods
|
2012-08-22 08:56:38 -07:00
|
|
|
gfxMatrix GetCanvasTM(uint32_t 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,
|
2013-05-14 09:33:23 -07:00
|
|
|
const nsIntRect *aDirtyRect) MOZ_OVERRIDE;
|
2012-09-14 09:10:08 -07:00
|
|
|
NS_IMETHOD_(nsIFrame*) GetFrameForPoint(const nsPoint &aPoint) MOZ_OVERRIDE;
|
|
|
|
NS_IMETHOD_(nsRect) GetCoveredRegion() MOZ_OVERRIDE;
|
|
|
|
virtual void ReflowSVG() MOZ_OVERRIDE;
|
|
|
|
virtual void NotifySVGChanged(uint32_t aFlags) MOZ_OVERRIDE;
|
2012-04-16 01:23:48 -07:00
|
|
|
virtual SVGBBox GetBBoxContribution(const gfxMatrix &aToBBoxUserspace,
|
2012-09-14 09:10:08 -07:00
|
|
|
uint32_t aFlags) MOZ_OVERRIDE;
|
|
|
|
NS_IMETHOD_(bool) IsDisplayContainer() MOZ_OVERRIDE { 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:
|
2013-01-12 15:27:53 -08:00
|
|
|
enum { eRenderFill = 1, eRenderStroke = 2 };
|
|
|
|
void Render(nsRenderingContext *aContext, uint32_t aRenderComponents);
|
|
|
|
void PaintMarkers(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__
|