2001-12-12 07:59:31 +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/. */
|
2001-12-12 07:59:31 +00:00
|
|
|
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 12:39:26 +00:00
|
|
|
#ifndef __NS_SVGPATHGEOMETRYFRAME_H__
|
|
|
|
#define __NS_SVGPATHGEOMETRYFRAME_H__
|
2001-12-12 07:59:31 +00:00
|
|
|
|
2012-09-14 16:10:08 +00:00
|
|
|
#include "mozilla/Attributes.h"
|
2012-03-20 12:15:55 +00:00
|
|
|
#include "gfxMatrix.h"
|
|
|
|
#include "gfxRect.h"
|
2001-12-12 07:59:31 +00:00
|
|
|
#include "nsFrame.h"
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 12:39:26 +00:00
|
|
|
#include "nsISVGChildFrame.h"
|
2012-03-20 12:15:55 +00:00
|
|
|
#include "nsLiteralString.h"
|
|
|
|
#include "nsQueryFrame.h"
|
|
|
|
#include "nsSVGUtils.h"
|
2001-12-12 07:59:31 +00:00
|
|
|
|
2012-03-20 12:15:55 +00:00
|
|
|
class gfxContext;
|
2012-07-20 18:12:29 +00:00
|
|
|
class nsDisplaySVGPathGeometry;
|
2012-03-20 12:15:55 +00:00
|
|
|
class nsIAtom;
|
|
|
|
class nsIFrame;
|
|
|
|
class nsIPresShell;
|
2012-03-02 08:28:59 +00:00
|
|
|
class nsRenderingContext;
|
2012-03-20 12:15:55 +00:00
|
|
|
class nsStyleContext;
|
2006-06-09 20:40:06 +00:00
|
|
|
class nsSVGMarkerFrame;
|
2007-03-21 10:59:01 +00:00
|
|
|
class nsSVGMarkerProperty;
|
2001-12-12 07:59:31 +00:00
|
|
|
|
2012-03-20 12:15:55 +00:00
|
|
|
struct nsPoint;
|
2013-09-07 02:15:49 +00:00
|
|
|
struct nsRect;
|
|
|
|
struct nsIntRect;
|
2012-03-20 12:15:55 +00:00
|
|
|
|
2014-01-04 08:29:02 +00:00
|
|
|
typedef nsFrame nsSVGPathGeometryFrameBase;
|
2001-12-12 07:59:31 +00:00
|
|
|
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 12:39:26 +00:00
|
|
|
class nsSVGPathGeometryFrame : public nsSVGPathGeometryFrameBase,
|
|
|
|
public nsISVGChildFrame
|
2001-12-12 07:59:31 +00:00
|
|
|
{
|
2007-07-24 09:05:37 +00:00
|
|
|
friend nsIFrame*
|
2009-01-19 18:31:34 +00:00
|
|
|
NS_NewSVGPathGeometryFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
|
2012-07-20 18:12:29 +00:00
|
|
|
|
|
|
|
friend class nsDisplaySVGPathGeometry;
|
|
|
|
|
2007-07-24 09:05:37 +00:00
|
|
|
protected:
|
2012-05-17 04:05:09 +00:00
|
|
|
nsSVGPathGeometryFrame(nsStyleContext* aContext)
|
|
|
|
: nsSVGPathGeometryFrameBase(aContext)
|
|
|
|
{
|
2014-01-04 08:29:02 +00:00
|
|
|
AddStateBits(NS_FRAME_SVG_LAYOUT | NS_FRAME_MAY_BE_TRANSFORMED);
|
2012-05-17 04:05:09 +00:00
|
|
|
}
|
2006-06-21 15:42:28 +00:00
|
|
|
|
2007-07-24 09:05:37 +00:00
|
|
|
public:
|
2013-01-04 04:26:00 +00:00
|
|
|
NS_DECL_QUERYFRAME_TARGET(nsSVGPathGeometryFrame)
|
2009-01-12 19:20:59 +00:00
|
|
|
NS_DECL_QUERYFRAME
|
2009-09-12 16:49:24 +00:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS
|
2001-12-12 07:59:31 +00:00
|
|
|
|
|
|
|
// nsIFrame interface:
|
2014-01-04 08:29:02 +00:00
|
|
|
virtual void Init(nsIContent* aContent,
|
|
|
|
nsIFrame* aParent,
|
|
|
|
nsIFrame* aPrevInFlow) MOZ_OVERRIDE;
|
|
|
|
|
|
|
|
virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_OVERRIDE
|
|
|
|
{
|
|
|
|
return nsSVGPathGeometryFrameBase::IsFrameOfType(aFlags & ~(nsIFrame::eSVG | nsIFrame::eSVGGeometry));
|
|
|
|
}
|
|
|
|
|
2014-02-18 07:47:48 +00:00
|
|
|
virtual nsresult AttributeChanged(int32_t aNameSpaceID,
|
2014-02-18 08:36:33 +00:00
|
|
|
nsIAtom* aAttribute,
|
|
|
|
int32_t aModType) MOZ_OVERRIDE;
|
2001-12-12 07:59:31 +00:00
|
|
|
|
2014-02-24 14:41:56 +00:00
|
|
|
virtual void DidSetStyleContext(nsStyleContext* aOldStyleContext) MOZ_OVERRIDE;
|
2013-08-14 09:51:00 +00:00
|
|
|
|
2005-04-01 19:56:08 +00:00
|
|
|
/**
|
|
|
|
* Get the "type" of the frame
|
|
|
|
*
|
2007-01-30 00:06:41 +00:00
|
|
|
* @see nsGkAtoms::svgPathGeometryFrame
|
2005-04-01 19:56:08 +00:00
|
|
|
*/
|
2013-05-29 19:37:49 +00:00
|
|
|
virtual nsIAtom* GetType() const MOZ_OVERRIDE;
|
2005-04-01 19:56:08 +00:00
|
|
|
|
2013-12-30 06:50:17 +00:00
|
|
|
virtual bool IsSVGTransformed(Matrix *aOwnTransforms = nullptr,
|
|
|
|
Matrix *aFromParentTransforms = nullptr) const MOZ_OVERRIDE;
|
2012-05-17 04:05:09 +00:00
|
|
|
|
2014-01-05 23:31:14 +00:00
|
|
|
#ifdef DEBUG_FRAME_DUMP
|
2014-02-18 07:47:48 +00:00
|
|
|
virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE
|
2005-04-01 19:56:08 +00:00
|
|
|
{
|
|
|
|
return MakeFrameName(NS_LITERAL_STRING("SVGPathGeometry"), aResult);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2013-02-14 11:12:27 +00:00
|
|
|
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists) MOZ_OVERRIDE;
|
2012-07-20 18:12:29 +00:00
|
|
|
|
2014-01-04 08:29:02 +00:00
|
|
|
// nsSVGPathGeometryFrame methods
|
2013-09-11 07:27:45 +00:00
|
|
|
gfxMatrix GetCanvasTM(uint32_t aFor,
|
2014-01-04 08:29:02 +00:00
|
|
|
nsIFrame* aTransformRoot = nullptr);
|
2005-04-01 19:56:08 +00:00
|
|
|
protected:
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 12:39:26 +00:00
|
|
|
// nsISVGChildFrame interface:
|
2014-02-19 22:34:31 +00:00
|
|
|
virtual nsresult PaintSVG(nsRenderingContext *aContext,
|
|
|
|
const nsIntRect *aDirtyRect,
|
|
|
|
nsIFrame* aTransformRoot = nullptr) MOZ_OVERRIDE;
|
|
|
|
virtual nsIFrame* GetFrameForPoint(const nsPoint &aPoint) MOZ_OVERRIDE;
|
|
|
|
virtual nsRect GetCoveredRegion() MOZ_OVERRIDE;
|
2012-09-14 16:10:08 +00:00
|
|
|
virtual void ReflowSVG() MOZ_OVERRIDE;
|
|
|
|
virtual void NotifySVGChanged(uint32_t aFlags) MOZ_OVERRIDE;
|
2013-12-30 06:50:17 +00:00
|
|
|
virtual SVGBBox GetBBoxContribution(const Matrix &aToBBoxUserspace,
|
2012-09-14 16:10:08 +00:00
|
|
|
uint32_t aFlags) MOZ_OVERRIDE;
|
2014-02-19 22:34:31 +00:00
|
|
|
virtual bool IsDisplayContainer() MOZ_OVERRIDE { return false; }
|
2006-06-28 22:04:48 +00:00
|
|
|
|
2013-12-30 21:42:32 +00:00
|
|
|
void GeneratePath(gfxContext *aContext, const Matrix &aTransform);
|
2014-01-04 08:29:02 +00:00
|
|
|
/**
|
|
|
|
* This function returns a set of bit flags indicating which parts of the
|
|
|
|
* element (fill, stroke, bounds) should intercept pointer events. It takes
|
|
|
|
* into account the type of element and the value of the 'pointer-events'
|
|
|
|
* property on the element.
|
|
|
|
*/
|
|
|
|
virtual uint16_t GetHitTestFlags();
|
2006-06-21 15:42:28 +00:00
|
|
|
private:
|
2013-01-12 23:27:53 +00:00
|
|
|
enum { eRenderFill = 1, eRenderStroke = 2 };
|
2013-09-11 07:27:45 +00:00
|
|
|
void Render(nsRenderingContext *aContext, uint32_t aRenderComponents,
|
|
|
|
nsIFrame* aTransformRoot);
|
2013-01-12 23:27:53 +00:00
|
|
|
void PaintMarkers(nsRenderingContext *aContext);
|
2006-06-02 14:26:28 +00:00
|
|
|
|
2008-10-10 13:14:05 +00:00
|
|
|
struct MarkerProperties {
|
|
|
|
nsSVGMarkerProperty* mMarkerStart;
|
|
|
|
nsSVGMarkerProperty* mMarkerMid;
|
|
|
|
nsSVGMarkerProperty* mMarkerEnd;
|
2006-03-01 10:59:36 +00:00
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool MarkersExist() const {
|
2008-10-10 13:14:05 +00:00
|
|
|
return mMarkerStart || mMarkerMid || mMarkerEnd;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsSVGMarkerFrame *GetMarkerStartFrame();
|
|
|
|
nsSVGMarkerFrame *GetMarkerMidFrame();
|
|
|
|
nsSVGMarkerFrame *GetMarkerEndFrame();
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param aFrame should be the first continuation
|
|
|
|
*/
|
|
|
|
static MarkerProperties GetMarkerProperties(nsSVGPathGeometryFrame *aFrame);
|
2001-12-12 07:59:31 +00:00
|
|
|
};
|
|
|
|
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 12:39:26 +00:00
|
|
|
#endif // __NS_SVGPATHGEOMETRYFRAME_H__
|