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
|
|
|
|
2014-09-30 17:08:13 +00:00
|
|
|
namespace mozilla {
|
|
|
|
namespace gfx {
|
|
|
|
class DrawTarget;
|
2015-07-13 15:25:42 +00:00
|
|
|
} // namespace gfx
|
|
|
|
} // namespace mozilla
|
2014-09-30 17:08:13 +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;
|
|
|
|
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
|
|
|
|
2013-09-07 02:15:49 +00:00
|
|
|
struct nsRect;
|
2012-03-20 12:15:55 +00:00
|
|
|
|
2016-04-18 07:38:47 +00:00
|
|
|
class nsSVGPathGeometryFrame : public nsFrame
|
|
|
|
, public nsISVGChildFrame
|
2001-12-12 07:59:31 +00:00
|
|
|
{
|
2014-09-30 17:08:13 +00:00
|
|
|
typedef mozilla::gfx::DrawTarget DrawTarget;
|
|
|
|
|
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:
|
2014-09-01 03:36:37 +00:00
|
|
|
explicit nsSVGPathGeometryFrame(nsStyleContext* aContext)
|
2016-04-18 07:38:47 +00:00
|
|
|
: nsFrame(aContext)
|
2012-05-17 04:05:09 +00:00
|
|
|
{
|
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-05-24 22:20:40 +00:00
|
|
|
virtual void Init(nsIContent* aContent,
|
|
|
|
nsContainerFrame* aParent,
|
2015-03-21 16:28:04 +00:00
|
|
|
nsIFrame* aPrevInFlow) override;
|
2014-01-04 08:29:02 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual bool IsFrameOfType(uint32_t aFlags) const override
|
2014-01-04 08:29:02 +00:00
|
|
|
{
|
2016-04-18 07:38:47 +00:00
|
|
|
return nsFrame::IsFrameOfType(aFlags & ~(nsIFrame::eSVG | nsIFrame::eSVGGeometry));
|
2014-01-04 08:29:02 +00:00
|
|
|
}
|
|
|
|
|
2014-02-18 07:47:48 +00:00
|
|
|
virtual nsresult AttributeChanged(int32_t aNameSpaceID,
|
2014-02-18 08:36:33 +00:00
|
|
|
nsIAtom* aAttribute,
|
2015-03-21 16:28:04 +00:00
|
|
|
int32_t aModType) override;
|
2001-12-12 07:59:31 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual void DidSetStyleContext(nsStyleContext* aOldStyleContext) 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
|
|
|
*/
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual nsIAtom* GetType() const override;
|
2005-04-01 19:56:08 +00:00
|
|
|
|
2013-12-30 06:50:17 +00:00
|
|
|
virtual bool IsSVGTransformed(Matrix *aOwnTransforms = nullptr,
|
2015-03-21 16:28:04 +00:00
|
|
|
Matrix *aFromParentTransforms = nullptr) const override;
|
2012-05-17 04:05:09 +00:00
|
|
|
|
2014-01-05 23:31:14 +00:00
|
|
|
#ifdef DEBUG_FRAME_DUMP
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual nsresult GetFrameName(nsAString& aResult) const 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,
|
2015-03-21 16:28:04 +00:00
|
|
|
const nsDisplayListSet& aLists) override;
|
2012-07-20 18:12:29 +00:00
|
|
|
|
2014-01-04 08:29:02 +00:00
|
|
|
// nsSVGPathGeometryFrame methods
|
2014-09-08 11:28:50 +00:00
|
|
|
gfxMatrix GetCanvasTM();
|
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:
|
2016-07-14 04:47:06 +00:00
|
|
|
virtual DrawResult PaintSVG(gfxContext& aContext,
|
|
|
|
const gfxMatrix& aTransform,
|
|
|
|
const nsIntRect* aDirtyRect = nullptr) override;
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual nsIFrame* GetFrameForPoint(const gfxPoint& aPoint) override;
|
|
|
|
virtual nsRect GetCoveredRegion() override;
|
|
|
|
virtual void ReflowSVG() override;
|
|
|
|
virtual void NotifySVGChanged(uint32_t aFlags) override;
|
2013-12-30 06:50:17 +00:00
|
|
|
virtual SVGBBox GetBBoxContribution(const Matrix &aToBBoxUserspace,
|
2015-03-21 16:28:04 +00:00
|
|
|
uint32_t aFlags) override;
|
|
|
|
virtual bool IsDisplayContainer() override { return false; }
|
2006-06-28 22:04:48 +00:00
|
|
|
|
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 };
|
2014-09-30 17:08:13 +00:00
|
|
|
void Render(gfxContext* aContext, uint32_t aRenderComponents,
|
2014-08-29 19:42:07 +00:00
|
|
|
const gfxMatrix& aTransform);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param aMatrix The transform that must be multiplied onto aContext to
|
|
|
|
* establish this frame's SVG user space.
|
|
|
|
*/
|
2014-10-31 20:08:54 +00:00
|
|
|
void PaintMarkers(gfxContext& aContext, const gfxMatrix& aMatrix);
|
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__
|