2017-10-27 20:33:53 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
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"
|
2017-02-09 21:24:31 +03:00
|
|
|
#include "nsSVGDisplayableFrame.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;
|
2018-08-13 15:03:35 +03:00
|
|
|
class SVGMarkerObserver;
|
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;
|
2017-10-03 01:05:19 +03:00
|
|
|
class nsAtom;
|
2012-03-20 16:15:55 +04:00
|
|
|
class nsIFrame;
|
2006-06-10 00:40:06 +04:00
|
|
|
class nsSVGMarkerFrame;
|
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
|
|
|
|
2019-04-16 10:24:49 +03:00
|
|
|
namespace mozilla {
|
|
|
|
class PresShell;
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
nsIFrame* NS_NewSVGGeometryFrame(mozilla::PresShell* aPresShell,
|
2018-03-22 21:20:41 +03:00
|
|
|
mozilla::ComputedStyle* aStyle);
|
2016-12-18 14:11:47 +03:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
|
|
|
|
class SVGGeometryFrame : public nsFrame, public nsSVGDisplayableFrame {
|
2014-09-30 21:08:13 +04:00
|
|
|
typedef mozilla::gfx::DrawTarget DrawTarget;
|
|
|
|
|
2019-04-16 10:24:49 +03:00
|
|
|
friend nsIFrame* ::NS_NewSVGGeometryFrame(mozilla::PresShell* aPresShell,
|
2018-03-22 21:20:41 +03:00
|
|
|
ComputedStyle* aStyle);
|
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:
|
2019-02-05 19:45:54 +03:00
|
|
|
SVGGeometryFrame(ComputedStyle* aStyle, nsPresContext* aPresContext,
|
|
|
|
nsIFrame::ClassID aID = kClassID)
|
|
|
|
: nsFrame(aStyle, aPresContext, aID) {
|
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:
|
2009-01-12 22:20:59 +03:00
|
|
|
NS_DECL_QUERYFRAME
|
2017-05-26 13:11:11 +03:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS(SVGGeometryFrame)
|
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 {
|
2018-08-08 01:02:07 +03:00
|
|
|
if (aFlags & eSupportsContainLayoutAndPaint) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
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, nsAtom* aAttribute,
|
2015-03-21 19:28:04 +03:00
|
|
|
int32_t aModType) override;
|
2001-12-12 10:59:31 +03:00
|
|
|
|
2018-03-22 21:20:41 +03:00
|
|
|
virtual void DidSetComputedStyle(ComputedStyle* aOldComputedStyle) override;
|
2013-08-14 13:51:00 +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 {
|
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,
|
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();
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2005-04-01 23:56:08 +04:00
|
|
|
protected:
|
2017-02-09 21:24:31 +03:00
|
|
|
// nsSVGDisplayableFrame interface:
|
2017-05-18 23:03:41 +03:00
|
|
|
virtual void PaintSVG(gfxContext& aContext, const gfxMatrix& aTransform,
|
|
|
|
imgDrawingParams& aImgParams,
|
|
|
|
const nsIntRect* aDirtyRect = nullptr) override;
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsIFrame* GetFrameForPoint(const gfxPoint& aPoint) 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();
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2006-06-21 19:42:28 +04:00
|
|
|
private:
|
2013-01-13 03:27:53 +04:00
|
|
|
enum { eRenderFill = 1, eRenderStroke = 2 };
|
2017-05-18 23:03:41 +03:00
|
|
|
void Render(gfxContext* aContext, uint32_t aRenderComponents,
|
|
|
|
const gfxMatrix& aTransform, imgDrawingParams& aImgParams);
|
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.
|
|
|
|
*/
|
2019-04-27 10:57:50 +03:00
|
|
|
void PaintMarkers(gfxContext& aContext, const gfxMatrix& aTransform,
|
2017-05-18 23:03:41 +03:00
|
|
|
imgDrawingParams& aImgParams);
|
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__
|