2001-12-12 10:59:31 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 15:12:37 +04: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 10:59:31 +03:00
|
|
|
|
2016-12-18 14:11:47 +03:00
|
|
|
#ifndef __SVGGEOMETRYFRAME_H__
|
|
|
|
#define __SVGGEOMETRYFRAME_H__
|
2001-12-12 10:59:31 +03:00
|
|
|
|
2012-09-14 20:10:08 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2012-03-20 16:15:55 +04:00
|
|
|
#include "gfxMatrix.h"
|
|
|
|
#include "gfxRect.h"
|
2001-12-12 10:59:31 +03: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 15:39:26 +03:00
|
|
|
#include "nsISVGChildFrame.h"
|
2012-03-20 16:15:55 +04:00
|
|
|
#include "nsLiteralString.h"
|
|
|
|
#include "nsQueryFrame.h"
|
|
|
|
#include "nsSVGUtils.h"
|
2001-12-12 10:59:31 +03:00
|
|
|
|
2014-09-30 21:08:13 +04:00
|
|
|
namespace mozilla {
|
2016-12-18 14:11:47 +03:00
|
|
|
class SVGGeometryFrame;
|
2014-09-30 21:08:13 +04:00
|
|
|
namespace gfx {
|
|
|
|
class DrawTarget;
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace gfx
|
|
|
|
} // namespace mozilla
|
2014-09-30 21:08:13 +04:00
|
|
|
|
2012-03-20 16:15:55 +04:00
|
|
|
class gfxContext;
|
2016-12-18 14:11:47 +03:00
|
|
|
class nsDisplaySVGGeometry;
|
2012-03-20 16:15:55 +04:00
|
|
|
class nsIAtom;
|
|
|
|
class nsIFrame;
|
|
|
|
class nsIPresShell;
|
|
|
|
class nsStyleContext;
|
2006-06-10 00:40:06 +04:00
|
|
|
class nsSVGMarkerFrame;
|
2007-03-21 13:59:01 +03:00
|
|
|
class nsSVGMarkerProperty;
|
2001-12-12 10:59:31 +03:00
|
|
|
|
2013-09-07 06:15:49 +04:00
|
|
|
struct nsRect;
|
2012-03-20 16:15:55 +04:00
|
|
|
|
2016-12-18 14:11:47 +03:00
|
|
|
nsIFrame*
|
|
|
|
NS_NewSVGGeometryFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
|
|
|
|
class SVGGeometryFrame : public nsFrame
|
|
|
|
, public nsISVGChildFrame
|
2001-12-12 10:59:31 +03:00
|
|
|
{
|
2014-09-30 21:08:13 +04:00
|
|
|
typedef mozilla::gfx::DrawTarget DrawTarget;
|
|
|
|
|
2007-07-24 13:05:37 +04:00
|
|
|
friend nsIFrame*
|
2016-12-18 14:11:47 +03:00
|
|
|
::NS_NewSVGGeometryFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
|
2012-07-20 22:12:29 +04:00
|
|
|
|
2016-12-18 14:11:47 +03:00
|
|
|
friend class ::nsDisplaySVGGeometry;
|
2012-07-20 22:12:29 +04:00
|
|
|
|
2007-07-24 13:05:37 +04:00
|
|
|
protected:
|
2016-12-18 14:11:47 +03:00
|
|
|
explicit SVGGeometryFrame(nsStyleContext* aContext)
|
2016-04-18 10:38:47 +03:00
|
|
|
: nsFrame(aContext)
|
2012-05-17 08:05:09 +04:00
|
|
|
{
|
2014-01-04 12:29:02 +04:00
|
|
|
AddStateBits(NS_FRAME_SVG_LAYOUT | NS_FRAME_MAY_BE_TRANSFORMED);
|
2012-05-17 08:05:09 +04:00
|
|
|
}
|
2006-06-21 19:42:28 +04:00
|
|
|
|
2007-07-24 13:05:37 +04:00
|
|
|
public:
|
2016-12-18 14:11:47 +03:00
|
|
|
NS_DECL_QUERYFRAME_TARGET(SVGGeometryFrame)
|
2009-01-12 22:20:59 +03:00
|
|
|
NS_DECL_QUERYFRAME
|
2009-09-12 20:49:24 +04:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS
|
2001-12-12 10:59:31 +03:00
|
|
|
|
|
|
|
// nsIFrame interface:
|
2014-05-25 02:20:40 +04:00
|
|
|
virtual void Init(nsIContent* aContent,
|
|
|
|
nsContainerFrame* aParent,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsIFrame* aPrevInFlow) override;
|
2014-01-04 12:29:02 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool IsFrameOfType(uint32_t aFlags) const override
|
2014-01-04 12:29:02 +04:00
|
|
|
{
|
2016-04-18 10:38:47 +03:00
|
|
|
return nsFrame::IsFrameOfType(aFlags & ~(nsIFrame::eSVG | nsIFrame::eSVGGeometry));
|
2014-01-04 12:29:02 +04:00
|
|
|
}
|
|
|
|
|
2014-02-18 11:47:48 +04:00
|
|
|
virtual nsresult AttributeChanged(int32_t aNameSpaceID,
|
2014-02-18 12:36:33 +04:00
|
|
|
nsIAtom* aAttribute,
|
2015-03-21 19:28:04 +03:00
|
|
|
int32_t aModType) override;
|
2001-12-12 10:59:31 +03:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void DidSetStyleContext(nsStyleContext* aOldStyleContext) override;
|
2013-08-14 13:51:00 +04:00
|
|
|
|
2005-04-01 23:56:08 +04:00
|
|
|
/**
|
|
|
|
* Get the "type" of the frame
|
|
|
|
*
|
2016-12-18 14:11:47 +03:00
|
|
|
* @see nsGkAtoms::svgGeometryFrame
|
2005-04-01 23:56:08 +04:00
|
|
|
*/
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsIAtom* GetType() const override;
|
2005-04-01 23:56:08 +04:00
|
|
|
|
2013-12-30 10:50:17 +04:00
|
|
|
virtual bool IsSVGTransformed(Matrix *aOwnTransforms = nullptr,
|
2015-03-21 19:28:04 +03:00
|
|
|
Matrix *aFromParentTransforms = nullptr) const override;
|
2012-05-17 08:05:09 +04:00
|
|
|
|
2014-01-06 03:31:14 +04:00
|
|
|
#ifdef DEBUG_FRAME_DUMP
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsresult GetFrameName(nsAString& aResult) const override
|
2005-04-01 23:56:08 +04:00
|
|
|
{
|
2016-12-18 14:11:47 +03:00
|
|
|
return MakeFrameName(NS_LITERAL_STRING("SVGGeometry"), aResult);
|
2005-04-01 23:56:08 +04:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2013-02-14 15:12:27 +04:00
|
|
|
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
2015-03-21 19:28:04 +03:00
|
|
|
const nsDisplayListSet& aLists) override;
|
2012-07-20 22:12:29 +04:00
|
|
|
|
2016-12-18 14:11:47 +03:00
|
|
|
// SVGGeometryFrame methods
|
2014-09-08 15:28:50 +04:00
|
|
|
gfxMatrix GetCanvasTM();
|
2005-04-01 23:56:08 +04: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 15:39:26 +03:00
|
|
|
// nsISVGChildFrame interface:
|
2016-07-14 07:47:06 +03:00
|
|
|
virtual DrawResult PaintSVG(gfxContext& aContext,
|
|
|
|
const gfxMatrix& aTransform,
|
|
|
|
const nsIntRect* aDirtyRect = nullptr) override;
|
2015-03-21 19:28:04 +03: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 10:50:17 +04:00
|
|
|
virtual SVGBBox GetBBoxContribution(const Matrix &aToBBoxUserspace,
|
2015-03-21 19:28:04 +03:00
|
|
|
uint32_t aFlags) override;
|
|
|
|
virtual bool IsDisplayContainer() override { return false; }
|
2006-06-29 02:04:48 +04:00
|
|
|
|
2014-01-04 12:29:02 +04: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 19:42:28 +04:00
|
|
|
private:
|
2013-01-13 03:27:53 +04:00
|
|
|
enum { eRenderFill = 1, eRenderStroke = 2 };
|
2017-03-17 23:54:01 +03:00
|
|
|
void Render(gfxContext* aContext, uint32_t aRenderComponents,
|
|
|
|
const gfxMatrix& aTransform);
|
2014-08-29 23:42:07 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param aMatrix The transform that must be multiplied onto aContext to
|
|
|
|
* establish this frame's SVG user space.
|
|
|
|
*/
|
2014-10-31 23:08:54 +03:00
|
|
|
void PaintMarkers(gfxContext& aContext, const gfxMatrix& aMatrix);
|
2006-06-02 18:26:28 +04:00
|
|
|
|
2008-10-10 17:14:05 +04:00
|
|
|
struct MarkerProperties {
|
|
|
|
nsSVGMarkerProperty* mMarkerStart;
|
|
|
|
nsSVGMarkerProperty* mMarkerMid;
|
|
|
|
nsSVGMarkerProperty* mMarkerEnd;
|
2006-03-01 13:59:36 +03:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool MarkersExist() const {
|
2008-10-10 17:14:05 +04:00
|
|
|
return mMarkerStart || mMarkerMid || mMarkerEnd;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsSVGMarkerFrame *GetMarkerStartFrame();
|
|
|
|
nsSVGMarkerFrame *GetMarkerMidFrame();
|
|
|
|
nsSVGMarkerFrame *GetMarkerEndFrame();
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param aFrame should be the first continuation
|
|
|
|
*/
|
2016-12-18 14:11:47 +03:00
|
|
|
static MarkerProperties GetMarkerProperties(SVGGeometryFrame *aFrame);
|
2001-12-12 10:59:31 +03:00
|
|
|
};
|
2016-12-18 14:11:47 +03:00
|
|
|
} // namespace mozilla
|
2001-12-12 10:59:31 +03:00
|
|
|
|
2016-12-18 14:11:47 +03:00
|
|
|
#endif // __SVGGEOMETRYFRAME_H__
|