2015-05-03 22:32:37 +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/. */
|
2006-04-14 19:09:39 +04:00
|
|
|
|
2020-07-15 02:40:05 +03:00
|
|
|
#ifndef DOM_SVG_SVGMARKERELEMENT_H_
|
|
|
|
#define DOM_SVG_SVGMARKERELEMENT_H_
|
2006-04-14 19:09:39 +04:00
|
|
|
|
2019-03-19 03:01:03 +03:00
|
|
|
#include "DOMSVGAnimatedAngle.h"
|
|
|
|
#include "DOMSVGAnimatedEnumeration.h"
|
2019-04-04 20:40:56 +03:00
|
|
|
#include "SVGAnimatedEnumeration.h"
|
2019-04-09 23:04:33 +03:00
|
|
|
#include "SVGAnimatedLength.h"
|
2019-04-04 20:40:56 +03:00
|
|
|
#include "SVGAnimatedOrient.h"
|
|
|
|
#include "SVGAnimatedPreserveAspectRatio.h"
|
|
|
|
#include "SVGAnimatedViewBox.h"
|
2012-06-19 06:30:09 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2019-01-02 21:24:11 +03:00
|
|
|
#include "mozilla/dom/SVGElement.h"
|
2018-02-18 18:53:13 +03:00
|
|
|
#include "mozilla/dom/SVGMarkerElementBinding.h"
|
2020-02-25 23:03:26 +03:00
|
|
|
#include "mozilla/UniquePtr.h"
|
2006-04-14 19:09:39 +04:00
|
|
|
|
2013-01-30 02:11:44 +04:00
|
|
|
nsresult NS_NewSVGMarkerElement(
|
2014-06-20 06:01:40 +04:00
|
|
|
nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
|
2013-01-30 02:11:44 +04:00
|
|
|
|
|
|
|
namespace mozilla {
|
2019-01-26 16:01:31 +03:00
|
|
|
|
|
|
|
struct SVGMark;
|
2020-06-27 08:39:42 +03:00
|
|
|
class SVGMarkerFrame;
|
2019-01-26 16:01:31 +03:00
|
|
|
|
2013-01-30 02:11:44 +04:00
|
|
|
namespace dom {
|
|
|
|
|
2018-02-18 18:53:13 +03:00
|
|
|
// Non-Exposed Marker Orientation Types
|
|
|
|
static const uint16_t SVG_MARKER_ORIENT_AUTO_START_REVERSE = 3;
|
2013-02-19 02:48:54 +04:00
|
|
|
|
2020-07-15 13:37:55 +03:00
|
|
|
using SVGMarkerElementBase = SVGElement;
|
2006-04-14 19:09:39 +04:00
|
|
|
|
2013-03-28 05:23:09 +04:00
|
|
|
class SVGMarkerElement : public SVGMarkerElementBase {
|
2020-06-27 08:39:42 +03:00
|
|
|
friend class mozilla::SVGMarkerFrame;
|
2006-04-14 19:09:39 +04:00
|
|
|
|
|
|
|
protected:
|
2013-01-30 02:11:44 +04:00
|
|
|
friend nsresult(::NS_NewSVGMarkerElement(
|
|
|
|
nsIContent** aResult,
|
2014-06-20 06:01:40 +04:00
|
|
|
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
|
2018-09-21 23:45:49 +03:00
|
|
|
explicit SVGMarkerElement(
|
|
|
|
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual JSObject* WrapNode(JSContext* cx,
|
|
|
|
JS::Handle<JSObject*> aGivenProto) override;
|
2006-04-14 19:09:39 +04:00
|
|
|
|
|
|
|
public:
|
|
|
|
// nsIContent interface
|
2017-10-03 01:05:19 +03:00
|
|
|
NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* name) const override;
|
2006-04-14 19:09:39 +04:00
|
|
|
|
2020-07-11 05:20:20 +03:00
|
|
|
// SVGSVGElement methods:
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool HasValidDimensions() const override;
|
2012-03-03 13:21:09 +04:00
|
|
|
|
2006-04-27 01:02:25 +04:00
|
|
|
// public helpers
|
2019-01-26 16:01:31 +03:00
|
|
|
gfx::Matrix GetMarkerTransform(float aStrokeWidth, const SVGMark& aMark);
|
2019-04-10 07:08:14 +03:00
|
|
|
SVGViewBox GetViewBox();
|
2013-12-30 10:50:17 +04:00
|
|
|
gfx::Matrix GetViewBoxTransform();
|
2006-04-27 01:02:25 +04:00
|
|
|
|
2018-08-09 02:58:44 +03:00
|
|
|
virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
|
2006-09-05 14:22:54 +04:00
|
|
|
|
2013-01-30 02:11:44 +04:00
|
|
|
// WebIDL
|
2013-05-09 21:42:12 +04:00
|
|
|
already_AddRefed<SVGAnimatedRect> ViewBox();
|
2013-01-30 02:11:44 +04:00
|
|
|
already_AddRefed<DOMSVGAnimatedPreserveAspectRatio> PreserveAspectRatio();
|
2019-03-19 03:01:03 +03:00
|
|
|
already_AddRefed<DOMSVGAnimatedLength> RefX();
|
|
|
|
already_AddRefed<DOMSVGAnimatedLength> RefY();
|
|
|
|
already_AddRefed<DOMSVGAnimatedEnumeration> MarkerUnits();
|
|
|
|
already_AddRefed<DOMSVGAnimatedLength> MarkerWidth();
|
|
|
|
already_AddRefed<DOMSVGAnimatedLength> MarkerHeight();
|
|
|
|
already_AddRefed<DOMSVGAnimatedEnumeration> OrientType();
|
|
|
|
already_AddRefed<DOMSVGAnimatedAngle> OrientAngle();
|
2013-02-19 02:48:54 +04:00
|
|
|
void SetOrientToAuto();
|
2018-12-30 21:18:30 +03:00
|
|
|
void SetOrientToAngle(DOMSVGAngle& angle, ErrorResult& rv);
|
2013-01-30 02:11:44 +04:00
|
|
|
|
2006-04-14 19:09:39 +04:00
|
|
|
protected:
|
2017-10-10 09:58:34 +03:00
|
|
|
void SetParentCoordCtxProvider(SVGViewportElement* aContext);
|
2006-04-14 19:09:39 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual LengthAttributesInfo GetLengthInfo() override;
|
|
|
|
virtual EnumAttributesInfo GetEnumInfo() override;
|
2019-04-10 07:08:14 +03:00
|
|
|
virtual SVGAnimatedOrient* GetAnimatedOrient() override;
|
|
|
|
virtual SVGAnimatedPreserveAspectRatio* GetAnimatedPreserveAspectRatio()
|
|
|
|
override;
|
|
|
|
virtual SVGAnimatedViewBox* GetAnimatedViewBox() override;
|
2007-08-28 03:11:14 +04:00
|
|
|
|
2006-04-14 19:09:39 +04:00
|
|
|
enum { REFX, REFY, MARKERWIDTH, MARKERHEIGHT };
|
2019-04-09 23:04:33 +03:00
|
|
|
SVGAnimatedLength mLengthAttributes[4];
|
2006-04-14 19:09:39 +04:00
|
|
|
static LengthInfo sLengthInfo[4];
|
|
|
|
|
2008-01-09 12:52:14 +03:00
|
|
|
enum { MARKERUNITS };
|
2019-04-04 20:40:56 +03:00
|
|
|
SVGAnimatedEnumeration mEnumAttributes[1];
|
2019-01-02 21:24:11 +03:00
|
|
|
static SVGEnumMapping sUnitsMap[];
|
2007-08-28 03:11:14 +04:00
|
|
|
static EnumInfo sEnumInfo[1];
|
|
|
|
|
2019-04-04 20:40:56 +03:00
|
|
|
SVGAnimatedOrient mOrient;
|
|
|
|
SVGAnimatedViewBox mViewBox;
|
2010-12-20 03:45:29 +03:00
|
|
|
SVGAnimatedPreserveAspectRatio mPreserveAspectRatio;
|
2009-01-05 04:19:38 +03:00
|
|
|
|
2017-10-10 09:58:34 +03:00
|
|
|
SVGViewportElement* mCoordCtx;
|
2020-02-25 23:03:26 +03:00
|
|
|
UniquePtr<gfx::Matrix> mViewBoxToViewportTransform;
|
2006-04-14 19:09:39 +04:00
|
|
|
};
|
|
|
|
|
2013-01-30 02:11:44 +04:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2020-07-15 02:40:05 +03:00
|
|
|
#endif // DOM_SVG_SVGMARKERELEMENT_H_
|