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 "nsSVGUtils.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2014-09-30 10:08:13 -07:00
|
|
|
namespace mozilla {
|
|
|
|
namespace gfx {
|
|
|
|
class DrawTarget;
|
2015-07-13 08:25:42 -07:00
|
|
|
} // namespace gfx
|
|
|
|
} // namespace mozilla
|
2014-09-30 10:08:13 -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;
|
|
|
|
class nsStyleContext;
|
2007-03-22 10:30:00 -07:00
|
|
|
class nsSVGMarkerFrame;
|
|
|
|
class nsSVGMarkerProperty;
|
|
|
|
|
2013-09-06 19:15:49 -07:00
|
|
|
struct nsRect;
|
2012-03-20 05:15:55 -07:00
|
|
|
|
2014-01-04 00:29:02 -08:00
|
|
|
typedef nsFrame nsSVGPathGeometryFrameBase;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
class nsSVGPathGeometryFrame : public nsSVGPathGeometryFrameBase,
|
|
|
|
public nsISVGChildFrame
|
|
|
|
{
|
2014-09-30 10:08:13 -07:00
|
|
|
typedef mozilla::gfx::DrawTarget DrawTarget;
|
|
|
|
|
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:
|
2014-08-31 20:36:37 -07:00
|
|
|
explicit nsSVGPathGeometryFrame(nsStyleContext* aContext)
|
2012-05-16 21:05:09 -07:00
|
|
|
: nsSVGPathGeometryFrameBase(aContext)
|
|
|
|
{
|
2014-01-04 00:29:02 -08:00
|
|
|
AddStateBits(NS_FRAME_SVG_LAYOUT | NS_FRAME_MAY_BE_TRANSFORMED);
|
2012-05-16 21:05:09 -07:00
|
|
|
}
|
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:
|
2014-05-24 15:20:40 -07:00
|
|
|
virtual void Init(nsIContent* aContent,
|
|
|
|
nsContainerFrame* aParent,
|
2015-03-21 09:28:04 -07:00
|
|
|
nsIFrame* aPrevInFlow) override;
|
2014-01-04 00:29:02 -08:00
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual bool IsFrameOfType(uint32_t aFlags) const override
|
2014-01-04 00:29:02 -08:00
|
|
|
{
|
|
|
|
return nsSVGPathGeometryFrameBase::IsFrameOfType(aFlags & ~(nsIFrame::eSVG | nsIFrame::eSVGGeometry));
|
|
|
|
}
|
|
|
|
|
2014-02-17 23:47:48 -08:00
|
|
|
virtual nsresult AttributeChanged(int32_t aNameSpaceID,
|
2014-02-18 00:36:33 -08:00
|
|
|
nsIAtom* aAttribute,
|
2015-03-21 09:28:04 -07:00
|
|
|
int32_t aModType) override;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual void DidSetStyleContext(nsStyleContext* aOldStyleContext) override;
|
2013-08-14 02:51:00 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
/**
|
|
|
|
* Get the "type" of the frame
|
|
|
|
*
|
|
|
|
* @see nsGkAtoms::svgPathGeometryFrame
|
|
|
|
*/
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual nsIAtom* GetType() const override;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-12-29 22:50:17 -08:00
|
|
|
virtual bool IsSVGTransformed(Matrix *aOwnTransforms = nullptr,
|
2015-03-21 09:28:04 -07:00
|
|
|
Matrix *aFromParentTransforms = nullptr) const override;
|
2012-05-16 21:05:09 -07:00
|
|
|
|
2014-01-05 15:31:14 -08:00
|
|
|
#ifdef DEBUG_FRAME_DUMP
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual nsresult GetFrameName(nsAString& aResult) const override
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
return MakeFrameName(NS_LITERAL_STRING("SVGPathGeometry"), aResult);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2013-02-14 03:12:27 -08:00
|
|
|
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
2015-03-21 09:28:04 -07:00
|
|
|
const nsDisplayListSet& aLists) override;
|
2012-07-20 11:12:29 -07:00
|
|
|
|
2014-01-04 00:29:02 -08:00
|
|
|
// nsSVGPathGeometryFrame methods
|
2014-09-08 04:28:50 -07:00
|
|
|
gfxMatrix GetCanvasTM();
|
2007-03-22 10:30:00 -07:00
|
|
|
protected:
|
|
|
|
// nsISVGChildFrame interface:
|
2014-10-31 13:08:54 -07:00
|
|
|
virtual nsresult PaintSVG(gfxContext& aContext,
|
2014-08-29 12:42:07 -07:00
|
|
|
const gfxMatrix& aTransform,
|
2015-03-21 09:28:04 -07:00
|
|
|
const nsIntRect* aDirtyRect = nullptr) override;
|
|
|
|
virtual nsIFrame* GetFrameForPoint(const gfxPoint& aPoint) override;
|
|
|
|
virtual nsRect GetCoveredRegion() override;
|
|
|
|
virtual void ReflowSVG() override;
|
|
|
|
virtual void NotifySVGChanged(uint32_t aFlags) override;
|
2013-12-29 22:50:17 -08:00
|
|
|
virtual SVGBBox GetBBoxContribution(const Matrix &aToBBoxUserspace,
|
2015-03-21 09:28:04 -07:00
|
|
|
uint32_t aFlags) override;
|
|
|
|
virtual bool IsDisplayContainer() override { return false; }
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2014-01-04 00:29:02 -08: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();
|
2007-03-22 10:30:00 -07:00
|
|
|
private:
|
2013-01-12 15:27:53 -08:00
|
|
|
enum { eRenderFill = 1, eRenderStroke = 2 };
|
2014-09-30 10:08:13 -07:00
|
|
|
void Render(gfxContext* aContext, uint32_t aRenderComponents,
|
2014-08-29 12:42:07 -07: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 13:08:54 -07:00
|
|
|
void PaintMarkers(gfxContext& aContext, const gfxMatrix& aMatrix);
|
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__
|